8000 Update mypy · graphql-python/graphql-core@37f8eb2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 37f8eb2

Browse files
committed
Update mypy
1 parent 4d240d4 commit 37f8eb2

File tree

10 files changed

+21
-23
lines changed

10 files changed

+21
-23
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
24-
pip install "tox>=4.12,<5" "tox-gh-actions>=3.2,<4"
24+
pip install "tox>=3.28,<5" "tox-gh-actions>=3.2,<4"
2525
2626
- name: Run unit tests with tox
2727
run: tox

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GraphQL-core 3
22

3-
GraphQL-core 3 is a Python 3.7+ port of [GraphQL.js](https://github.com/graphql/graphql-js),
3+
GraphQL-core 3 is a Python 3.6+ port of [GraphQL.js](https://github.com/graphql/graphql-js),
44
the JavaScript reference implementation for [GraphQL](https://graphql.org/),
55
a query language for APIs created by Facebook.
66

@@ -203,7 +203,7 @@ Design goals for the GraphQL-core 3 library were:
203203

204204
Some restrictions (mostly in line with the design goals):
205205

206-
* requires Python 3.7 or newer
206+
* requires Python 3.6 or newer (Python 3.7 and newer in latest version)
207207
* does not support some already deprecated methods and options of GraphQL.js
208208
* supports asynchronous operations only via async.io
209209
(does not support the additional executors in GraphQL-core)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ optional = true
6464

6565
[tool.poetry.group.lint.dependencies]
6666
ruff = ">=0.2,<0.3"
67-
mypy = "1.3.0"
67+
mypy = "1.8.0"
6868
bump2version = ">=1.0,<2"
6969

7070
[tool.poetry.group.doc]

src/graphql/execution/execute.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ def execute(
20392039
raise GraphQLError(UNEXPECTED_MULTIPLE_PAYLOADS)
20402040

20412041
async def await_result() -> Any:
2042-
awaited_result = await result # type: ignore
2042+
awaited_result = await result
20432043
if isinstance(awaited_result, ExecutionResult):
20442044
return awaited_result
20452045
return ExecutionResult(
@@ -2388,7 +2388,7 @@ def subscribe(
23882388
return map_async_iterable(result, ensure_single_execution_result)
23892389

23902390
async def await_result() -> Union[AsyncIterator[ExecutionResult], ExecutionResult]:
2391-
result_or_iterable = await result # type: ignore
2391+
result_or_iterable = await result
23922392
if isinstance(result_or_iterable, AsyncIterable):
23932393
return map_async_iterable(
23942394
result_or_iterable, ensure_single_execution_result
@@ -2496,9 +2496,7 @@ async def await_result() -> Any:
24962496
awaited_result_or_stream = await result_or_stream # type: ignore
24972497
if isinstance(awaited_result_or_stream, ExecutionResult):
24982498
return awaited_result_or_stream
2499-
return context.map_source_to_response( # type: ignore
2500-
awaited_result_or_stream
2501-
)
2499+
return context.map_source_to_response(awaited_result_or_stream)
25022500

25032501
return await_result()
25042502

src/graphql/type/definition.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ def __init__(
10551055
isinstance(name, str) for name in values
10561056
):
10571057
try:
1058-
values = dict(values) # type: ignore
1058+
values = dict(values)
10591059
except (TypeError, ValueError) as error:
10601060
msg = (
10611061
f"{name} values must be an Enum or a mapping"

src/graphql/utilities/strip_ignored_characters.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
def strip_ignored_characters(source: Union[str, Source]) -> str:
14-
"""Strip characters that are ignored anyway.
14+
'''Strip characters that are ignored anyway.
1515
1616
Strips characters that are not significant to the validity or execution
1717
of a GraphQL document:
@@ -51,20 +51,20 @@ def strip_ignored_characters(source: Union[str, Source]) -> str:
5151
5252
SDL example::
5353
54-
\"\"\"
54+
"""
5555
Type description
56-
\"\"\"
56+
"""
5757
type Foo {
58-
\"\"\"
58+
"""
5959
Field description
60-
\"\"\"
60+
"""
6161
bar: String
6262
}
6363
6464
Becomes::
6565
66-
\"\"\"Type description\"\"\" type Foo{\"\"\"Field description\"\"\" bar:String}
67-
"""
66+
"""Type description""" type Foo{"""Field description""" bar:String}
67+
'''
6868
if not is_source(source):
6969
source = Source(cast(str, source))
7070

src/graphql/validation/validate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def validate(
5959
errors: List[GraphQLError] = []
6060

6161
def on_error(error: GraphQLError) -> None:
62-
if len(errors) >= max_errors: # type: ignore
62+
if len(errors) >= max_errors:
6363
raise validation_aborted_error
6464
errors.append(error)
6565

tests/test_user_registry.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,13 @@ async def mutate_users():
492492
)
493493

494494
async def receive_one():
495-
async for result in subscription_one: # type: ignore # pragma: no cover
495+
async for result in subscription_one: # pragma: no cover
496496
received_one.append(result)
497497
if len(received_one) == 3: # pragma: no cover else
498498
break
499499

500500
async def receive_all():
501-
async for result in subscription_all: # type: ignore # pragma: no cover
501+
async for result in subscription_all: # pragma: no cover
502502
received_all.append(result)
503503
if len(received_all) == 6: # pragma: no cover else
504504
break

tests/type/test_definition.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ def defines_an_enum_type_with_a_description():
735735
description = "nice enum"
736736
enum_type = GraphQLEnumType(
737737
"SomeEnum",
738-
{}, # type: ignore
738+
{},
739739
description=description,
740740
)
741741
assert enum_type.description is description
@@ -887,7 +887,7 @@ def accepts_an_enum_type_with_ast_node_and_extension_ast_nodes():
887887
extension_ast_nodes = [EnumTypeExtensionNode()]
888888
enum_type = GraphQLEnumType(
889889
"SomeEnum",
890-
{}, # type: ignore
890+
{},
891891
ast_node=ast_node,
892892
extension_ast_nodes=extension_ast_nodes,
893893
)

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ commands =
2323
[testenv:mypy]
2424
basepython = python3.11
2525
deps =
26-
mypy==1.3.0
26+
mypy==1.8.0
2727
pytest>=7.3,<8
2828
commands =
2929
mypy src tests

0 commit comments

Comments
 (0)
0