Skip to content

Enable Ruff's default rules #342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ source = "uv-dynamic-versioning"
line-length = 99

[tool.ruff.lint]
select = ["I", "UP"]
# TODO: Fix the imports in __init__.py files and enable these:
# select = ["E4", "E7", "E9", "I", "UP"]
select = ["E4", "E7", "E9", "I", "UP"]

[tool.docformatter]
in-place = true
Expand Down
16 changes: 8 additions & 8 deletions test/test_decoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ def test_encode_something(simple_attribute):

@dataclass
class SomeClass(Serializable):
d: dict[str, some_type] = dict_field()
l: list[tuple[some_type, some_type]] = list_field()
t: dict[str, Optional[some_type]] = dict_field()
d: dict[str, some_type] = dict_field() # pyright: ignore[reportInvalidTypeForm]
some_list: list[tuple[some_type, some_type]] = list_field() # pyright: ignore[reportInvalidTypeForm]
t: dict[str, Optional[some_type]] = dict_field() # pyright: ignore[reportInvalidTypeForm]
# w: Dict[str, Union[some_type, int, str, None, str, None]] = dict_field()

b = SomeClass()
b.d.update({"hey": expected_value})
b.l.append((expected_value, expected_value))
b.some_list.append((expected_value, expected_value))
b.t.update({"hey": None, "hey2": expected_value})
# b.w.update({
# "hey": None,
Expand Down Expand Up @@ -85,14 +85,14 @@ class Container(Serializable, Generic[ItemT]):

@dataclass
class SomeClass(Serializable):
d: dict[str, some_type] = dict_field()
l: list[tuple[some_type, some_type]] = list_field()
t: dict[str, Optional[some_type]] = dict_field()
d: dict[str, some_type] = dict_field() # pyright: ignore[reportInvalidTypeForm]
some_list: list[tuple[some_type, some_type]] = list_field() # pyright: ignore[reportInvalidTypeForm]
t: dict[str, Optional[some_type]] = dict_field() # pyright: ignore[reportInvalidTypeForm]
# w: Dict[str, Union[some_type, int, str, None, str, None]] = dict_field()

b = SomeClass()
b.d.update({"hey": expected_value})
b.l.append((expected_value, expected_value))
b.some_list.append((expected_value, expected_value))
b.t.update({"hey": None, "hey2": expected_value})
# b.w.update({
# "hey": None,
Expand Down
4 changes: 2 additions & 2 deletions test/test_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Foo(TestSetup):
assert foo.x == "bob"

foo = Foo.setup("--x 2")
assert foo.x == 2 and type(foo.x) is int
assert foo.x == 2 and isinstance(foo.x, int)


def test_union_type_raises_error():
Expand All @@ -31,4 +31,4 @@ class Foo2(TestSetup):
foo = Foo2.setup("--x bob")

foo = Foo2.setup("--x 2")
assert foo.x == 2 and type(foo.x) is int
assert foo.x == 2 and isinstance(foo.x, int)