Skip to content

Commit b52414c

Browse files
[pre-commit.ci] pre-commit autoupdate (strawberry-graphql#2486)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/charliermarsh/ruff-pre-commit: v0.0.225 → v0.0.230](astral-sh/ruff-pre-commit@v0.0.225...v0.0.230) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Patrick Arminio <[email protected]>
1 parent c5a3e16 commit b52414c

File tree

9 files changed

+13
-12
lines changed

9 files changed

+13
-12
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repos:
66
exclude: ^tests/codegen/snapshots/python/
77

88
- repo: https://github.com/charliermarsh/ruff-pre-commit
9-
rev: v0.0.225
9+
rev: v0.0.233
1010
hooks:
1111
- id: ruff
1212
exclude: ^tests/codegen/snapshots/python/

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ ignore = [
271271

272272
"PLR",
273273
"INP",
274+
"TRY",
274275
]
275276
fix = true
276277
exclude = [

setup.py

100644100755
File mode changed.

strawberry/ext/dataclasses/dataclasses.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ def dataclass_init_fn(fields, frozen, has_post_init, self_name, globals_):
5858

5959
_init_params = [_init_param(f) for f in fields if f.init]
6060
if len(_init_params) > 0:
61-
_init_params = ["*"] + _init_params
61+
_init_params = ["*", *_init_params]
6262

6363
return _create_fn(
6464
"__init__",
65-
[self_name] + _init_params,
65+
[self_name, *_init_params],
6666
body_lines,
6767
locals=locals_,
6868
globals=globals_,

strawberry/extensions/query_depth_limiter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def determine_depth(
213213
)
214214
)
215215
else:
216-
raise Exception(f"Depth crawler cannot handle: {node.kind}") # pragma: no cover
216+
raise TypeError(f"Depth crawler cannot handle: {node.kind}") # pragma: no cover
217217

218218

219219
def is_ignored(node: FieldNode, ignore: Optional[List[IgnoreType]] = None) -> bool:
@@ -232,6 +232,6 @@ def is_ignored(node: FieldNode, ignore: Optional[List[IgnoreType]] = None) -> bo
232232
if rule(field_name):
233233
return True
234234
else:
235-
raise ValueError(f"Invalid ignore option: {rule}")
235+
raise TypeError(f"Invalid ignore option: {rule}")
236236

237237
return False

tests/django/test_async_view.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ async def test_async_graphql_post_query_fails_using_params():
9292
factory = RequestFactory()
9393
request = factory.post(
9494
"/graphql",
95-
**{"QUERY_STRING": urlencode(params, doseq=True)},
96-
content_type="application/x-www-form-urlencoded"
95+
content_type="application/x-www-form-urlencoded",
96+
QUERY_STRING=urlencode(params, doseq=True),
9797
)
9898

9999
with pytest.raises(

tests/plugins/strawberry_exceptions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def suppress_output(verbosity_level: int = 0) -> Generator[None, None, None]:
3232

3333
return
3434

35-
with open(os.devnull, "w") as devnull:
35+
with Path(os.devnull).open("w") as devnull:
3636
with contextlib.redirect_stdout(devnull):
3737
yield
3838

@@ -156,7 +156,7 @@ def pytest_sessionfinish(self):
156156

157157
markdown += "\n".join([result.text for result in info])
158158

159-
with open(summary_path, "w") as f:
159+
with Path(summary_path).open("w") as f:
160160
f.write(markdown)
161161

162162

tests/pyright/utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def run_pyright(code: str, strict: bool = True) -> List[Result]:
4141

4242
process_result = subprocess.run(["pyright", f.name], stdout=subprocess.PIPE)
4343

44-
os.remove(f.name)
44+
os.unlink(f.name) # noqa: PTH108
4545

4646
output = process_result.stdout.decode("utf-8")
4747

tests/schema/extensions/test_query_depth_limiter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def callback(query_depths):
7070
errors = validate(
7171
schema._schema,
7272
document,
73-
rules=specified_rules + (validation_rule,),
73+
rules=(*specified_rules, validation_rule),
7474
)
7575

7676
return errors, result
@@ -246,7 +246,7 @@ def test_should_raise_invalid_ignore():
246246
user { address { city } }
247247
}
248248
"""
249-
with pytest.raises(ValueError, match="Invalid ignore option:"):
249+
with pytest.raises(TypeError, match="Invalid ignore option:"):
250250
run_query(
251251
query,
252252
10,

0 commit comments

Comments
 (0)