-
Notifications
You must be signed in to change notification settings - Fork 3
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
add pre-commit with ruff and typos, run --all-files #13
base: main
Are you sure you want to change the base?
Conversation
@@ -689,7 +745,7 @@ def terminology_entry_matches(terminology1, terminology2): | |||
def segment_id_from_name(segmentation, segment_name): | |||
segments = segmentation["segments"] | |||
for segment in segments: | |||
if segment_name == segments["name"]: | |||
if segment_name == segment["name"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was probably wrong...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please also change segments["id"]
below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for your efforts. It all looks good except a few small things that I commented on.
slicerio/segmentation.py
Outdated
multiple_layers = True | ||
elif header_key == "kinds": | ||
if header[header_key] == ["domain", "domain", "domain"]: | ||
multiple_layers = False # noqa: F841 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't use multiple_layers then it is probably better to convert this to a comment than adding noqa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -689,7 +745,7 @@ def terminology_entry_matches(terminology1, terminology2): | |||
def segment_id_from_name(segmentation, segment_name): | |||
segments = segmentation["segments"] | |||
for segment in segments: | |||
if segment_name == segments["name"]: | |||
if segment_name == segment["name"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch
@@ -689,7 +745,7 @@ def terminology_entry_matches(terminology1, terminology2): | |||
def segment_id_from_name(segmentation, segment_name): | |||
segments = segmentation["segments"] | |||
for segment in segments: | |||
if segment_name == segments["name"]: | |||
if segment_name == segment["name"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please also change segments["id"]
below?
slicerio/server.py
Outdated
if not auto_start: | ||
raise | ||
|
||
if retry_after_starting_server: | ||
# Try again, with starting a server first | ||
server_process = start_server(slicer_executable) | ||
server_process = start_server(slicer_executable) # noqa: F841 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the noqa?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
server_process
is not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed server_process
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, you can then it is better to delete server_process =
slicerio/tests/test_segmentation.py
Outdated
}, | ||
] | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many of these extra commas are actually misleading. The commas should be removed from all places where no additional list items are allowed. Extra line breaks make the code harder to read. It would be better to let the programmer decide where to break lines, as it is a result of conscious decisions not some simplistic rules about limiting line length. Same for indentation.
I don't want to ask you to undo all line break and indentation changes, as it could be a lot of work. But let's just undo those changes in this file and make sure the formatter does not try to change this anywhere (so I can later revert annoying changes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can just undo the changes and disable the ruff-format hook, since you obviously don't like the black-style formatting.
@lassoan i think all comments are addressed. Do you want to have a look? Thanks |
add pre-commit
run pre-commit
pre-commit run --all-files
identified possible bug(s):