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

Automatic part creation when creating a Component #237

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

ewuerger
Copy link
Member

This PR implements the cs.Part creation of at least one part when creating a new Component. The name of the Part is now correctly inferred from its type.

@ewuerger ewuerger added the enhancement New feature or request label Jan 30, 2023
@ewuerger ewuerger self-assigned this Jan 30, 2023
@Wuestengecko
Copy link
Member

Can you rebase on top of latest master (c2e00d4)? That should fix the CI.

@ewuerger ewuerger force-pushed the automatic-part-creation branch 3 times, most recently from b01ca57 to 4f86413 Compare January 31, 2023 12:15
f"Cannot instantiate {type(self).__name__} directly"
)
try:
self._xmltag = kw.pop("_xmltag")
Copy link
Member

Choose a reason for hiding this comment

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

This smells. _xmltag is set as class variable (more like "class constant") in subclasses. We should stay consistent in treating it like that.

Besides, we don't even need it outside of __init__ anyway, and even if, it would be saved implicitly as _element.tag.

capellambse/model/common/element.py Outdated Show resolved Hide resolved
capellambse/model/common/accessors.py Outdated Show resolved Hide resolved
capellambse/model/common/accessors.py Outdated Show resolved Hide resolved
capellambse/model/common/accessors.py Outdated Show resolved Hide resolved
tests/test_xlayer_cs.py Outdated Show resolved Hide resolved
tests/test_xlayer_cs.py Outdated Show resolved Hide resolved
tests/test_xlayer_cs.py Outdated Show resolved Hide resolved
capellambse/model/common/element.py Outdated Show resolved Hide resolved
tests/test_xlayer_cs.py Outdated Show resolved Hide resolved
ewuerger and others added 11 commits February 17, 2023 10:57
- Added an optional `class_` parameter to RoleTagAccessor such that
`.parts` wouldn't include `Port`s in its list due to matching role-tag
"ownedFeatures".
- Added a test case for component creation audit events.
- Also fxed `cs.Part`s name: Now these take their name from their
`.type` instead of their own `name` attribute in the XML code.
Setting a name on the `Part` is only allowed during creation. Else this
won't have any effect since its inferred from its `.type`. The user
should be informed about it.
Co-authored-by: Martin Lehmann <martin.lehmann@deutschebahn.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Declarative modelling : Problems when declaring new functions / components
2 participants