Skip to content

Commit c11edb8

Browse files
authored
chore: update dev deps & fix linter (#243)
1 parent 7528006 commit c11edb8

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ dev = [
4343
"pytest-timeout ~= 2.3.0",
4444
"pytest-xdist ~= 3.6.0",
4545
"redbaron ~= 0.9.0",
46-
"ruff ~= 0.4.0",
47-
"setuptools ~= 70.0.0", # setuptools are used by pytest, but not explicitly required
46+
"ruff ~= 0.5.0",
47+
"setuptools ~= 70.3.0", # setuptools are used by pytest, but not explicitly required
4848
"twine ~= 5.1.0",
4949
]
5050

@@ -57,7 +57,7 @@ dev = [
5757
"Apify Homepage" = "https://apify.com"
5858

5959
[build-system]
60-
requires = ["setuptools ~= 70.0.0", "wheel"]
60+
requires = ["setuptools ~= 70.3.0", "wheel"]
6161
build-backend = "setuptools.build_meta"
6262

6363
[tool.setuptools.packages.find]
@@ -69,6 +69,8 @@ apify_client = ["py.typed"]
6969

7070
[tool.ruff]
7171
line-length = 150
72+
73+
[tool.ruff.lint]
7274
select = ["ALL"]
7375
ignore = [
7476
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {filename}

scripts/fix_async_docstrings.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
continue
4343

4444
# Work around a bug in Red Baron, which indents docstrings too much when you insert them, so we have to un-indent it one level first
45-
correct_async_docstring = re.sub('^ ', '', correct_async_docstring, flags=re.M)
45+
correct_async_docstring = re.sub('^ ', '', correct_async_docstring, flags=re.MULTILINE)
4646

4747
if not isinstance(async_docstring, str):
4848
print(f'Fixing missing docstring for "{async_class.name}.{async_method.name}"...')
@@ -54,14 +54,14 @@
5454

5555
# Work around a bug in Red Baron, which adds indents to docstrings when you insert them (including empty lines),
5656
# so we have to remove the extra whitespace
57-
updated_source_code = re.sub('^ $', '', updated_source_code, flags=re.M)
57+
updated_source_code = re.sub('^ $', '', updated_source_code, flags=re.MULTILINE)
5858

5959
# Work around a bug in Red Baron, which indents `except` and `finally` statements wrong
6060
# so we have to add some extra whitespace
61-
updated_source_code = re.sub('^except', ' except', updated_source_code, flags=re.M)
62-
updated_source_code = re.sub('^ except', ' except', updated_source_code, flags=re.M)
63-
updated_source_code = re.sub('^finally', ' finally', updated_source_code, flags=re.M)
64-
updated_source_code = re.sub('^ finally', ' finally', updated_source_code, flags=re.M)
61+
updated_source_code = re.sub('^except', ' except', updated_source_code, flags=re.MULTILINE)
62+
updated_source_code = re.sub('^ except', ' except', updated_source_code, flags=re.MULTILINE)
63+
updated_source_code = re.sub('^finally', ' finally', updated_source_code, flags=re.MULTILINE)
64+
updated_source_code = re.sub('^ finally', ' finally', updated_source_code, flags=re.MULTILINE)
6565

6666
# Work around a bug in Red Baron, which sometimes adds an extra new line to the end of a file
6767
updated_source_code = updated_source_code.rstrip() + '\n'

scripts/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def sync_to_async_docstring(docstring: str) -> str:
4848
substitutions = [(r'Client', r'ClientAsync')]
4949
res = docstring
5050
for pattern, replacement in substitutions:
51-
res = re.sub(pattern, replacement, res, flags=re.M)
51+
res = re.sub(pattern, replacement, res, flags=re.MULTILINE)
5252
return res
5353

5454

src/apify_client/_errors.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,14 @@ def __init__(self: InvalidResponseBodyError, response: httpx.Response) -> None:
7272
self.response = response
7373

7474

75-
def is_retryable_error(e: Exception) -> bool:
75+
def is_retryable_error(exc: Exception) -> bool:
7676
"""Check if the given error is retryable."""
77-
if isinstance(e, (InvalidResponseBodyError, httpx.NetworkError, httpx.TimeoutException, httpx.RemoteProtocolError)):
78-
return True
79-
80-
return False
77+
return isinstance(
78+
exc,
79+
(
80+
InvalidResponseBodyError,
81+
httpx.NetworkError,
82+
httpx.TimeoutException,
83+
httpx.RemoteProtocolError,
84+
),
85+
)

src/apify_client/_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def _get_extra_fields(self: _DebugLogFormatter, record: logging.LogRecord) -> di
109109
extra_fields: dict = {}
110110
for key, value in record.__dict__.items():
111111
if key not in self.empty_record.__dict__:
112-
extra_fields[key] = value
112+
extra_fields[key] = value # noqa: PERF403
113113

114114
return extra_fields
115115

0 commit comments

Comments
 (0)