-
Notifications
You must be signed in to change notification settings - Fork 21
🔧 Typing of ReqIFSpecHierarchy.children #193
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
@ubmarco thanks for contributing. It looks like your test is failing due to an unrelated change. I will both the unrelated change and some warnings that I am also seeing here. After I ping you, could you fix your change and rebase-squash your commit to just one? |
Please disregard my original comment above and check how I updated it ☝️ |
Rebased and squashed to 1 commit. I was unhappy with the nullable list, so I made the list mandatory. |
Thanks! Making the list mandatory could contradict to the approach that I was following so far where the nullability also mirrors to whether the corresponding XML elements will be generated or not. I believe you may now hit some failing test cases due to this because all spec hierarchies will now be generated with empty children which I think is not what we want for a general case. |
So I feel like your initial change with creating the [] in the add method would work very well. |
Thanks for the insights. Reverted it. Usage as a library with type hinting is still not optimal:
leads to
I would actually make it mandatory as instance attribute, then have an option how to unparse/serialize empty lists (leave out or create an empty list). |
In your example above, you would need to add an The idea behind this parse/unparse was that literally any ReqIF will be parsed/unparsed with the default settings. One big part of it is that some files have empty tags and some not. If you would push this detail down to the unparser level, you would then have to provide a special option when dealing with any arbitrary file which I think is not what we want. I wish I could do better with explaining this in the doc but that's pretty much the idea: the Python object model mirrors the XML tags: If there is no tag, it is a |
Having the above said, your PR as it is now makes a very good sense. I just noticed this unneeded |
This is a circular type reference, i.e. the type is not yet defined when using.
PEP 563 offers the future import to get rid of the quotes for Python <3.14. |
Ah! I see now. Yes, it is ok to use quotes in your PR, and this is how I did it until now in reqif and the parent strictdoc. If we wanted to handle this project-wise, we could discuss it as a separate change. But I really don't mind having quotes since the code is all quote-based since long ago. |
Done |
I could release a new Pip later today (the process is still semi-manual). Were you planning to contribute any further PRs right away? Otherwise, I would just release this specific change. |
Sure, release whenever it suits you. Thanks for the help getting this merged. Typing is quality of life :) |
No description provided.