mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
black
This commit is contained in:
+6
-22
@@ -90,9 +90,7 @@ class BsddClass(CaseInsensitiveModel):
|
||||
ClassProperties: List[BsddClassProperty] = Field(default_factory=list)
|
||||
ClassRelations: List[BsddClassRelation] = Field(default_factory=list)
|
||||
|
||||
_parent_ref: Optional[weakref.ReferenceType["BsddDictionary"]] = PrivateAttr(
|
||||
default=None
|
||||
)
|
||||
_parent_ref: Optional[weakref.ReferenceType["BsddDictionary"]] = PrivateAttr(default=None)
|
||||
|
||||
def _set_parent(self, parent: "BsddDictionary") -> None:
|
||||
self._parent_ref = weakref.ref(parent)
|
||||
@@ -166,9 +164,7 @@ class BsddClassProperty(CaseInsensitiveModel):
|
||||
SortNumber: Optional[int] = None
|
||||
Symbol: Optional[str] = None
|
||||
AllowedValues: List[BsddAllowedValue] = Field(default_factory=list)
|
||||
_parent_ref: Optional[weakref.ReferenceType["BsddClass"]] = PrivateAttr(
|
||||
default=None
|
||||
)
|
||||
_parent_ref: Optional[weakref.ReferenceType["BsddClass"]] = PrivateAttr(default=None)
|
||||
|
||||
def _set_parent(self, parent: "BsddClass") -> None:
|
||||
self._parent_ref = weakref.ref(parent)
|
||||
@@ -182,22 +178,12 @@ class BsddClassProperty(CaseInsensitiveModel):
|
||||
only one of PropertyCode or PropertyUri must be set (XOR)
|
||||
"""
|
||||
# normalize whitespace
|
||||
code = (
|
||||
self.PropertyCode.strip()
|
||||
if self.PropertyCode and isinstance(self.PropertyCode, str)
|
||||
else None
|
||||
)
|
||||
uri = (
|
||||
self.PropertyUri.strip()
|
||||
if self.PropertyUri and isinstance(self.PropertyUri, str)
|
||||
else None
|
||||
)
|
||||
code = self.PropertyCode.strip() if self.PropertyCode and isinstance(self.PropertyCode, str) else None
|
||||
uri = self.PropertyUri.strip() if self.PropertyUri and isinstance(self.PropertyUri, str) else None
|
||||
|
||||
# XOR: exactly one must be provided
|
||||
if bool(code) == bool(uri):
|
||||
raise ValueError(
|
||||
"Exactly one of PropertyCode or PropertyUri must be provided (not both, not neither)"
|
||||
)
|
||||
raise ValueError("Exactly one of PropertyCode or PropertyUri must be provided (not both, not neither)")
|
||||
|
||||
# assign normalized values back
|
||||
object.__setattr__(self, "PropertyCode", code)
|
||||
@@ -253,9 +239,7 @@ class BsddProperty(CaseInsensitiveModel):
|
||||
VisualRepresentationUri: Optional[str] = None
|
||||
PropertyRelations: List[BsddPropertyRelation] = Field(default_factory=list)
|
||||
AllowedValues: List[BsddAllowedValue] = Field(default_factory=list)
|
||||
_parent_ref: Optional[weakref.ReferenceType["BsddDictionary"]] = PrivateAttr(
|
||||
default=None
|
||||
)
|
||||
_parent_ref: Optional[weakref.ReferenceType["BsddDictionary"]] = PrivateAttr(default=None)
|
||||
|
||||
def _set_parent(self, parent: "BsddDictionary") -> None:
|
||||
self._parent_ref = weakref.ref(parent)
|
||||
|
||||
Reference in New Issue
Block a user