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
[WIP] Add stub for Dataset and type Dataset element attributes #1940
Conversation
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1940 +/- ##
==========================================
- Coverage 97.74% 97.74% -0.01%
==========================================
Files 63 63
Lines 10747 10742 -5
==========================================
- Hits 10505 10500 -5
Misses 242 242 ☔ View full report in Codecov by Sentry. |
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.
Very nice!
@@ -241,7 +241,7 @@ def setup_argparse(): | |||
root = tree.getroot() | |||
|
|||
# Check the version is up to date | |||
dcm_version = root.find("{https://docbook.org/ns/docbook}subtitle") |
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.
Ha, I think I reviewed this and missed that this is the fix namespace.
"ReceivingPresentationAddress", | ||
"PrivateInformationCreatorUID", | ||
"PrivateInformation", | ||
# Image Pixel |
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.
Why not generate these automatically? Do you need them before they are generated?
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.
Oh yes, the Type 3 ones can be left for the autogen. The rest are Type 1 so I put them in manually to take advantage of the narrower type.
Actually, hold on. mypy
will check the types in the stubs
directory but doesn't actually seem to be using them.
OK, this won't work as is, probably needs proper discussion |
Describe the changes
stubs
module, stub forDataset
and element typesDataset
attributes likeDataset.PatientName
I tried to narrow the types as much as possible, but I don't think you can escape having to
cast
as long as an element can be empty or be VM 1-n. We might consider droppingNone
for SQ and only allowingMutableSequence[Dataset]
, though.I also hesitated over adding more manually defined types for elements apart from those few Image Pixel module ones because it's basically impossible to verify that they'll never be type 2C/3.
Anyway, I'll leave it up to you @darcymason to decide whether or not adding stubs is a good idea.
Tasks