diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ee7e576..805b934a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/src/attr/_make.py b/src/attr/_make.py index f00fec48..152bb4f9 100644 --- a/src/attr/_make.py +++ b/src/attr/_make.py @@ -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, diff --git a/tests/test_annotations.py b/tests/test_annotations.py index 6fbae3ca..f37a1c0b 100644 --- a/tests/test_annotations.py +++ b/tests/test_annotations.py @@ -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): """ diff --git a/tests/test_validators.py b/tests/test_validators.py index e238a78c..45e7050d 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -1074,8 +1074,7 @@ class TestNot_: v = not_(wrapped) assert ( - f"" + f"" ) == repr(v) def test_success_because_fails(self): diff --git a/tests/typing_example.py b/tests/typing_example.py index b8d414ba..82a5c253 100644 --- a/tests/typing_example.py +++ b/tests/typing_example.py @@ -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():