Skip to content

Fix EnsureListOf() and EnsureTupleOf() for string inputs#7267

Merged
yarikoptic merged 2 commits into
datalad:maintfrom
nobodyinperson:fix-sequence-constraints-for-strings
Jan 30, 2023
Merged

Fix EnsureListOf() and EnsureTupleOf() for string inputs#7267
yarikoptic merged 2 commits into
datalad:maintfrom
nobodyinperson:fix-sequence-constraints-for-strings

Conversation

@nobodyinperson

Copy link
Copy Markdown
Contributor

EnsureListOf() and EnsureTupleOf() 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.)

@codecov

codecov Bot commented Jan 19, 2023

Copy link
Copy Markdown

Codecov Report

Base: 88.72% // Head: 90.55% // Increases project coverage by +1.82% 🎉

Coverage data is based on head (e581732) compared to base (c92ae3a).
Patch coverage: 100.00% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
datalad/support/constraints.py 89.95% <100.00%> (ø)
datalad/tests/test_constraints.py 100.00% <100.00%> (ø)
datalad/support/nda_.py 0.00% <0.00%> (-54.55%) ⬇️
datalad/customremotes/ria_remote.py 55.55% <0.00%> (-11.12%) ⬇️
datalad/cli/interface.py 97.22% <0.00%> (-2.78%) ⬇️
datalad/support/network.py 88.22% <0.00%> (-2.60%) ⬇️
datalad/support/s3.py 40.00% <0.00%> (-2.27%) ⬇️
datalad/utils.py 86.35% <0.00%> (-1.62%) ⬇️
datalad/local/remove.py 95.31% <0.00%> (-1.57%) ⬇️
datalad/support/json_py.py 97.56% <0.00%> (-1.22%) ⬇️
... and 15 more

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@adswa adswa added semver-patch Increment the patch version when merged CHANGELOG-missing When a PR's description does not contain a changelog item, yet. labels Jan 19, 2023
@github-actions github-actions Bot removed the CHANGELOG-missing When a PR's description does not contain a changelog item, yet. label Jan 19, 2023

def __call__(self, value):
return tuple(map(self._dtype, value))
return tuple(map(self._dtype, ([value] if isinstance(value, str) else value)))

Copy link
Copy Markdown
Member

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.

@adswa adswa left a comment

Copy link
Copy Markdown
Member

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

@yarikoptic

Copy link
Copy Markdown
Member

Let's do it then. tuneups to reduce code duplication could be done later.

@yarikoptic-gitmate

Copy link
Copy Markdown
Collaborator

PR released in 0.18.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch Increment the patch version when merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants