Skip to content

Commit 27ff114

Browse files
committed
Replace black+isort+autoflake8 with ruff format
1 parent 3acf064 commit 27ff114

File tree

19 files changed

+29
-117
lines changed

19 files changed

+29
-117
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,6 @@ repos:
5959
- id: pyupgrade
6060
args: [--py311-plus, --keep-runtime-typing]
6161

62-
- repo: https://github.com/asottile/add-trailing-comma
63-
rev: v4.0.0
64-
hooks:
65-
- id: add-trailing-comma
66-
67-
- repo: https://github.com/pycqa/autoflake
68-
rev: v2.3.1
69-
hooks:
70-
- id: autoflake
71-
args:
72-
- --in-place
73-
- --remove-all-unused-imports
74-
- --remove-unused-variables
75-
- --ignore-init-module-imports
76-
77-
- repo: https://github.com/psf/black-pre-commit-mirror
78-
rev: 25.12.0
79-
hooks:
80-
- id: black
81-
8262
- repo: https://github.com/pycqa/bandit
8363
rev: 1.9.2
8464
hooks:
@@ -89,11 +69,10 @@ repos:
8969
- -ll
9070
require_serial: true
9171

92-
- repo: https://github.com/pycqa/isort
93-
rev: 7.0.0
72+
- repo: https://github.com/astral-sh/ruff-pre-commit
73+
rev: v0.14.10
9474
hooks:
95-
- id: isort
96-
name: isort (python)
75+
- id: ruff-format
9776

9877
- repo: local
9978
hooks:

pyproject.toml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ test = [
108108
dev = [
109109
"mypy~=1.19.1",
110110
"pre-commit~=4.5.0",
111-
"black~=25.12.0",
112111
"flake8~=7.3.0",
113112
"flake8-pyproject~=1.2.3",
114113
"sqlalchemy[mypy]~=2.0.44",
@@ -133,13 +132,10 @@ docs = [
133132
# sphinx-plantuml~=1.0.0",
134133
]
135134

136-
[tool.black]
135+
[tool.ruff]
136+
target-version = "py311"
137137
line-length = 120
138-
139-
[tool.isort]
140-
profile = "black"
141-
py_version = "311"
142-
known_first_party = ["app"]
138+
extend-exclude = ["docs/", "Makefile"]
143139

144140
[tool.mypy]
145141
python_version = "3.11"

syncmaster/db/migrations/versions/2024-10-07_0010_add_pg_trgm_extension.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Create Date: 2024-10-07 06:59:12.667067
88
99
"""
10+
1011
from alembic import op
1112

1213
# revision identifiers, used by Alembic.

syncmaster/db/migrations/versions/2024-11-01_0011_create_apscheduler_table.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Create Date: 2024-11-01 08:37:47.078657
88
99
"""
10+
1011
import sqlalchemy as sa
1112
from alembic import op
1213

syncmaster/db/models/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Connection(Base, ResourceMixin, TimestampMixin):
7070
)
7171

7272
def __repr__(self):
73-
return f"<Connection " f"name={self.name} " f"description={self.description} " f"group_id={self.group_id}>"
73+
return f"<Connection name={self.name} description={self.description} group_id={self.group_id}>"
7474

7575
@declared_attr
7676
def __table_args__(cls) -> tuple:

syncmaster/exceptions/transfer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,4 @@ def __init__(
3434

3535
@property
3636
def message(self) -> str:
37-
return (
38-
f"{self.conn} connection has type `{self.connection_type}` " f"but its params has `{self.params_type}` type"
39-
)
37+
return f"{self.conn} connection has type `{self.connection_type}` but its params has `{self.params_type}` type"

syncmaster/schemas/v1/auth/mixins.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class SecretDumpMixin(BaseModel):
7-
87
@field_serializer("*", when_used="json")
98
def dump_secrets(self, value):
109
if isinstance(value, SecretStr):

syncmaster/settings/broker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class RabbitMQSettings(BaseModel):
2323

2424
url: str = Field(
2525
description=(
26-
"RabbitMQ connection URL.\n\n" "See the `RabbitMQ documentation <https://www.rabbitmq.com/uri-spec.html>`_ "
26+
"RabbitMQ connection URL.\n\nSee the `RabbitMQ documentation <https://www.rabbitmq.com/uri-spec.html>`_ "
2727
),
2828
)
2929

syncmaster/worker/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88

99
class WorkerTask(Task):
10-
1110
def __init__(self) -> None:
1211
self.settings = Settings()
1312
self.engine = create_engine(

syncmaster/worker/handlers/db/base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ def read(self) -> DataFrame:
3939
reader_params = {}
4040
if self.transfer_dto.strategy.type == "incremental":
4141
self.transfer_dto.strategy.increment_by = self._quote_field(self.transfer_dto.strategy.increment_by)
42-
hwm_name = (
43-
f"{self.transfer_dto.id}_{self.connection_dto.type}_{self.transfer_dto.table_name}" # noqa: WPS237
44-
)
42+
hwm_name = f"{self.transfer_dto.id}_{self.connection_dto.type}_{self.transfer_dto.table_name}" # noqa: WPS237
4543
reader_params["hwm"] = DBReader.AutoDetectHWM(
4644
name=hwm_name,
4745
expression=self.transfer_dto.strategy.increment_by,

0 commit comments

Comments
 (0)