Skip to content

Commit 223e7a9

Browse files
committed
ref: Use explicit MYPY constant for readability
1 parent cd2206f commit 223e7a9

33 files changed

+68
-34
lines changed

sentry_sdk/_compat.py

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

3-
if False:
3+
MYPY = False
4+
if MYPY:
45
from typing import Optional
56
from typing import Tuple
67
from typing import Any

sentry_sdk/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
from sentry_sdk.scope import Scope
66

77

8-
if False:
8+
MYPY = False
9+
if MYPY:
910
from typing import Any
1011
from typing import Optional
1112
from typing import overload

sentry_sdk/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
from sentry_sdk.integrations import setup_integrations
1818
from sentry_sdk.utils import ContextVar
1919

20-
if False:
20+
MYPY = False
21+
if MYPY:
2122
from typing import Any
2223
from typing import Callable
2324
from typing import Dict

sentry_sdk/consts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import socket
22

3-
if False:
3+
MYPY = False
4+
if MYPY:
45
from mypy_extensions import TypedDict
56
from typing import Optional
67
from typing import Callable

sentry_sdk/hub.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
)
1717

1818

19-
if False:
19+
MYPY = False
20+
if MYPY:
2021
from contextlib import ContextManager
2122
from sys import _OptExcInfo
2223

@@ -174,7 +175,8 @@ class Hub(with_metaclass(HubMeta)): # type: ignore
174175
_stack = None # type: List[Tuple[Optional[Client], Scope]]
175176

176177
# Mypy doesn't pick up on the metaclass.
177-
if False:
178+
MYPY = False
179+
if MYPY:
178180
current = None # type: Hub
179181
main = None # type: Hub
180182

sentry_sdk/integrations/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from sentry_sdk._compat import iteritems
77
from sentry_sdk.utils import logger
88

9-
if False:
9+
MYPY = False
10+
if MYPY:
1011
from typing import Iterator
1112
from typing import Dict
1213
from typing import List

sentry_sdk/integrations/_wsgi_common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from sentry_sdk.utils import AnnotatedValue
55
from sentry_sdk._compat import text_type, iteritems
66

7-
if False:
7+
MYPY = False
8+
if MYPY:
89
from typing import Any
910
from typing import Dict
1011
from typing import Optional

sentry_sdk/integrations/aiohttp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
import asyncio
1616
from aiohttp.web import Application, HTTPException # type: ignore
1717

18-
if False:
18+
MYPY = False
19+
if MYPY:
1920
from aiohttp.web_request import Request # type: ignore
2021
from typing import Any
2122
from typing import Dict

sentry_sdk/integrations/argv.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from sentry_sdk.integrations import Integration
77
from sentry_sdk.scope import add_global_event_processor
88

9-
if False:
9+
MYPY = False
10+
if MYPY:
1011
from typing import Optional
1112

1213
from sentry_sdk.utils import Event, Hint

sentry_sdk/integrations/atexit.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from sentry_sdk.utils import logger
99
from sentry_sdk.integrations import Integration
1010

11-
if False:
11+
MYPY = False
12+
if MYPY:
1213

1314
from typing import Any
1415
from typing import Optional

0 commit comments

Comments
 (0)