Skip to content

Commit e6415ae

Browse files
committed
Add @trace overloads to fix typing
1 parent 106fe71 commit e6415ae

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

sentry_sdk/traces.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
Callable,
3838
Iterator,
3939
Optional,
40+
overload,
4041
ParamSpec,
4142
TypeVar,
4243
Union,
@@ -703,6 +704,23 @@ def timestamp(self) -> "Optional[datetime]":
703704
return None
704705

705706

707+
if TYPE_CHECKING:
708+
709+
@overload
710+
def trace(
711+
func: "Callable[P, R]",
712+
) -> "Callable[P, R]": ...
713+
714+
@overload
715+
def trace(
716+
func: None = None,
717+
*,
718+
name: "Optional[str]" = None,
719+
attributes: "Optional[dict[str, Any]]" = None,
720+
active: bool = True,
721+
) -> "Callable[[Callable[P, R]], Callable[P, R]]": ...
722+
723+
706724
def trace(
707725
func: "Optional[Callable[P, R]]" = None,
708726
*,

0 commit comments

Comments
 (0)