Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-codspeed
Browse files Browse the repository at this point in the history
  • Loading branch information
Cito authored Oct 21, 2024
2 parents 7003767 + a25b40b commit 497f9b6
Show file tree
Hide file tree
Showing 8 changed files with 273 additions and 221 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.9', 'pypy3.10']

steps:
- uses: actions/checkout@v4
Expand Down
463 changes: 255 additions & 208 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13"
]
packages = [
{ include = "graphql", from = "src" },
Expand Down Expand Up @@ -76,9 +77,9 @@ pytest-codspeed = "^2.2.1"
optional = true

[tool.poetry.group.lint.dependencies]
ruff = ">=0.6.4,<0.7"
ruff = ">=0.7,<0.8"
mypy = [
{ version = "^1.11", python = ">=3.8" },
{ version = "^1.12", python = ">=3.8" },
{ version = "~1.4", python = "<3.8" }
]
bump2version = ">=1.0,<2"
Expand Down
5 changes: 3 additions & 2 deletions src/graphql/language/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,9 @@ def parse_nullability_assertion(self) -> NullabilityAssertionNode | None:
def parse_arguments(self, is_const: bool) -> list[ArgumentNode]:
"""Arguments[Const]: (Argument[?Const]+)"""
item = self.parse_const_argument if is_const else self.parse_argument
item = cast(Callable[[], ArgumentNode], item)
return self.optional_many(TokenKind.PAREN_L, item, TokenKind.PAREN_R)
return self.optional_many(
TokenKind.PAREN_L, cast(Callable[[], ArgumentNode], item), TokenKind.PAREN_R
)

def parse_argument(self, is_const: bool = False) -> ArgumentNode:
"""Argument[Const]: Name : Value[?Const]"""
Expand Down
2 changes: 1 addition & 1 deletion src/graphql/language/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def visit(
else:
stack = Stack(in_array, idx, keys, edits, stack)
in_array = isinstance(node, tuple)
keys = node if in_array else visitor_keys.get(node.kind, ())
keys = node if in_array else visitor_keys.get(node.kind, ()) # type: ignore
idx = -1
edits = []
if parent:
Expand Down
6 changes: 4 additions & 2 deletions src/graphql/pyutils/async_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ def async_reduce(
async def async_callback(
current_accumulator: Awaitable[U], current_value: T
) -> U:
result = callback(await current_accumulator, current_value)
return await cast(Awaitable, result) if is_awaitable(result) else result
result: AwaitableOrValue[U] = callback(
await current_accumulator, current_value
)
return await result if is_awaitable(result) else result # type: ignore

accumulator = async_callback(cast(Awaitable[U], accumulator), value)
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/execution/test_abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async def execute_query(
assert isinstance(schema, GraphQLSchema)
assert isinstance(query, str)
document = parse(query)
result = (execute_sync if sync else execute)(schema, document, root_value) # type: ignore
result = (execute_sync if sync else execute)(schema, document, root_value)
if not sync and is_awaitable(result):
result = await result
assert isinstance(result, ExecutionResult)
Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py3{7,8,9,10,11,12}, pypy3{9,10}, ruff, mypy, docs
envlist = py3{7,8,9,10,11,12,13}, pypy3{9,10}, ruff, mypy, docs
isolated_build = true

[gh-actions]
Expand All @@ -11,21 +11,22 @@ python =
3.10: py310
3.11: py311
3.12: py312
3.13: py313
pypy3: pypy39
pypy3.9: pypy39
pypy3.10: pypy310

[testenv:ruff]
basepython = python3.12
deps = ruff>=0.6.4,<0.7
deps = ruff>=0.7,<0.8
commands =
ruff check src tests
ruff format --check src tests

[testenv:mypy]
basepython = python3.12
deps =
mypy>=1.11,<2
mypy>=1.12,<2
pytest>=8.3,<9
commands =
mypy src tests
Expand All @@ -50,5 +51,5 @@ deps =
commands =
# to also run the time-consuming tests: tox -e py311 -- --run-slow
# to run the benchmarks: tox -e py311 -- -k benchmarks --benchmark-enable
py3{7,8,9,10,11}, pypy3{9,10}: pytest tests {posargs}
py3{7,8,9,10,11,13}, pypy3{9,10}: pytest tests {posargs}
py312: pytest tests {posargs: --cov-report=term-missing --cov=graphql --cov=tests --cov-fail-under=100}

0 comments on commit 497f9b6

Please sign in to comment.