Skip to content

Commit 69bb011

Browse files
committed
Apply requests from review + failing CI
1 parent 1b9aff4 commit 69bb011

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/graphql/pyutils/undefined.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
"""The Undefined value"""
22

33
from __future__ import annotations
4-
from typing_extensions import Self
54

65
import warnings
6+
from typing import TYPE_CHECKING
7+
8+
if TYPE_CHECKING:
9+
try:
10+
from typing import Self
11+
except ImportError: # Python < 3.11
12+
from typing_extensions import Self
713

814
__all__ = ["Undefined", "UndefinedType"]
915

1016

1117
class UndefinedType:
1218
"""Auxiliary class for creating the Undefined singleton."""
1319

14-
_instance: UndefinedType | None = None
20+
_instance: Self | None = None
1521

1622
def __new__(cls) -> Self:
1723
"""Create the Undefined singleton."""

src/graphql/type/definition.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
cast,
1515
overload,
1616
)
17-
from typing_extensions import Self
1817

1918
if TYPE_CHECKING:
2019
from typing import TypeAlias, TypeGuard
@@ -60,6 +59,11 @@
6059
if TYPE_CHECKING:
6160
from .schema import GraphQLSchema
6261

62+
try:
63+
from typing import Self
64+
except ImportError: # Python < 3.11
65+
from typing_extensions import Self
66+
6367

6468
__all__ = [
6569
"GraphQLAbstractType",

0 commit comments

Comments
 (0)