Skip to content

Commit d93cd2e

Browse files
authored
chore: replace isort, black, pyupgrade and autoflake with ruff (#375)
1 parent 5dcda13 commit d93cd2e

File tree

6 files changed

+64
-163
lines changed

6 files changed

+64
-163
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,17 @@ repos:
99
- id: mixed-line-ending
1010
args: ["--fix=lf"]
1111

12-
- repo: https://github.com/pycqa/isort
13-
rev: 6.0.1
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
# Ruff version.
14+
rev: v0.12.1
1415
hooks:
15-
- id: isort
16-
args:
17-
[
18-
"--profile",
19-
"black",
20-
"--multi-line=3",
21-
"--trailing-comma",
22-
"--force-grid-wrap=0",
23-
"--use-parentheses",
24-
"--line-width=88",
25-
]
26-
27-
- repo: https://github.com/myint/autoflake.git
28-
rev: v2.3.1
29-
hooks:
30-
- id: autoflake
31-
args:
32-
[
33-
"--in-place",
34-
"--remove-all-unused-imports",
35-
"--ignore-init-module-imports",
36-
]
37-
38-
- repo: https://github.com/psf/black
39-
rev: "25.1.0"
40-
hooks:
41-
- id: black
42-
43-
- repo: https://github.com/asottile/pyupgrade
44-
rev: v3.20.0
45-
hooks:
46-
- id: pyupgrade
47-
args: ["--py37-plus", "--keep-runtime-typing"]
16+
# Run the linter.
17+
- id: ruff
18+
types_or: [ python, pyi ]
19+
args: [ --fix ]
20+
# Run the formatter.
21+
- id: ruff-format
22+
types_or: [ python, pyi ]
4823

4924
- repo: https://github.com/commitizen-tools/commitizen
5025
rev: v4.8.3

poetry.lock

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

pyproject.toml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ python-dateutil = "^2.8.2"
2828
deprecation = "^2.1.0"
2929

3030
[tool.poetry.group.dev.dependencies]
31-
black = "^25.1.0"
32-
isort = "^6.0.1"
3331
pre-commit = "^4.2.0"
3432
pytest = "^8.3.5"
3533
pytest-asyncio = "^0.21.0"
@@ -38,8 +36,30 @@ python-dotenv = "^1.1.0"
3836
Sphinx = "^7.1.2"
3937
sphinx-press-theme = "^0.9.1"
4038
unasync-cli = "^0.0.9"
41-
coveralls = "^1.8.0"
4239
sphinx-toolbox = "^3.4.0"
40+
ruff = "^0.12.1"
41+
42+
[tool.ruff.lint]
43+
select = [
44+
# pycodestyle
45+
"E",
46+
# Pyflakes
47+
"F",
48+
# pyupgrade
49+
"UP",
50+
# flake8-bugbear
51+
# "B",
52+
# flake8-simplify
53+
# "SIM",
54+
# isort
55+
"I",
56+
]
57+
ignore = ["F401", "F403", "F841", "E712", "E501", "E402", "UP006", "UP035"]
58+
# isort.required-imports = ["from __future__ import annotations"]
59+
60+
[tool.ruff.lint.pyupgrade]
61+
# Preserve types, even if a file imports `from __future__ import annotations`.
62+
keep-runtime-typing = true
4363

4464
[tool.pytest.ini_options]
4565
asyncio_mode = "auto"

storage3/_async/file_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ async def create_signed_urls(
228228
data = response.json()
229229
signed_urls = []
230230
for item in data:
231-
232231
# Prepare URL
233232
url = urllib.parse.urlparse(item["signedURL"])
234233
url = urllib.parse.quote(url.path) + f"?{url.query}"

storage3/_sync/file_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ def create_signed_urls(
228228
data = response.json()
229229
signed_urls = []
230230
for item in data:
231-
232231
# Prepare URL
233232
url = urllib.parse.urlparse(item["signedURL"])
234233
url = urllib.parse.quote(url.path) + f"?{url.query}"

storage3/exceptions.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ class StorageApiError(StorageException):
1313
"""Error raised when an operation on the storage API fails."""
1414

1515
def __init__(self, message: str, code: str, status: int) -> None:
16-
error_message = "{{'statusCode': {}, 'error': {}, 'message': {}}}".format(
17-
status,
18-
code,
19-
message,
16+
error_message = (
17+
f"{{'statusCode': {status}, 'error': {code}, 'message': {message}}}"
2018
)
2119
super().__init__(error_message)
2220
self.name = "StorageApiError"

0 commit comments

Comments
 (0)