Skip to content

Commit 4b361c5

Browse files
ref(types): Replace custom TYPE_CHECKING with stdlib typing.TYPE_CHECKING (#3447)
--------- Co-authored-by: Ivana Kellyer <[email protected]>
1 parent 306c34e commit 4b361c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+192
-142
lines changed

scripts/init_serverless_sdk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
import re
1212

1313
import sentry_sdk
14-
from sentry_sdk._types import TYPE_CHECKING
1514
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration
1615

16+
from typing import TYPE_CHECKING
17+
1718
if TYPE_CHECKING:
1819
from typing import Any
1920

sentry_sdk/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
from sentry_sdk._types import TYPE_CHECKING
3+
from typing import TYPE_CHECKING
44

55
if TYPE_CHECKING:
66
from typing import Any

sentry_sdk/_queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
from collections import deque
7777
from time import time
7878

79-
from sentry_sdk._types import TYPE_CHECKING
79+
from typing import TYPE_CHECKING
8080

8181
if TYPE_CHECKING:
8282
from typing import Any

sentry_sdk/_types.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
try:
2-
from typing import TYPE_CHECKING
3-
except ImportError:
4-
TYPE_CHECKING = False
1+
from typing import TYPE_CHECKING
52

63

74
# Re-exported for compat, since code out there in the wild might use this variable.

sentry_sdk/_werkzeug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
SUCH DAMAGE.
3333
"""
3434

35-
from sentry_sdk._types import TYPE_CHECKING
35+
from typing import TYPE_CHECKING
3636

3737
if TYPE_CHECKING:
3838
from typing import Dict

sentry_sdk/ai/monitoring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from sentry_sdk import start_span
66
from sentry_sdk.tracing import Span
77
from sentry_sdk.utils import ContextVar
8-
from sentry_sdk._types import TYPE_CHECKING
8+
9+
from typing import TYPE_CHECKING
910

1011
if TYPE_CHECKING:
1112
from typing import Optional, Callable, Any

sentry_sdk/ai/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from sentry_sdk._types import TYPE_CHECKING
1+
from typing import TYPE_CHECKING
22

33
if TYPE_CHECKING:
44
from typing import Any

sentry_sdk/api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
from sentry_sdk.tracing import NoOpSpan, Transaction, trace
1010
from sentry_sdk.crons import monitor
1111

12-
13-
from sentry_sdk._types import TYPE_CHECKING
12+
from typing import TYPE_CHECKING
1413

1514
if TYPE_CHECKING:
1615
from collections.abc import Mapping

sentry_sdk/attachments.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import os
22
import mimetypes
33

4-
from sentry_sdk._types import TYPE_CHECKING
54
from sentry_sdk.envelope import Item, PayloadRef
65

6+
from typing import TYPE_CHECKING
7+
78
if TYPE_CHECKING:
89
from typing import Optional, Union, Callable
910

sentry_sdk/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from sentry_sdk.monitor import Monitor
4545
from sentry_sdk.spotlight import setup_spotlight
4646

47-
from sentry_sdk._types import TYPE_CHECKING
47+
from typing import TYPE_CHECKING
4848

4949
if TYPE_CHECKING:
5050
from typing import Any
@@ -881,7 +881,7 @@ def __exit__(self, exc_type, exc_value, tb):
881881
self.close()
882882

883883

884-
from sentry_sdk._types import TYPE_CHECKING
884+
from typing import TYPE_CHECKING
885885

886886
if TYPE_CHECKING:
887887
# Make mypy, PyCharm and other static analyzers think `get_options` is a

0 commit comments

Comments
 (0)