Skip to content

Commit

Permalink
fix default text for populate method
Browse files Browse the repository at this point in the history
  • Loading branch information
joergbuchwald committed Jul 24, 2024
1 parent 0b8009b commit e9efeac
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ogs6py/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
"""Provide a central version."""
__version__ = "0.401"
__version__ = "0.402"
2 changes: 1 addition & 1 deletion ogs6py/classes/build_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _convertargs(cls, args):
args[item] = str(value)

@classmethod
def populate_tree(cls, parent, tag, text='', attr=None, overwrite=False):
def populate_tree(cls, parent, tag, text=None, attr=None, overwrite=False):
"""
method to create dictionary from an xml entity
"""
Expand Down
2 changes: 1 addition & 1 deletion ogs6py/classes/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def add_mesh(self, filename, axially_symmetric=None):
elif isinstance(axially_symmetric, str):
attr_dict = {"axially_symmetric": axially_symmetric}
if self.mesh is not None:
if self.mesh.text == "":
if self.mesh.text == "" or self.mesh.text is None:
self.populate_tree(self.root, "mesh", text=filename, attr=attr_dict, overwrite=True)
else:
entry = self.mesh.text
Expand Down
2 changes: 2 additions & 0 deletions ogs6py/ogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def _remove_empty_elements(self):
entry = root.find(element)
if entry is not None:
self.remove_element(".", tag=entry.tag, text="")
if entry is not None:
self.remove_element(".", tag=entry.tag, text=None)
for element in empty_el_list:
entry = root.find(element)
if entry is not None:
Expand Down

0 comments on commit e9efeac

Please sign in to comment.