-
Notifications
You must be signed in to change notification settings - Fork 110
MNT: Factor out helper function used in core and next from ria functionality #6706
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
Conversation
…onality create-sibling-ria had in-line code to check for datasets with matching sibling names that datalad-next refactored into a helper function. This PR adds the helper function created in datalad-next to datalad/distribution/utils and uses it instead of the previous in-line code to make the code more modular. A companion PR in datalad-next may import the helper from datalad core.
Companion PR for datalad/datalad#6706, in response to datalad#17.
Codecov Report
@@ Coverage Diff @@
## master #6706 +/- ##
==========================================
+ Coverage 88.81% 90.42% +1.61%
==========================================
Files 353 353
Lines 45733 45819 +86
==========================================
+ Hits 40617 41432 +815
+ Misses 5116 4387 -729
Continue to review full report at Codecov.
|
Can I ask @mih @christian-monch or @mslw for a review of this? |
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.
Sorry @adswa for missing the notification!
Comparing by eye I can confirm that this is an exact reflection of how it is done in datalad-next
's create_sibling_webdav
(now tried and tested). Compared to the current create_sibling_ria
, it introduces the use of ds.foreach_dataset()
instead of looping over ds.siblings
- as far as I understand it is an improvement.
I left one small comment on a comment block.
It seems to me that the PR achieves its goal, but I wasn't actively involved in the code in next
, so while LGTM, I'd defer approval to those who were @mih @christian-monch
As a side note and more like a question for others (not within the scope of this PR) - the other (much older) function in |
The more experienced Pythonistas can correct me, but as far as I know functions with underscores signal 'I'm an internal function' to users and don't come with as much of a promise of stability. Changes to such a function do not necessitate a new release or deprecation period; anyone outside who uses them knows not to rely on them in the same way as the exposed API. |
Code Climate has analyzed commit 56b8e79 and detected 1 issue on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Thanks for this comment! I understood it in a very similar way (internal) but more as in "not meant to be called from outside its class/module, although ofc there's nothing stopping you". I guess your perspective is perfectly complementary (in why it's not meant to be called from outside). FTR I checked, and PEP 8 calls this convention a weak “internal use” indicator with a comment: e.g. from M import * does not import objects whose names start with an underscore (didn't know that!). But as I said that was a side note or question, not important for the gist of the PR. |
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 much, @adswa!
Re _
:
Yes, @mslw , technically your understanding is the usual python convention. However, we do use it the way @adswa described as well. I think ideally both notions converge by refactoring accordingly. Now that it is in a central place, the function may be become "public", but I'd delay and see how it may be useful for more 'create-sibling-*` commands and how that may still change it's signature/behavior.
In response to #17
In response to #17
Companion PR for datalad/datalad#6706
create-sibling-ria
has in-line code to check for datasets with matching sibling names thatdatalad-next
refactored into a helper function forcreate_sibling_webdav
(datalad/datalad-next#17, #6644).This PR adds the helper function created in
datalad-next
to datalad core. I went withdatalad/distribution/utils.py
as a location, but there might be better places for it - please chime in.The helper is then used in
create-sibling-ria
instead of the previous in-line code to make the code more modular. A companion PR in datalad-next may import the helper from datalad core.Fixes #6644
Changelog
🏠 Internal