halfedge 0.11.0__py3-none-any.whl → 0.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
halfedge/type_attrib.py
CHANGED
|
@@ -79,7 +79,7 @@ class StaticAttrib(Generic[_T]):
|
|
|
79
79
|
merged or split.
|
|
80
80
|
"""
|
|
81
81
|
|
|
82
|
-
__slots__ = ("_mesh", "
|
|
82
|
+
__slots__ = ("_mesh", "cached_value")
|
|
83
83
|
|
|
84
84
|
def __new__(
|
|
85
85
|
cls,
|
|
@@ -98,7 +98,7 @@ class StaticAttrib(Generic[_T]):
|
|
|
98
98
|
self, value: _T | None = None, mesh: BlindHalfEdges | None = None
|
|
99
99
|
) -> None:
|
|
100
100
|
"""Set value and mesh."""
|
|
101
|
-
self.
|
|
101
|
+
self.cached_value = value
|
|
102
102
|
self._mesh = mesh
|
|
103
103
|
|
|
104
104
|
def copy_to_element(
|
|
@@ -109,7 +109,7 @@ class StaticAttrib(Generic[_T]):
|
|
|
109
109
|
:param mesh: BlindHalfEdges instance to which attrib will be assigned.
|
|
110
110
|
:return: Attrib instance
|
|
111
111
|
"""
|
|
112
|
-
return type(self)(self.
|
|
112
|
+
return type(self)(self.cached_value, mesh)
|
|
113
113
|
|
|
114
114
|
@property
|
|
115
115
|
def value(self) -> _T:
|
|
@@ -118,12 +118,12 @@ class StaticAttrib(Generic[_T]):
|
|
|
118
118
|
:return: Value of the attribute
|
|
119
119
|
:raises AttributeError: If no value is set and _infer_value fails
|
|
120
120
|
"""
|
|
121
|
-
if self.
|
|
122
|
-
return self.
|
|
121
|
+
if self.cached_value is not None:
|
|
122
|
+
return self.cached_value
|
|
123
123
|
with suppress(NotImplementedError, ValueError):
|
|
124
124
|
value = self._infer_value()
|
|
125
|
-
self.
|
|
126
|
-
return self.
|
|
125
|
+
self.cached_value = value
|
|
126
|
+
return self.cached_value
|
|
127
127
|
msg = "no value set and failed to infer from 'self.mesh'"
|
|
128
128
|
raise AttributeError(msg)
|
|
129
129
|
|
|
@@ -188,7 +188,7 @@ class Attrib(Generic[_T]):
|
|
|
188
188
|
and `_infer_value` to customize behavior while inheriting all other functionality.
|
|
189
189
|
"""
|
|
190
190
|
|
|
191
|
-
__slots__ = ("_element", "
|
|
191
|
+
__slots__ = ("_element", "cached_value")
|
|
192
192
|
|
|
193
193
|
def __new__(
|
|
194
194
|
cls,
|
|
@@ -207,7 +207,7 @@ class Attrib(Generic[_T]):
|
|
|
207
207
|
self, value: _T | None = None, element: MeshElementBase | None = None
|
|
208
208
|
) -> None:
|
|
209
209
|
"""Set value and element."""
|
|
210
|
-
self.
|
|
210
|
+
self.cached_value = value
|
|
211
211
|
self._element = element
|
|
212
212
|
|
|
213
213
|
@property
|
|
@@ -217,12 +217,12 @@ class Attrib(Generic[_T]):
|
|
|
217
217
|
:return: Value of the attribute
|
|
218
218
|
:raises AttributeError: If no value is set and _infer_value fails
|
|
219
219
|
"""
|
|
220
|
-
if self.
|
|
221
|
-
return self.
|
|
220
|
+
if self.cached_value is not None:
|
|
221
|
+
return self.cached_value
|
|
222
222
|
with suppress(NotImplementedError, ValueError):
|
|
223
223
|
value = self._infer_value()
|
|
224
|
-
self.
|
|
225
|
-
return self.
|
|
224
|
+
self.cached_value = value
|
|
225
|
+
return self.cached_value
|
|
226
226
|
msg = "no value set and failed to infer from 'self.element'"
|
|
227
227
|
raise AttributeError(msg)
|
|
228
228
|
|
|
@@ -244,7 +244,7 @@ class Attrib(Generic[_T]):
|
|
|
244
244
|
:param element: New element
|
|
245
245
|
:return: Attrib instance
|
|
246
246
|
"""
|
|
247
|
-
return type(self)(self.
|
|
247
|
+
return type(self)(self.cached_value, element)
|
|
248
248
|
|
|
249
249
|
@classmethod
|
|
250
250
|
def merge(cls, *merge_from: _TAttrib | None) -> _TAttrib | None:
|
|
@@ -4,8 +4,8 @@ halfedge/half_edge_elements.py,sha256=z5rjlZCVJJOpWUf8oVNvZXgr1x4xhz5033lmsm4UBL
|
|
|
4
4
|
halfedge/half_edge_object.py,sha256=A70CVmV44zDi46gbtGHj8dw4Ltshqs56MRn5-78eM20,28771
|
|
5
5
|
halfedge/half_edge_querries.py,sha256=q5xVOFdpw7t6fhs-Z8yF5j3RlG4DOrOgoLbBsAfkm4A,5179
|
|
6
6
|
halfedge/py.typed,sha256=cnjZxaS4F-N8wLWhQK9YvZ-PaN5T1TK94E9VhPT_LGg,155
|
|
7
|
-
halfedge/type_attrib.py,sha256=
|
|
7
|
+
halfedge/type_attrib.py,sha256=Giu4ck7shuq2xZoRrDjOMcOGty5v69Q49lo1kz7BJlU,20452
|
|
8
8
|
halfedge/validations.py,sha256=G3YmJnxX5Q_C3Jhbd7740oTngvsOIllfSwLa81jY3d0,4544
|
|
9
|
-
halfedge-0.
|
|
10
|
-
halfedge-0.
|
|
11
|
-
halfedge-0.
|
|
9
|
+
halfedge-0.12.0.dist-info/WHEEL,sha256=e_m4S054HL0hyR3CpOk-b7Q7fDX6BuFkgL5OjAExXas,80
|
|
10
|
+
halfedge-0.12.0.dist-info/METADATA,sha256=T_3wiZ5N5tYrZy3v36L0sjyEVVDmGv8jWpnA4RdsUT4,6779
|
|
11
|
+
halfedge-0.12.0.dist-info/RECORD,,
|