Skip to content

Commit

Permalink
Instance checker in void mat (GEOUNED-org#267)
Browse files Browse the repository at this point in the history
* Update data_classes.py

fix bad black format of PR GEOUNED-org#265 and add small modifications

* Update data_classes.py

black is black
  • Loading branch information
psauvan authored Aug 6, 2024
1 parent 658942a commit a538c8d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/geouned/GEOUNED/utils/data_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,17 +769,18 @@ def voidMat(self):
def voidMat(self, voidMat: list):
if not isinstance(voidMat, list):
raise TypeError(f"geouned.Settings.voidMat should be a list, not a {type(voidMat)}")
if len(voidMat) == 0:
self._voidMat = voidMat
else:
if not isinstance(voidMat[0], int):
raise TypeError(f"first entry of geouned.Settings.voidMat should be an int, not a {type(entry)}")
if not isinstance(voidMat[1], int):
if not isinstance(voidMat[1], float):
raise TypeError(f"second entry of geouned.Settings.voidMat should be an int or float, not a {type(entry)}")
if not isinstance(voidMat[2], str):
raise TypeError(f"third entry of geouned.Settings.voidMat should be a str, not a {type(entry)}")
self._voidMat = voidMat
if len(voidMat) == 3:
entry0, entry1, entry2 = voidMat
if not isinstance(entry0, int):
raise TypeError(f"first entry of geouned.Settings.voidMat should be an int, not a {type(entry0)}")
if not isinstance(entry1, int):
if not isinstance(entry1, float):
raise TypeError(f"second entry of geouned.Settings.voidMat should be an int or float, not a {type(entry1)}")
if not isinstance(entry2, str):
raise TypeError(f"third entry of geouned.Settings.voidMat should be a str, not a {type(entry2)}")
elif len(voidMat) > 0:
raise TypeError(f"geouned.Settings.voidMat should be a list with 3 elements or void list")
self._voidMat = voidMat

@property
def voidExclude(self):
Expand Down

0 comments on commit a538c8d

Please sign in to comment.