-
Notifications
You must be signed in to change notification settings - Fork 111
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
Fix EnsureListOf() and EnsureTupleOf() for string inputs #7267
Fix EnsureListOf() and EnsureTupleOf() for string inputs #7267
Conversation
Codecov ReportBase: 88.72% // Head: 90.55% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## maint #7267 +/- ##
==========================================
+ Coverage 88.72% 90.55% +1.82%
==========================================
Files 326 326
Lines 44423 44425 +2
Branches 5919 0 -5919
==========================================
+ Hits 39415 40229 +814
+ Misses 4993 4196 -797
+ Partials 15 0 -15
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -157,7 +157,7 @@ def __init__(self, dtype): | |||
super(EnsureTupleOf, self).__init__() | |||
|
|||
def __call__(self, value): | |||
return tuple(map(self._dtype, value)) | |||
return tuple(map(self._dtype, ([value] if isinstance(value, str) else value))) |
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.
Well spotted.
To reduce code duplication: I think in this both cases we could just use ensure_list
or ensure_tuple
in both cases from https://github.com/datalad/datalad/blob/HEAD/datalad/utils.py#L734.
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 PR can be merged from my point of view
Let's do it then. tuneups to reduce code duplication could be done later. |
PR released in |
EnsureListOf()
andEnsureTupleOf()
took string inputs as iterables. This PR fixes this.(I don't understand this
scriv
thing,scriv create
etc. all error out with unfound files, so I'll leave it to you to add this CHANGELOG label.)