Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions pythonfmu/fmi2slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,11 @@ def to_xml(self, model_options: Dict[str, str] = dict()) -> Element:
generationDateAndTime=date_str,
variableNamingConvention="structured"
)
if self.description is not None:
attrib["description"] = self.description
if self.author is not None:
attrib["author"] = self.author
if self.license is not None:
attrib["license"] = self.license
if self.version is not None:
attrib["version"] = self.version
if self.copyright is not None:
attrib["copyright"] = self.copyright
# use getattr to allow either class or instance attributes to be used
for attr in ["description", "author", "license", "version", "copyright"]:
value = getattr(self.__class__, attr, getattr(self, attr, None))
if value is not None:
attrib[attr] = value

root = Element("fmiModelDescription", attrib)

Expand Down