Update Ruff

This commit is contained in:
Hynek Schlawack 2025-01-24 08:02:11 +01:00
parent 7cbc77f21b
commit c17b1f3ec5
No known key found for this signature in database
5 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ ci:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.3
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
@ -17,7 +17,7 @@ repos:
args: [tests]
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
args: [--exclude-file=tests/test_mypy.yml]

View File

@ -2285,7 +2285,7 @@ def _attrs_to_init_script(
NL = "\n "
return (
f"""def {method_name}(self, {args}):
{NL.join(lines) if lines else 'pass'}
{NL.join(lines) if lines else "pass"}
""",
names_for_globals,
annotations,

View File

@ -11,6 +11,7 @@ import typing
import pytest
import attr
import attrs
from attr._compat import PY_3_14_PLUS
from attr._make import _is_class_var
@ -107,7 +108,7 @@ class TestAnnotations:
class C:
cls_var: typing.ClassVar[int] = 23
a: int
x: typing.List[int] = attr.Factory(list)
x: typing.List[int] = attrs.Factory(list)
y: int = 2
z: int = attr.ib(default=3)
foo: typing.Any = None
@ -407,7 +408,7 @@ class TestAnnotations:
cls_var2: "ClassVar[int]" = 23
cls_var3: "t.ClassVar[int]" = 23
a: "int"
x: "typing.List[int]" = attr.Factory(list)
x: "typing.List[int]" = attrs.Factory(list)
y: "int" = 2
z: "int" = attr.ib(default=3)
foo: "typing.Any" = None
@ -500,7 +501,7 @@ class TestAnnotations:
@attr.s(auto_attribs=True)
class C:
x: typing.Any = NonComparable()
x: typing.Any = NonComparable() # noqa: RUF009
def test_basic_resolve(self):
"""

View File

@ -1074,8 +1074,7 @@ class TestNot_:
v = not_(wrapped)
assert (
f"<not_ validator wrapping {wrapped!r}, "
f"capturing {v.exc_types!r}>"
f"<not_ validator wrapping {wrapped!r}, capturing {v.exc_types!r}>"
) == repr(v)
def test_success_because_fails(self):

View File

@ -269,7 +269,7 @@ class Validated2:
@attrs.define
class Validated3:
num: int = attr.field(validator=attr.validators.ge(0))
num: int = attrs.field(validator=attrs.validators.ge(0))
with attr.validators.disabled():