Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic removal of unused f-strings #516

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ extend-exclude = '''
exclude = ["docs/*"]

[tool.ruff.lint]
select = ["F401", "I"] # TODO: eventually, expand to other 'D', and other 'F' linting
select = ["F401", "F541", "I"] # TODO: eventually, expand to other 'D', and other 'F' linting
fixable = ["ALL"]

[tool.ruff.lint.per-file-ignores]
Expand Down
8 changes: 4 additions & 4 deletions tests/streaming_cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_dandiset_streaming_cli(tmpdir: py.path.local):
expected_console_output = io.readlines()

# Different platforms maybe have different indices for start and end of test reports
report_start = test_console_output.index(f"0 CRITICAL\n")
report_start = test_console_output.index("0 CRITICAL\n")
expected_report_length = 38
report_end = report_start + expected_report_length
assert test_console_output[report_start:report_end] == expected_console_output[14:]
Expand All @@ -52,7 +52,7 @@ def test_dandiset_streaming_cli_with_version(tmpdir: py.path.local):
expected_console_output = io.readlines()

# Different platforms maybe have different indices for start and end of test reports
report_start = test_console_output.index(f"0 CRITICAL\n")
report_start = test_console_output.index("0 CRITICAL\n")
expected_report_length = 38
report_end = report_start + expected_report_length
assert test_console_output[report_start:report_end] == expected_console_output[14:]
Expand Down Expand Up @@ -82,7 +82,7 @@ def test_dandiset_streaming_cli_saved_report(tmpdir: py.path.local):
expected_report = io.readlines()

# Different platforms maybe have different indices for start and end of test reports
report_start = test_report.index(f"0 CRITICAL\n")
report_start = test_report.index("0 CRITICAL\n")
expected_report_length = 38
report_end = report_start + expected_report_length
assert test_report[report_start:report_end] == expected_report[14:]
Expand Down Expand Up @@ -115,7 +115,7 @@ def test_dandiset_streaming_cli_with_version_saved_report(tmpdir: py.path.local)
expected_report = io.readlines()

# Different platforms maybe have different indices for start and end of test reports
report_start = test_report.index(f"0 CRITICAL\n")
report_start = test_report.index("0 CRITICAL\n")
expected_report_length = 38
report_end = report_start + expected_report_length
assert test_report[report_start:report_end] == expected_report[14:]
2 changes: 1 addition & 1 deletion tests/test_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def setUpClass(cls):
add_non_matching_timestamps_dimension(nwbfiles[3])

cls.nwbfile_paths = [str(cls.tempdir / f"testing{j}.nwb") for j in range(num_nwbfiles)]
cls.nwbfile_paths[3] = str(cls.tempdir / f"._testing3.nwb")
cls.nwbfile_paths[3] = str(cls.tempdir / "._testing3.nwb")
for nwbfile_path, nwbfile in zip(cls.nwbfile_paths, nwbfiles):
with NWBHDF5IO(path=nwbfile_path, mode="w") as io:
io.write(nwbfile)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/test_behavior.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def test_trigger_check_compass_direction_unit():
)

assert (
check_compass_direction_unit(obj)[0].message == f"SpatialSeries objects inside a CompassDirection object "
f"should be angular and should have a unit of 'degrees' or 'radians', but 'SpatialSeries' has units 'meters'."
check_compass_direction_unit(obj)[0].message == "SpatialSeries objects inside a CompassDirection object "
"should be angular and should have a unit of 'degrees' or 'radians', but 'SpatialSeries' has units 'meters'."
)


Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_image_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@unittest.skipIf(
TESTING_FILES_FOLDER_PATH is None,
reason=(
f"These ImageSeries unit tests were skipped because the environment variable "
"These ImageSeries unit tests were skipped because the environment variable "
"'TESTING_FILES_FOLDER_PATH' was not set!"
),
)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_check_order_of_images_len():
images = Images(name="my_images", images=imgs, order_of_images=img_refs)

assert check_order_of_images_len(images) == InspectorMessage(
message=f"Length of order_of_images (6) does not match the number of images (5).",
message="Length of order_of_images (6) does not match the number of images (5).",
importance=Importance.BEST_PRACTICE_VIOLATION,
check_function_name="check_order_of_images_len",
object_type="Images",
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def test_table_time_columns_are_not_negative_fail():

assert check_table_time_columns_are_not_negative(test_table) == [
InspectorMessage(
message=f"Timestamps in column test_time should not be negative."
message="Timestamps in column test_time should not be negative."
" It is recommended to align the `session_start_time` or `timestamps_reference_time` to be the earliest time value that occurs in the data, and shift all other signals accordingly.",
importance=Importance.BEST_PRACTICE_SUGGESTION,
check_function_name="check_table_time_columns_are_not_negative",
Expand All @@ -451,7 +451,7 @@ def test_table_time_columns_are_not_negative_fail():
location="/",
),
InspectorMessage(
message=f"Timestamps in column start_time should not be negative."
message="Timestamps in column start_time should not be negative."
" It is recommended to align the `session_start_time` or `timestamps_reference_time` to be the earliest time value that occurs in the data, and shift all other signals accordingly.",
importance=Importance.BEST_PRACTICE_SUGGESTION,
check_function_name="check_table_time_columns_are_not_negative",
Expand Down
Loading