Skip to content

Commit 5b18ffd

Browse files
authored
Update dev dependencies (#672)
* Update ruff * Update Black
1 parent 025f521 commit 5b18ffd

File tree

12 files changed

+63
-66
lines changed

12 files changed

+63
-66
lines changed

pdm.lock

Lines changed: 44 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ skip-magic-trailing-comma = true
33

44
[dependency-groups]
55
lint = [
6-
"black>=24.2.0",
7-
"ruff>=0.0.277",
6+
"black>=25.1.0",
7+
"ruff>=0.12.2",
88
]
99
test = [
1010
"hypothesis>=6.111.2",
@@ -115,6 +115,9 @@ exclude_also = [
115115
[tool.ruff]
116116
src = ["src", "tests"]
117117

118+
[tool.ruff.per-file-target-version]
119+
"*_695.py" = "py312"
120+
118121
[tool.ruff.lint]
119122
select = [
120123
"E", # pycodestyle

src/cattrs/_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def is_tuple(type):
259259
if sys.version_info >= (3, 10):
260260

261261
def is_union_type(obj):
262-
from types import UnionType
262+
from types import UnionType # noqa: PLC0415
263263

264264
return (
265265
obj is Union

tests/preconf/test_pyyaml.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from attrs import define
66
from hypothesis import given
77
from pytest import raises
8+
from yaml import safe_dump, safe_load
89

910
from cattrs._compat import FrozenSetSubscriptable
1011
from cattrs.errors import ClassValidationError
@@ -15,7 +16,6 @@
1516

1617
@given(everythings())
1718
def test_pyyaml(everything: Everything):
18-
from yaml import safe_dump, safe_load
1919

2020
converter = make_converter()
2121
unstructured = converter.unstructure(everything)

tests/strategies/test_union_passthrough.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
preconf tests.
55
"""
66

7-
from typing import List, Optional, Union
7+
from typing import List, Literal, Optional, Union
88

99
import pytest
1010
from attrs import define
@@ -31,7 +31,6 @@ def test_only_primitives(converter: BaseConverter) -> None:
3131

3232
def test_literals(converter: BaseConverter) -> None:
3333
"""A union with primitives and literals works."""
34-
from typing import Literal
3534

3635
union = Union[int, str, None]
3736
exact_type = Union[int, Literal["test"], None]

tests/test_converter.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from collections import deque
44
from typing import (
5+
Annotated,
56
Any,
67
Deque,
78
FrozenSet,
@@ -659,7 +660,6 @@ class C:
659660

660661
def test_annotated_attrs():
661662
"""Annotation support works for attrs classes."""
662-
from typing import Annotated
663663

664664
converter = Converter()
665665

@@ -693,10 +693,6 @@ class Outer:
693693

694694
def test_annotated_with_typing_extensions_attrs():
695695
"""Annotation support works for attrs classes."""
696-
from typing import List
697-
698-
from typing_extensions import Annotated
699-
700696
converter = Converter()
701697

702698
@define

tests/test_gen_dict.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for generated dict functions."""
22

3-
from typing import Dict, Type
3+
from math import ceil
4+
from typing import Annotated, Dict, Literal, Type, Union
45

56
import pytest
67
from attrs import NOTHING, Factory, define, field, frozen
@@ -316,7 +317,6 @@ class A:
316317

317318
def test_type_names_with_quotes():
318319
"""Types with quote characters in their reprs should work."""
319-
from typing import Annotated, Literal, Union
320320

321321
converter = Converter()
322322

@@ -332,7 +332,6 @@ def test_type_names_with_quotes():
332332

333333
def test_overriding_struct_hook(converter: BaseConverter) -> None:
334334
"""Overriding structure hooks works."""
335-
from math import ceil
336335

337336
@define
338337
class A:

tests/test_generics.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections import deque
22
from collections.abc import Sequence
3-
from typing import Deque, Dict, Generic, List, Optional, TypeVar, Union
3+
from typing import Deque, Dict, Generic, List, Optional, TypedDict, TypeVar, Union
44

55
import pytest
66
from attrs import asdict, define
@@ -169,7 +169,7 @@ class TClass2(Generic[T]):
169169

170170

171171
def test_raises_if_no_generic_params_supplied(
172-
converter: Union[Converter, BaseConverter]
172+
converter: Union[Converter, BaseConverter],
173173
):
174174
data = TClass(1, "a")
175175

@@ -320,7 +320,6 @@ class Outer(Generic[T]):
320320

321321
@pytest.mark.skipif(not is_py311_plus, reason="3.11+ only")
322322
def test_generate_typeddict_mapping() -> None:
323-
from typing import Generic, TypedDict, TypeVar
324323

325324
T = TypeVar("T")
326325
U = TypeVar("U")

tests/test_preconf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# ruff: noqa: PLC0415
12
import sys
23
from collections.abc import Callable, Set
34
from datetime import date, datetime, timezone

tests/test_structure_attrs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from unittest.mock import Mock
77

88
import pytest
9+
import typing_extensions
910
from attrs import NOTHING, Factory, asdict, astuple, define, field, fields, make_class
1011
from hypothesis import assume, given
1112
from hypothesis.strategies import data, lists, sampled_from
@@ -155,7 +156,6 @@ class ClassWithLiteral:
155156
def test_structure_typing_extensions_literal(converter_cls):
156157
"""Structuring a class with a typing_extensions.Literal field works."""
157158
converter = converter_cls()
158-
import typing_extensions
159159

160160
@define
161161
class ClassWithLiteral:

0 commit comments

Comments
 (0)