Skip to content
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

[MRG] Iterate through the value attribute #1482

Merged
merged 1 commit into from Aug 23, 2021

Conversation

SimonBiggs
Copy link
Contributor

Adjusting docs

@codecov
Copy link

codecov bot commented Aug 20, 2021

Codecov Report

Merging #1482 (080bcbc) into master (5f2becb) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1482   +/-   ##
=======================================
  Coverage   97.42%   97.42%           
=======================================
  Files          66       66           
  Lines       10182    10182           
=======================================
  Hits         9920     9920           
  Misses        262      262           
Impacted Files Coverage Δ
pydicom/dataset.py 99.06% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f2becb...080bcbc. Read the comment docs.

@@ -329,7 +329,7 @@ class Dataset:
>>> def recurse(ds):
... for elem in ds:
... if elem.VR == 'SQ':
... [recurse(item) for item in elem]
... [recurse(item) for item in elem.value]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not needed - shall work without the change, as the iterator will access the value automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh cool, okay didn't know that. Cheers :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did suggest we remove that, though. I'm not a fan of DataElement itself being iterable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just now seen that @scaramallion's recommendation has made the v3.0 checklist:

#1232 (comment)

Potentially it's worth making the change to the docs now so that new code that people write based on the docs will be forwards compatible for this recursive iteration pattern?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think so

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this syntax should be encouraged.

@SimonBiggs SimonBiggs closed this Aug 20, 2021
@SimonBiggs SimonBiggs deleted the patch-5 branch August 20, 2021 21:49
@SimonBiggs SimonBiggs restored the patch-5 branch August 22, 2021 23:12
@SimonBiggs SimonBiggs reopened this Aug 22, 2021
@darcymason darcymason merged commit dd1285c into pydicom:master Aug 23, 2021
hackermd pushed a commit to hackermd/pydicom that referenced this pull request Aug 26, 2021
Update doc string to use `elem.value`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants