Skip to content

Commit d77d0b0

Browse files
rapsealkerikwrede
andauthored
chore: Use typing.TYPE_CHECKING instead of MYPY (#1503)
Co-authored-by: Erik Wrede <erikwrede@users.noreply.github.com>
1 parent c636d98 commit d77d0b0

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

graphene/types/inputobjecttype.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
from typing import TYPE_CHECKING
2+
13
from .base import BaseOptions, BaseType
24
from .inputfield import InputField
35
from .unmountedtype import UnmountedType
46
from .utils import yank_fields_from_attrs
57

6-
# For static type checking with Mypy
7-
MYPY = False
8-
if MYPY:
8+
# For static type checking with type checker
9+
if TYPE_CHECKING:
910
from typing import Dict, Callable # NOQA
1011

1112

graphene/types/interface.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from typing import TYPE_CHECKING
2+
13
from .base import BaseOptions, BaseType
24
from .field import Field
35
from .utils import yank_fields_from_attrs
46

5-
# For static type checking with Mypy
6-
MYPY = False
7-
if MYPY:
7+
# For static type checking with type checker
8+
if TYPE_CHECKING:
89
from typing import Dict, Iterable, Type # NOQA
910

1011

graphene/types/mutation.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import TYPE_CHECKING
2+
13
from ..utils.deprecated import warn_deprecation
24
from ..utils.get_unbound_function import get_unbound_function
35
from ..utils.props import props
@@ -6,9 +8,8 @@
68
from .utils import yank_fields_from_attrs
79
from .interface import Interface
810

9-
# For static type checking with Mypy
10-
MYPY = False
11-
if MYPY:
11+
# For static type checking with type checker
12+
if TYPE_CHECKING:
1213
from .argument import Argument # NOQA
1314
from typing import Dict, Type, Callable, Iterable # NOQA
1415

graphene/types/objecttype.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import TYPE_CHECKING
2+
13
from .base import BaseOptions, BaseType, BaseTypeMeta
24
from .field import Field
35
from .interface import Interface
@@ -7,9 +9,8 @@
79
from dataclasses import make_dataclass, field
810
except ImportError:
911
from ..pyutils.dataclasses import make_dataclass, field # type: ignore
10-
# For static type checking with Mypy
11-
MYPY = False
12-
if MYPY:
12+
# For static type checking with type checker
13+
if TYPE_CHECKING:
1314
from typing import Dict, Iterable, Type # NOQA
1415

1516

graphene/types/union.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
from typing import TYPE_CHECKING
2+
13
from .base import BaseOptions, BaseType
24
from .unmountedtype import UnmountedType
35

4-
# For static type checking with Mypy
5-
MYPY = False
6-
if MYPY:
6+
# For static type checking with type checker
7+
if TYPE_CHECKING:
78
from .objecttype import ObjectType # NOQA
89
from typing import Iterable, Type # NOQA
910

0 commit comments

Comments
 (0)