Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use typing.TYPE_CHECKING instead of MYPY #1503

Merged
merged 2 commits into from
Jun 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions graphene/types/inputobjecttype.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from typing import TYPE_CHECKING

from .base import BaseOptions, BaseType
from .inputfield import InputField
from .unmountedtype import UnmountedType
from .utils import yank_fields_from_attrs

# For static type checking with Mypy
MYPY = False
if MYPY:
# For static type checking with type checker
if TYPE_CHECKING:
from typing import Dict, Callable # NOQA


Expand Down
7 changes: 4 additions & 3 deletions graphene/types/interface.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
from typing import TYPE_CHECKING

from .base import BaseOptions, BaseType
from .field import Field
from .utils import yank_fields_from_attrs

# For static type checking with Mypy
MYPY = False
if MYPY:
# For static type checking with type checker
if TYPE_CHECKING:
from typing import Dict, Iterable, Type # NOQA


Expand Down
7 changes: 4 additions & 3 deletions graphene/types/mutation.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import TYPE_CHECKING

from ..utils.deprecated import warn_deprecation
from ..utils.get_unbound_function import get_unbound_function
from ..utils.props import props
Expand All @@ -6,9 +8,8 @@
from .utils import yank_fields_from_attrs
from .interface import Interface

# For static type checking with Mypy
MYPY = False
if MYPY:
# For static type checking with type checker
if TYPE_CHECKING:
from .argument import Argument # NOQA
from typing import Dict, Type, Callable, Iterable # NOQA

Expand Down
7 changes: 4 additions & 3 deletions graphene/types/objecttype.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import TYPE_CHECKING

from .base import BaseOptions, BaseType, BaseTypeMeta
from .field import Field
from .interface import Interface
Expand All @@ -7,9 +9,8 @@
from dataclasses import make_dataclass, field
except ImportError:
from ..pyutils.dataclasses import make_dataclass, field # type: ignore
# For static type checking with Mypy
MYPY = False
if MYPY:
# For static type checking with type checker
if TYPE_CHECKING:
from typing import Dict, Iterable, Type # NOQA


Expand Down
7 changes: 4 additions & 3 deletions graphene/types/union.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from typing import TYPE_CHECKING

from .base import BaseOptions, BaseType
from .unmountedtype import UnmountedType

# For static type checking with Mypy
MYPY = False
if MYPY:
# For static type checking with type checker
if TYPE_CHECKING:
from .objecttype import ObjectType # NOQA
from typing import Iterable, Type # NOQA

Expand Down