Skip to content

Commit 9931cf6

Browse files
[pre-commit.ci] pre-commit autoupdate (#3752)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Thiago Bellini Ribeiro <[email protected]>
1 parent eb12310 commit 9931cf6

14 files changed

+28
-32
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.8.6
3+
rev: v0.9.1
44
hooks:
55
- id: ruff-format
66
exclude: ^tests/\w+/snapshots/

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ ignore = [
257257
"A001",
258258
"A002",
259259
"A003",
260+
"A005",
260261

261262
# Unused arguments
262263
"ARG001",

strawberry/codegen/plugins/python.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def generate_code(
6565

6666
def _print_imports(self) -> str:
6767
imports = [
68-
f'from {import_} import {", ".join(sorted(types))}'
68+
f"from {import_} import {', '.join(sorted(types))}"
6969
for import_, types in self.imports.items()
7070
]
7171

@@ -187,9 +187,9 @@ def _print_scalar_type(self, type_: GraphQLScalar) -> str:
187187
if type_.name in self.SCALARS_TO_PYTHON_TYPES:
188188
return ""
189189

190-
assert (
191-
type_.python_type is not None
192-
), f"Scalar type must have a python type: {type_.name}"
190+
assert type_.python_type is not None, (
191+
f"Scalar type must have a python type: {type_.name}"
192+
)
193193

194194
return f'{type_.name} = NewType("{type_.name}", {type_.python_type.__name__})'
195195

strawberry/codegen/query_codegen.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ def _populate_fragment_types(self, ast: DocumentNode) -> None:
347347
)
348348
for fd in fragment_definitions:
349349
query_type = self.schema.get_type_by_name(fd.type_condition.name.value)
350-
assert isinstance(
351-
query_type, StrawberryObjectDefinition
352-
), f"{fd.type_condition.name.value!r} is not a type in the graphql schema!"
350+
assert isinstance(query_type, StrawberryObjectDefinition), (
351+
f"{fd.type_condition.name.value!r} is not a type in the graphql schema!"
352+
)
353353

354354
typename = fd.type_condition.name.value
355355
graph_ql_object_type_factory = partial(
@@ -695,9 +695,9 @@ def _field_from_selection_set(
695695
selection.name.value, parent_type_name
696696
)
697697

698-
assert (
699-
selected_field
700-
), f"Couldn't find {parent_type_name}.{selection.name.value}"
698+
assert selected_field, (
699+
f"Couldn't find {parent_type_name}.{selection.name.value}"
700+
)
701701

702702
selected_field_type, wrapper = self._unwrap_type(selected_field.type)
703703
name = capitalize_first(to_camel_case(selection.name.value))

strawberry/exceptions/missing_return_annotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __init__(
2727
"did you forget to add it?"
2828
)
2929
self.rich_message = (
30-
"[bold red]Missing annotation for field " f"`[underline]{resolver.name}[/]`"
30+
f"[bold red]Missing annotation for field `[underline]{resolver.name}[/]`"
3131
)
3232

3333
self.suggestion = (

strawberry/exceptions/permission_fail_silently_requires_optional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class PermissionFailSilentlyRequiresOptionalError(StrawberryException):
1616
def __init__(self, field: StrawberryField) -> None:
1717
self.field = field
1818
self.message = (
19-
"Cannot use fail_silently=True with a non-optional " "or non-list field"
19+
"Cannot use fail_silently=True with a non-optional or non-list field"
2020
)
2121
self.rich_message = (
2222
"fail_silently permissions can only be used with fields of type "

strawberry/printer/ast_from_value.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def ast_from_leaf_type(
5656
return IntValueNode(value=str(serialized))
5757
if isinstance(serialized, float) and isfinite(serialized):
5858
value = str(serialized)
59-
if value.endswith(".0"):
60-
value = value[:-2]
59+
value = value.removesuffix(".0")
6160
return FloatValueNode(value=value)
6261

6362
if isinstance(serialized, str):

strawberry/schema/schema_converter.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,10 @@ def from_interface(
518518
assert isinstance(graphql_interface, GraphQLInterfaceType) # For mypy
519519
return graphql_interface
520520

521-
def _get_resolve_type() -> (
522-
Callable[
523-
[Any, GraphQLResolveInfo, GraphQLAbstractType],
524-
Union[Awaitable[Optional[str]], str, None],
525-
]
526-
):
521+
def _get_resolve_type() -> Callable[
522+
[Any, GraphQLResolveInfo, GraphQLAbstractType],
523+
Union[Awaitable[Optional[str]], str, None],
524+
]:
527525
if interface.resolve_type:
528526
return interface.resolve_type
529527

strawberry/schema/types/scalar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _get_scalar_definition(scalar: type) -> ScalarDefinition:
6868
GlobalID,
6969
name="GlobalID",
7070
description=GraphQLID.description,
71-
parse_literal=lambda v, vars=None: GlobalID.from_id(
71+
parse_literal=lambda v, vars=None: GlobalID.from_id( # noqa: A006
7272
GraphQLID.parse_literal(v, vars)
7373
),
7474
parse_value=GlobalID.from_id,

tests/litestar/test_response_headers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,5 @@ def abc(self, info: strawberry.Info) -> str:
5959
assert response.json() == {"data": {"abc": "abc"}}
6060

6161
assert response.headers["set-cookie"] == (
62-
"strawberry=rocks; Path=/; SameSite=lax, "
63-
"Litestar=rocks; Path=/; SameSite=lax"
62+
"strawberry=rocks; Path=/; SameSite=lax, Litestar=rocks; Path=/; SameSite=lax"
6463
)

0 commit comments

Comments
 (0)