Closed LucaMarconato closed 4 months ago
Attention: 4 lines
in your changes are missing coverage. Please review.
Comparison is base (
98c5cbc
) 91.68% compared to head (3d50252
) 91.73%.:exclamation: Current head 3d50252 differs from pull request most recent head 615bd79. Consider uploading reports for the commit 615bd79 to get more accurate results
is there something specific that would prevent you from doing something like this
next(key for key, value in dd.items() if value == 'value')
on the various elements?
Not really, except that on first try I did exactly that and got a deep comparison of every nested xarray attribute and array chunk, which was a major performance hit. Now knowing SpatialData's private implementation, I can do:
next(name for name, image in sdata.images.items() if id(image) == id(element))
which I then would refactor out to a utils function, which is so generic (not specific to my module) that one would wonder whether it better lives in SpatialData itself. Especially since other users would implement the same utils function, possibly doing the same mistakes.
But using that code is fine for me!
thanks @aeisenbarth
which I then would refactor out to a utils function, which is so generic (not specific to my module) that one would wonder whether it better lives in SpatialData itself. Especially since other users would implement the same utils function, possibly doing the same mistakes.
this is a good enough use case. I would then add the method to both Elements
but also SpatialData
, wdyt @LucaMarconato ?
Thanks for the comments, sounds good to me.
@aeisenbarth I would return paths; I suggest to get the name of the path for the lookup until we implement lookup by path. To get the type of the element I recommend to use get_model()
.
@giovp ready for re-review (please see also my comment in the remaining unresolved conversation).
I have addressed all the comments (changed the return type to an optional list of strings). So ready to merge now.
Closes #423.