Skip to content

Commit 4135976

Browse files
Update pre-commit hooks
- Update pre-commit hooks coming from `pre-commit autoupdate` - Fix new pylint problems
1 parent 93f61fc commit 4135976

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
repos:
33
- repo: https://github.com/psf/black-pre-commit-mirror
4-
rev: 24.3.0
4+
rev: 24.4.2
55
hooks:
66
- id: black
77
language_version: python3
88
- repo: https://github.com/pycqa/pylint
9-
rev: v3.1.0
9+
rev: v3.2.5
1010
hooks:
1111
- id: pylint
1212
language_version: python3
@@ -22,7 +22,7 @@ repos:
2222
- id: yamlfix
2323
exclude: packaging/conda/meta.yaml
2424
- repo: https://github.com/python-jsonschema/check-jsonschema
25-
rev: 0.28.1
25+
rev: 0.29.0
2626
hooks:
2727
- id: check-github-workflows
2828
args: [--verbose]

khiops/core/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def _preprocess_task_arguments(task_args):
293293
):
294294
warnings.warn(
295295
deprecation_message(
296-
f"'discretization_method' on supervised learning",
296+
"'discretization_method' on supervised learning",
297297
"11.0.0",
298298
quote=False,
299299
)

khiops/core/internals/runner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,9 @@ def _get_tool_info_khiops9(runner, tool_name):
17431743

17441744
# If tool executed successfully:
17451745
if return_code == 0:
1746+
# Since pylint 3.2.5 an used before assignment error appears with no reason
1747+
# This code is going to be eliminated in Khiops 11 so no need to fix it
1748+
# pylint: disable=used-before-assignment,possibly-used-before-assignment
17461749
# Parse the contents of the log file
17471750
tmp_log_file_contents = io.BytesIO(fs.read(tmp_log_file_path))
17481751
with io.TextIOWrapper(tmp_log_file_contents, encoding="ascii") as tmp_log_file:

khiops/core/internals/task.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,9 @@ def latest_intro_version(self):
668668
"""`.KhiopsVersion` : Latest introduction version overall tasks"""
669669
latest_intro_version = KhiopsVersion("1.0")
670670
for task_family in self.task_families:
671-
if task_family.latest_intro_version > latest_intro_version:
672-
latest_intro_version = task_family.latest_intro_version
671+
latest_intro_version = max(
672+
task_family.latest_intro_version, latest_intro_version
673+
)
673674
return latest_intro_version
674675

675676
@property

tests/test_dataset_class.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ def create_fixture_dataset_spec(self, output_dir, data_type, multitable, schema)
265265
"tables": {"Reviews": (features, "User_ID")},
266266
}
267267
label = reference_table["class"]
268-
elif data_type == "file":
268+
else:
269+
assert data_type == "file"
269270
reference_table_path = os.path.join(output_dir, "Reviews.csv")
270271
self.create_monotable_data_file(reference_table_path)
271272
dataset_spec = {
@@ -274,7 +275,6 @@ def create_fixture_dataset_spec(self, output_dir, data_type, multitable, schema)
274275
"format": ("\t", True),
275276
}
276277
label = "class"
277-
278278
elif schema == "star":
279279
if data_type == "df":
280280
(
@@ -292,7 +292,8 @@ def create_fixture_dataset_spec(self, output_dir, data_type, multitable, schema)
292292
},
293293
}
294294
label = reference_main_table["class"]
295-
elif data_type == "file":
295+
else:
296+
assert data_type == "file"
296297
reference_main_table_path = os.path.join(output_dir, "id_class.csv")
297298
reference_secondary_table_path = os.path.join(output_dir, "logs.csv")
298299
self.create_multitable_star_data_files(
@@ -307,8 +308,8 @@ def create_fixture_dataset_spec(self, output_dir, data_type, multitable, schema)
307308
"format": ("\t", True),
308309
}
309310
label = "class"
310-
311-
else: # schema == "snowflake":
311+
else:
312+
assert schema == "snowflake"
312313
if data_type == "df":
313314
(
314315
reference_main_table,
@@ -344,7 +345,8 @@ def create_fixture_dataset_spec(self, output_dir, data_type, multitable, schema)
344345
],
345346
}
346347
label = reference_main_table["class"]
347-
elif data_type == "file":
348+
else:
349+
assert data_type == "file"
348350
reference_main_table_path = os.path.join(output_dir, "A.csv")
349351
reference_secondary_table_path_1 = os.path.join(output_dir, "B.csv")
350352
reference_secondary_table_path_2 = os.path.join(output_dir, "C.csv")
@@ -481,7 +483,7 @@ def test_dataset_is_correctly_built(self):
481483
self.assertEqual(dataset.main_table.name, "A")
482484
self.assertEqual(len(dataset.secondary_tables), 4)
483485
dataset_secondary_table_names = set(
484-
[secondary_table.name for secondary_table in dataset.secondary_tables]
486+
secondary_table.name for secondary_table in dataset.secondary_tables
485487
)
486488
self.assertEqual(dataset_secondary_table_names, {"B", "C", "D", "E"})
487489
self.assertEqual(len(dataset.relations), 4)

tests/test_helper.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,9 @@ def function_mock(_mocked, _instance, args, kwargs):
215215
log_file_path = self.fixture["extra_file_paths"]["log_file_path"]
216216
shutil.copyfile(log_file_path, kwargs["log_file_path"])
217217

218-
# No output: return None
219-
if self.return_value_number == 0:
220-
mocked_return_value = None
221218
# Build mocked output
222-
elif self.return_value_number >= 1:
219+
mocked_return_value = None
220+
if self.return_value_number >= 1:
223221
# Build the return values list
224222
mocked_return_values = []
225223
for return_value, is_mocked_file in self.fixture["return_values"]:

0 commit comments

Comments
 (0)