-
Notifications
You must be signed in to change notification settings - Fork 8
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
XML generation and parsing #43
base: master
Are you sure you want to change the base?
XML generation and parsing #43
Conversation
Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
…he attributes Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
…nt. Useful to create a profile reader Signed-off-by: HUG0-D <[email protected]>
…nal profiles Signed-off-by: HUG0-D <[email protected]>
…e.py functions Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
Added ability to add attributes to profile Model header Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
…nt subfunction and improve readability Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
598b920
to
da4ec07
Compare
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.
I've not yet tried the reader and writer, but I tried the generated classes of the current cimgen master in pycgmes and found some problems - mostly ruff and pyright warnings. pycgmes does a lot of checks.
I solved most of the problems by adding "noqa: E501" etc. to the generated sources (see https://github.com/tom-hg57/pycgmes/tree/try-cimgen-master). But I think there should be better solutions, e.g. using "wrapped_class_comment" in enum_template.mustache.
In test_load_all.py I had to prevent testing Primitive, CIMDatatype, EnumType. It seems these couldn't be instantiated like the other classes. Is this a bug? Or did the t
est the wrong thing trying to instatiate them?
I don't know how to solve the problem with the pyright type test (poetry run scons tests), see https://github.com/tom-hg57/pycgmes/actions/runs/12018172243/job/33502079065. It is caused by "attribute_class": ActivePower etc.
Signed-off-by: HUG0-D <[email protected]>
Fix attribute_namespace to namespace to be coherant with pycgmes Signed-off-by: HUG0-D <[email protected]>
Signed-off-by: HUG0-D <[email protected]>
Quality Gate passedIssues Measures |
You are correct Concerning your test in
To test these classes the best way is to test their attributes directly. I fixed the pyright type test error by setting the |
The overall goal of this PR is to add a profile parser and a profile writer.
To do so, the
Base
class is extended with 3 main functions:.from_xml()
: creates an instance of the class by parsing an xml fragment.updates_from_xml()
: updates an instance of the class by parsing an xml fragment.to_xml()
: allows to export, for a specified profile, the python object as an etree.Element.reader.py
leverages.from_xml()
and.updates_from_xml()
to parse different profile (CGMES or custom) to create a dictionary of objects of the form{"_mRID": corresponding_python_object}
writer.py
exports the python objects to generate the xml ProfilesThis PR builds upon the work of #39