Skip to content

Commit 2d6b1fb

Browse files
committed
fix: ruff errors
1 parent c89a8bc commit 2d6b1fb

File tree

22 files changed

+58
-58
lines changed

22 files changed

+58
-58
lines changed

ruff.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ fixable = [
3232
"RUF020", # never-union
3333
"NPY201", # numpy2-deprecation
3434
"PT",
35+
"RUF022", # unsorted-dunder-all
36+
"RUF023", # unsorted-dunder-slots
3537
]
3638
ignore = [
3739
"TD",
3840
'E712', # TrueFalseComparison # sqlalchemy
3941
"E711", # none-comparison # sqlalchemy
4042
"EM101", # raw-string-in-exception
4143
"TRY003", # raise-vanilla-args
42-
"ANN101", # missing-type-self
43-
"ANN102", # missing-type-cls
4444
"ANN401", # dynamically-typed-expression
4545
"FBT002", # boolean-default-value-in-function-definition
4646
"PGH003", # blanket-type-ignore

src/tests/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ async def wrapper(*args: Any, **kwargs: Any) -> Any:
4646

4747
value_params = pytest.mark.parametrize(
4848
"value",
49-
(
49+
[
5050
pytest.param(None, id="none"),
5151
pytest.param((None,) * 2**20, id="tuple"),
5252
pytest.param(1234, id="int"),
@@ -56,5 +56,5 @@ async def wrapper(*args: Any, **kwargs: Any) -> Any:
5656
pytest.param("hello" * 2**20, id="long_str"),
5757
pytest.param(b"world", id="bytes"),
5858
pytest.param(b"world" * 2**20, id="long_bytes"),
59-
),
59+
],
6060
)

src/typed_diskcache/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
)
1515

1616
__all__ = [
17-
"Disk",
17+
"AsyncLock",
18+
"AsyncRLock",
19+
"AsyncSemaphore",
1820
"Cache",
21+
"Container",
22+
"Disk",
1923
"FanoutCache",
2024
"SyncLock",
2125
"SyncRLock",
22-
"AsyncLock",
23-
"AsyncRLock",
2426
"SyncSemaphore",
25-
"AsyncSemaphore",
26-
"Container",
2727
]
2828

2929
__version__: str

src/typed_diskcache/core/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from sqlalchemy.ext.asyncio import AsyncSession
1818
from sqlalchemy.orm import Session
1919

20-
__all__ = ["log_context", "context", "enter_session"]
20+
__all__ = ["context", "enter_session", "log_context"]
2121

2222
_F = TypeVar("_F", bound="Callable[..., Any]", infer_variance=True)
2323
_T = TypeVar("_T", bound="Session | AsyncSession", infer_variance=True)

src/typed_diskcache/core/types.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import annotations
1+
from __future__ import annotations # noqa: A005
22

33
import sys
44
from datetime import datetime, timedelta, timezone
@@ -20,22 +20,22 @@ def __str__(self) -> str:
2020

2121

2222
__all__ = [
23+
"CacheMode",
2324
"Constant",
24-
"SettingsKey",
25+
"Container",
2526
"EvictionPolicy",
26-
"CacheMode",
27-
"MetadataKey",
28-
"Stats",
27+
"EvictionPolicyLiteral",
2928
"FilterMethod",
29+
"FilterMethodLiteral",
30+
"MetadataKey",
3031
"QueueSide",
32+
"QueueSideLiteral",
3133
"SQLiteAutoVacuum",
3234
"SQLiteJournalMode",
3335
"SQLiteSynchronous",
36+
"SettingsKey",
3437
"SettingsKwargs",
35-
"Container",
36-
"EvictionPolicyLiteral",
37-
"FilterMethodLiteral",
38-
"QueueSideLiteral",
38+
"Stats",
3939
]
4040

4141
_T = TypeVar("_T", infer_variance=True)

src/typed_diskcache/database/connect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@
3838

3939
__all__ = [
4040
"create_sqlite_url",
41-
"ensure_sqlite_sync_engine",
4241
"ensure_sqlite_async_engine",
43-
"transact",
42+
"ensure_sqlite_sync_engine",
4443
"set_listeners",
44+
"transact",
4545
]
4646

4747
AsyncConnT = TypeVar(

src/typed_diskcache/database/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from typed_diskcache import exception as te
2424
from typed_diskcache.core.types import CacheMode, MetadataKey, SettingsKey
2525
from typed_diskcache.log import get_logger
26-
from typed_diskcache.utils.re import camel_to_snake
26+
from typed_diskcache.utils.rename import camel_to_snake
2727

2828
if TYPE_CHECKING:
2929
from os import PathLike
@@ -33,7 +33,7 @@
3333
from sqlalchemy.orm import InstrumentedAttribute
3434

3535

36-
__all__ = ["Version", "Metadata", "Settings", "Cache"]
36+
__all__ = ["Cache", "Metadata", "Settings", "Version"]
3737

3838
_T = TypeVar("_T", infer_variance=True, default=Any)
3939
_T2 = TypeVar("_T2", infer_variance=True)

src/typed_diskcache/database/revision/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from sqlalchemy.engine.base import Transaction
2222

2323

24-
__all__ = ["auto", "upgrade", "downgrade"]
24+
__all__ = ["auto", "downgrade", "upgrade"]
2525

2626
_REVISION = re.compile(r"(\d{3})_(.*)")
2727
logger = get_logger()

src/typed_diskcache/exception.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
from __future__ import annotations
22

33
__all__ = [
4+
"TypedDiskcacheEmptyDirWarning",
45
"TypedDiskcacheError",
5-
"TypedDiskcacheKeyError",
6-
"TypedDiskcacheValueError",
7-
"TypedDiskcacheTypeError",
6+
"TypedDiskcacheFileNotFoundError",
87
"TypedDiskcacheIndexError",
8+
"TypedDiskcacheKeyError",
99
"TypedDiskcacheNotImplementedError",
1010
"TypedDiskcacheOSError",
11-
"TypedDiskcacheFileNotFoundError",
12-
"TypedDiskcacheTimeoutError",
1311
"TypedDiskcacheRuntimeError",
14-
"TypedDiskcacheWarning",
12+
"TypedDiskcacheTimeoutError",
13+
"TypedDiskcacheTypeError",
1514
"TypedDiskcacheUnknownFileWarning",
16-
"TypedDiskcacheEmptyDirWarning",
15+
"TypedDiskcacheValueError",
16+
"TypedDiskcacheWarning",
1717
]
1818

1919

src/typed_diskcache/implement/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
)
1313

1414
__all__ = [
15+
"AsyncLock",
16+
"AsyncRLock",
17+
"AsyncSemaphore",
1518
"Cache",
16-
"FanoutCache",
1719
"Disk",
20+
"FanoutCache",
1821
"SyncLock",
1922
"SyncRLock",
20-
"AsyncLock",
21-
"AsyncRLock",
2223
"SyncSemaphore",
23-
"AsyncSemaphore",
2424
]

0 commit comments

Comments
 (0)