Repository navigation
Fix omerotools - #157
Fix omerotools#157loicsauteur wants to merge 15 commits into
Conversation
Signed-off-by: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch>
|
Thanks @loicsauteur! ❤️ 🧾 An issue like this definitely reveals the need for being able to to run tests on the code. Since we can't properly emulate the (*that separate function should be string-based only, making it approachable for pytest 🧪) Would you like to work on it, otherwise I'd put it onto our list for the next Coding 🧑💻 Session (you're welcome to join if you wish)? |
| @@ -222,7 +218,7 @@ def delete_keyvalue_annotations(user_client, object_wrapper): | |||
| user_client : fr.igred.omero.Client | |||
| Client used for login to OMERO. | |||
| object_wrapper : fr.igred.omero.repositor.GenericRepositoryObjectWrapper | |||
| Wrapper to the object for the anotation. | |||
| Wrapper to the object for the annotation. | |||
There was a problem hiding this comment.
I prefer having separate commits for unrelated changes like fixing typos in docstrings as otherwise the git history if this very line will read Update parse_url description & remove unnecessary code which can be quite confusing.
| if not os.path.exists(path): | ||
| raise FileNotFoundError(f"File {path} does not exist.") |
There was a problem hiding this comment.
This doesn't seem to be very pythonic to me - what happens if this check is not present but the importImage() call is performed on a non-existing file.
Shouldn't it raise a similar exception already, or is this something weird due to the Java stuff going on in the call?
There was a problem hiding this comment.
If the file does not exist it throws:
File "__pyclasspath__/imcflibs/imagej/omerotools.py", line 178, in upload_image_to_omero
IndexError: index out of range: 0
importImage() should throw an IOException but not fully clear where... the library is very convoluted... see here if you like.
If by pythonic you mean something else, happy to get your inputs.
There was a problem hiding this comment.
Ah okay, this does makes sense.
An IndexError is not what you'd expect when a file is missing. Although in this case that's simply due to the [0] at the end of that all-in-one return line.
I'm fine leaving it like this for now, but please add a comment to the if statement explaining this.
|
I'd welcome the opportunity to join one of your coding sessions and work on this. As I am not really used to working on a collaborative project, I'm happy about the pointers and how-to. E.g.:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #157 +/- ##
=====================================
Coverage 33% 33%
=====================================
Files 25 25
Lines 1806 1805 -1
=====================================
Hits 591 591
+ Misses 1215 1214 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
8c5ac37 to
87f5674
Compare
Removed 'image_ids = ...' is immediately overwriten by the subsequent line. Removed lines ('image-' URL handling) are handled in the 'elif' before.
Clarified that it works for Dataset IDs or Image IDs URLs. Removed that it handles Dataset IDs directly (which it does not to my knowledge.
Import image did not raise file error if it did not exist.
87f5674 to
6e719a0
Compare
This function is part the refactoring of parse_url. It takes an URL and OMERO type to return a list of string IDs. Along with a test.
This function is part the refactoring of parse_url. It takes an URL and return a list of string IDs and the OMERO type (Project, Dataset or ID). Along with a test.
The string handling of parse_url happens now in other functions. The logic stays the same. In addition, it raises an NotImplementedError for Project-URLs.
|
I added the refactoring of the 2 additional functions with their tests (in I also added a very basic test function for Important: I have not tested the modified |
PR for issue #154
parse_urlparse_urlFileNotFoundErrorforupload_image_to_omeroAll changes done with no testing. I was unable to create an env from poetry (sorry).