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