Skip to content

Commit 1955f8e

Browse files
[pre-commit.ci] pre-commit autoupdate (#1890)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.15.22 → v0.16.0](astral-sh/ruff-pre-commit@v0.15.22...v0.16.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: restore CI after Ruff 0.16 upgrade * fix: clean up safe Ruff 0.16 findings * fix: pass plain string to UdfSignatureError --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 8d06f54 commit 1955f8e

9 files changed

Lines changed: 31 additions & 20 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- id: trailing-whitespace
2525
exclude: '^LICENSES/'
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: 'v0.15.22'
27+
rev: 'v0.16.0'
2828
hooks:
2929
- id: ruff
3030
args: [--fix, --exit-non-zero-on-fix]

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ explicit-preview-rules = true
243243
ignore = [
244244
"S101", # assert
245245
"PLR2004", # magic-value-comparison
246+
"PLR0917", # too-many-positional-arguments
246247
"PLW2901", # redefined-loop-name
247248
"ISC001", # single-line-implicit-string-concatenation, incompatible with ruff format
248249
"RET502", # implicit-return-value

src/datachain/lib/listing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def get_listing(
296296
# - if an exact listing exists it will have the same name as `ds_name`
297297
# anyway below
298298
if listings and not update:
299-
listing = sorted(listings, key=lambda ls: ls.created_at)[-1]
299+
listing = max(listings, key=lambda ls: ls.created_at)
300300

301301
# for local file system we need to fix listing path / prefix
302302
# if we are reusing existing listing

src/datachain/lib/signal_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def _resolve_type( # noqa: PLR0911
473473
return None
474474

475475
bracket_idx = type_name.find("[")
476-
subtypes: tuple[object | None | types.EllipsisType, ...] | None = None
476+
subtypes: tuple[object | types.EllipsisType | None, ...] | None = None
477477
if bracket_idx > -1:
478478
if bracket_idx == 0:
479479
raise ValueError("Type cannot start with '['")
@@ -1374,7 +1374,7 @@ def __contains__(self, name: str):
13741374

13751375
@staticmethod
13761376
def _type_to_str(
1377-
type_: type | None | types.EllipsisType, subtypes: list | None = None
1377+
type_: type | types.EllipsisType | None, subtypes: list | None = None
13781378
) -> str:
13791379
"""Convert a type to a string-based representation."""
13801380

src/datachain/lib/udf_signature.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,8 @@ def parse(
3737
if len(signal_map) > 1:
3838
raise UdfSignatureError(
3939
chain,
40-
(
41-
f"multiple signals '{keys}' are not supported in processors."
42-
" Chain multiple processors instead.",
43-
),
40+
f"multiple signals '{keys}' are not supported in processors."
41+
" Chain multiple processors instead.",
4442
)
4543
udf_func: UDFBase | Callable
4644
if len(signal_map) == 1:

src/datachain/lib/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def _to_posix(path: str) -> str:
171171

172172

173173
def type_to_str( # noqa: C901, PLR0911, PLR0912
174-
type_: type | None | types.EllipsisType,
174+
type_: type | types.EllipsisType | None,
175175
subtypes: list | None = None,
176176
*,
177177
warn_with: Callable[[str], None] | None = None,

src/datachain/query/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ def calculate_unprocessed_rows(
16311631
self,
16321632
input_query: Select,
16331633
partial_table: "Table",
1634-
incomplete_input_ids: None | list[int] = None,
1634+
incomplete_input_ids: list[int] | None = None,
16351635
) -> Select:
16361636
"""
16371637
Calculate which input rows haven't been processed yet.

tests/func/test_datachain.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,11 @@ def test_show_transpose(capsys, test_session):
475475
def test_show_truncate(capsys, test_session):
476476
client = ["Alice A", "Bob B", "Charles C"]
477477
details = [
478-
"This is a very long piece of text that would not fit in the default output "
479-
"because pandas will truncate the column",
478+
(
479+
"This is a very long piece of text that would not fit in the default "
480+
"output "
481+
"because pandas will truncate the column"
482+
),
480483
"Gives good tips",
481484
"Not very nice",
482485
]
@@ -499,8 +502,11 @@ def test_show_truncate(capsys, test_session):
499502
def test_show_no_truncate(capsys, test_session):
500503
client = ["Alice A", "Bob B", "Charles C"]
501504
details = [
502-
"This is a very long piece of text that would not fit in the default output "
503-
"because pandas will truncate the column",
505+
(
506+
"This is a very long piece of text that would not fit in the default "
507+
"output "
508+
"because pandas will truncate the column"
509+
),
504510
"Gives good tips",
505511
"Not very nice",
506512
]

tests/func/test_read_dataset_remote.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ def remote_dataset_version_v1(
5454
"schema": remote_dataset_schema,
5555
"sources": "",
5656
"query_script": (
57-
"from datachain.query.dataset import DatasetQuery\n"
58-
'DatasetQuery(path="s3://test-bucket")',
57+
(
58+
"from datachain.query.dataset import DatasetQuery\n"
59+
'DatasetQuery(path="s3://test-bucket")'
60+
),
5961
),
6062
"created_by_id": 1,
6163
"_preview_loaded": True,
@@ -84,8 +86,10 @@ def remote_dataset_version_v2(
8486
"schema": remote_dataset_schema,
8587
"sources": "",
8688
"query_script": (
87-
"from datachain.query.dataset import DatasetQuery\n"
88-
'DatasetQuery(path="s3://test-bucket")',
89+
(
90+
"from datachain.query.dataset import DatasetQuery\n"
91+
'DatasetQuery(path="s3://test-bucket")'
92+
),
8993
),
9094
"created_by_id": 1,
9195
"_preview_loaded": True,
@@ -192,8 +196,10 @@ def _mock_export_response(request, context):
192196
return {
193197
"export_id": 1,
194198
"signed_urls": [
195-
f"https://studio-blobvault.s3.amazonaws.com/"
196-
f"datachain_ds_export_{version_file}.parquet.lz4"
199+
(
200+
"https://studio-blobvault.s3.amazonaws.com/"
201+
f"datachain_ds_export_{version_file}.parquet.lz4"
202+
)
197203
],
198204
}
199205

0 commit comments

Comments
 (0)