-
Notifications
You must be signed in to change notification settings - Fork 1
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 docstrings and expand tests for IO sub-module #65
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #65 +/- ##
==========================================
+ Coverage 86.49% 90.48% +3.99%
==========================================
Files 35 35
Lines 1355 1356 +1
==========================================
+ Hits 1172 1227 +55
+ Misses 183 129 -54 ☔ View full report in Codecov by Sentry. |
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.
Great stuff - one pathlib.Path
convention throughout that I've flagged where I saw it.
Only thing that I'd like some clarity on is the values we're passing to the tests. Seems like a lot of repetition in the hard-coded values - not sure if they can be reduced any further though?
@@ -7,7 +7,8 @@ | |||
|
|||
import logging | |||
import os | |||
from typing import List, Optional | |||
import pathlib |
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.
import pathlib | |
from pathlib import Path |
As far as I can tell we only use Path
, and the rest of the BG codebase errs towards from pathlib import Path
.
brainglobe_utils/IO/cells.py
Outdated
def cells_to_csv(cells: List[Cell], csv_file_path: Union[str, pathlib.Path]): | ||
"""Save cells to csv file""" | ||
|
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.
def cells_to_csv(cells: List[Cell], csv_file_path: Union[str, pathlib.Path]): | |
"""Save cells to csv file""" | |
def cells_to_csv(cells: List[Cell], csv_file_path: Union[str, Path]): | |
"""Save cells to csv file""" |
To be consistent with the import change above.
Also there's a trailing newlines between the docstring and first command in the function which isn't present in the others.
|
||
Parameters | ||
---------- | ||
xml_file_path : str or pathlib.Path |
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.
xml_file_path : str or pathlib.Path | |
xml_file_path : str or Path |
---------- | ||
marching_cubes_out : tuple of np.ndarray | ||
Output from skimage.measure.marching_cubes. | ||
output_file : str or pathlib.Path |
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.
Noticed another pathlib.Path here, but in another file. Could you double-check if we're using anything else from pathlib
in this file?
|
||
Parameters | ||
---------- | ||
yaml_file : str or pathlib.Path |
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.
(Will's pathlib.Path
rant continues)
@willGraham01 I've looked through |
Yep happy for this to go in as it is. I'll open a PR of my own to change all the |
Description
What is this PR
Why is this PR needed?
There are very few docstrings for functions in the IO sub-module. Also some parts aren't covered by tests.
What does this PR do?
This PR adds docstrings for all functions in the IO sub-module. It also expands/refactors the tests in
test_cell_io
References
For #19
How has this PR been tested?
All tests pass locally.
Is this a breaking change?
No
Does this PR require an update to the documentation?
No
Checklist: