Skip to content

Commit 730ac15

Browse files
committed
Update dependencies and fix typing
1 parent 876aef6 commit 730ac15

File tree

7 files changed

+150
-145
lines changed

7 files changed

+150
-145
lines changed

poetry.lock

Lines changed: 115 additions & 115 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ optional = true
5252

5353
[tool.poetry.group.test.dependencies]
5454
pytest = [
55-
{ version = "^8.2", python = ">=3.8" },
55+
{ version = "^8.3", python = ">=3.8" },
5656
{ version = "^7.4", python = "<3.8"}
5757
]
5858
pytest-asyncio = [
59-
{ version = "^0.23.6", python = ">=3.8" },
59+
{ version = "^0.23.8", python = ">=3.8" },
6060
{ version = "~0.21.1", python = "<3.8"}
6161
]
6262
pytest-benchmark = "^4.0"
@@ -67,15 +67,15 @@ pytest-cov = [
6767
pytest-describe = "^2.2"
6868
pytest-timeout = "^2.3"
6969
tox = [
70-
{ version = "^4.14", python = ">=3.8" },
70+
{ version = "^4.16", python = ">=3.8" },
7171
{ version = "^3.28", python = "<3.8" }
7272
]
7373

7474
[tool.poetry.group.lint]
7575
optional = true
7676

7777
[tool.poetry.group.lint.dependencies]
78-
ruff = ">=0.5.1,<0.6"
78+
ruff = ">=0.5.3,<0.6"
7979
mypy = [
8080
{ version = "^1.10", python = ">=3.8" },
8181
{ version = "~1.4", python = "<3.8" }

src/graphql/execution/async_iterables.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
AsyncIterable,
99
Awaitable,
1010
Callable,
11+
Generic,
1112
TypeVar,
1213
Union,
1314
)
@@ -20,7 +21,7 @@
2021
AsyncIterableOrGenerator = Union[AsyncGenerator[T, None], AsyncIterable[T]]
2122

2223

23-
class aclosing(AbstractAsyncContextManager): # noqa: N801
24+
class aclosing(AbstractAsyncContextManager, Generic[T]): # noqa: N801
2425
"""Async context manager for safely finalizing an async iterator or generator.
2526
2627
Contrary to the function available via the standard library, this one silently
@@ -52,6 +53,6 @@ async def map_async_iterable(
5253
If the inner iterator supports an `aclose()` method, it will be called when
5354
the generator finishes or closes.
5455
"""
55-
async with aclosing(iterable) as items: # type: ignore
56+
async with aclosing(iterable) as items:
5657
async for item in items:
5758
yield await callback(item)

src/graphql/utilities/extend_schema.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,24 @@
5555
GraphQLInputField,
5656
GraphQLInputFieldMap,
5757
GraphQLInputObjectType,
58+
GraphQLInputObjectTypeKwargs,
5859
GraphQLInputType,
5960
GraphQLInterfaceType,
61+
GraphQLInterfaceTypeKwargs,
6062
GraphQLList,
6163
GraphQLNamedType,
6264
GraphQLNonNull,
6365
GraphQLNullableType,
6466
GraphQLObjectType,
67+
GraphQLObjectTypeKwargs,
6568
GraphQLOutputType,
6669
GraphQLScalarType,
6770
GraphQLSchema,
6871
GraphQLSchemaKwargs,
6972
GraphQLSpecifiedByDirective,
7073
GraphQLType,
7174
GraphQLUnionType,
75+
GraphQLUnionTypeKwargs,
7276
assert_schema,
7377
introspection_types,
7478
is_enum_type,
@@ -326,7 +330,7 @@ def extend_named_type(self, type_: GraphQLNamedType) -> GraphQLNamedType:
326330
raise TypeError(msg) # pragma: no cover
327331

328332
def extend_input_object_type_fields(
329-
self, kwargs: dict[str, Any], extensions: tuple[Any, ...]
333+
self, kwargs: GraphQLInputObjectTypeKwargs, extensions: tuple[Any, ...]
330334
) -> GraphQLInputFieldMap:
331335
"""Extend GraphQL input object type fields."""
332336
return {
@@ -392,7 +396,7 @@ def extend_scalar_type(self, type_: GraphQLScalarType) -> GraphQLScalarType:
392396
)
393397

394398
def extend_object_type_interfaces(
395-
self, kwargs: dict[str, Any], extensions: tuple[Any, ...]
399+
self, kwargs: GraphQLObjectTypeKwargs, extensions: tuple[Any, ...]
396400
) -> list[GraphQLInterfaceType]:
397401
"""Extend a GraphQL object type interface."""
398402
return [
@@ -401,7 +405,7 @@ def extend_object_type_interfaces(
401405
] + self.build_interfaces(extensions)
402406

403407
def extend_object_type_fields(
404-
self, kwargs: dict[str, Any], extensions: tuple[Any, ...]
408+
self, kwargs: GraphQLObjectTypeKwargs, extensions: tuple[Any, ...]
405409
) -> GraphQLFieldMap:
406410
"""Extend GraphQL object type fields."""
407411
return {
@@ -430,7 +434,7 @@ def extend_object_type(self, type_: GraphQLObjectType) -> GraphQLObjectType:
430434
)
431435

432436
def extend_interface_type_interfaces(
433-
self, kwargs: dict[str, Any], extensions: tuple[Any, ...]
437+
self, kwargs: GraphQLInterfaceTypeKwargs, extensions: tuple[Any, ...]
434438
) -> list[GraphQLInterfaceType]:
435439
"""Extend GraphQL interface type interfaces."""
436440
return [
@@ -439,7 +443,7 @@ def extend_interface_type_interfaces(
439443
] + self.build_interfaces(extensions)
440444

441445
def extend_interface_type_fields(
442-
self, kwargs: dict[str, Any], extensions: tuple[Any, ...]
446+
self, kwargs: GraphQLInterfaceTypeKwargs, extensions: tuple[Any, ...]
443447
) -> GraphQLFieldMap:
444448
"""Extend GraphQL interface type fields."""
445449
return {
@@ -470,7 +474,7 @@ def extend_interface_type(
470474
)
471475

472476
def extend_union_type_types(
473-
self, kwargs: dict[str, Any], extensions: tuple[Any, ...]
477+
self, kwargs: GraphQLUnionTypeKwargs, extensions: tuple[Any, ...]
474478
) -> list[GraphQLObjectType]:
475479
"""Extend types of a GraphQL union type."""
476480
return [

tests/type/test_definition.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -714,35 +714,35 @@ def defines_an_enum_using_an_enum_value_map():
714714
assert enum_type.values == {"RED": red, "BLUE": blue}
715715

716716
def defines_an_enum_using_a_python_enum():
717-
colors = Enum("Colors", "RED BLUE")
718-
enum_type = GraphQLEnumType("SomeEnum", colors)
717+
Colors = Enum("Colors", "RED BLUE")
718+
enum_type = GraphQLEnumType("SomeEnum", Colors)
719719
assert enum_type.values == {
720720
"RED": GraphQLEnumValue(1),
721721
"BLUE": GraphQLEnumValue(2),
722722
}
723723

724724
def defines_an_enum_using_values_of_a_python_enum():
725-
colors = Enum("Colors", "RED BLUE")
726-
enum_type = GraphQLEnumType("SomeEnum", colors, names_as_values=False)
725+
Colors = Enum("Colors", "RED BLUE")
726+
enum_type = GraphQLEnumType("SomeEnum", Colors, names_as_values=False)
727727
assert enum_type.values == {
728728
"RED": GraphQLEnumValue(1),
729729
"BLUE": GraphQLEnumValue(2),
730730
}
731731

732732
def defines_an_enum_using_names_of_a_python_enum():
733-
colors = Enum("Colors", "RED BLUE")
734-
enum_type = GraphQLEnumType("SomeEnum", colors, names_as_values=True)
733+
Colors = Enum("Colors", "RED BLUE")
734+
enum_type = GraphQLEnumType("SomeEnum", Colors, names_as_values=True)
735735
assert enum_type.values == {
736736
"RED": GraphQLEnumValue("RED"),
737737
"BLUE": GraphQLEnumValue("BLUE"),
738738
}
739739

740740
def defines_an_enum_using_members_of_a_python_enum():
741-
colors = Enum("Colors", "RED BLUE")
742-
enum_type = GraphQLEnumType("SomeEnum", colors, names_as_values=None)
741+
Colors = Enum("Colors", "RED BLUE")
742+
enum_type = GraphQLEnumType("SomeEnum", Colors, names_as_values=None)
743743
assert enum_type.values == {
744-
"RED": GraphQLEnumValue(colors.RED),
745-
"BLUE": GraphQLEnumValue(colors.BLUE),
744+
"RED": GraphQLEnumValue(Colors.RED),
745+
"BLUE": GraphQLEnumValue(Colors.BLUE),
746746
}
747747

748748
def defines_an_enum_type_with_a_description():

tests/validation/harness.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING
3+
from typing import TYPE_CHECKING, Any
44

55
from graphql.language import parse
66
from graphql.utilities import build_schema
@@ -9,7 +9,7 @@
99
if TYPE_CHECKING:
1010
from graphql.error import GraphQLError
1111
from graphql.type import GraphQLSchema
12-
from graphql.validation import SDLValidationRule, ValidationRule
12+
from graphql.validation import ASTValidationRule
1313

1414
__all__ = [
1515
"test_schema",
@@ -125,9 +125,9 @@
125125

126126

127127
def assert_validation_errors(
128-
rule: type[ValidationRule],
128+
rule: type[ASTValidationRule],
129129
query_str: str,
130-
errors: list[GraphQLError],
130+
errors: list[GraphQLError | dict[str, Any]],
131131
schema: GraphQLSchema = test_schema,
132132
) -> list[GraphQLError]:
133133
doc = parse(query_str)
@@ -137,9 +137,9 @@ def assert_validation_errors(
137137

138138

139139
def assert_sdl_validation_errors(
140-
rule: type[SDLValidationRule],
140+
rule: type[ASTValidationRule],
141141
sdl_str: str,
142-
errors: list[GraphQLError],
142+
errors: list[GraphQLError | dict[str, Any]],
143143
schema: GraphQLSchema | None = None,
144144
) -> list[GraphQLError]:
145145
doc = parse(sdl_str)

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ python =
1717

1818
[testenv:ruff]
1919
basepython = python3.12
20-
deps = ruff>=0.5.1,<0.6
20+
deps = ruff>=0.5.3,<0.6
2121
commands =
2222
ruff check src tests
2323
ruff format --check src tests
@@ -26,7 +26,7 @@ commands =
2626
basepython = python3.12
2727
deps =
2828
mypy>=1.10,<2
29-
pytest>=8.2,<9
29+
pytest>=8.3,<9
3030
commands =
3131
mypy src tests
3232

0 commit comments

Comments
 (0)