PySimultan 0.3.0__py3-none-any.whl → 0.3.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- {PySimultan-0.3.0.dist-info → PySimultan-0.3.1.dist-info}/LICENSE.txt +17 -17
- {PySimultan-0.3.0.dist-info → PySimultan-0.3.1.dist-info}/METADATA +1 -1
- {PySimultan-0.3.0.dist-info → PySimultan-0.3.1.dist-info}/RECORD +9 -9
- PySimultan2/default_types.py +2 -2
- PySimultan2/object_mapper.py +29 -22
- PySimultan2/simultan_object.py +9 -0
- PySimultan2/utils.py +20 -3
- {PySimultan-0.3.0.dist-info → PySimultan-0.3.1.dist-info}/WHEEL +0 -0
- {PySimultan-0.3.0.dist-info → PySimultan-0.3.1.dist-info}/top_level.txt +0 -0
@@ -1,17 +1,17 @@
|
|
1
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
2
|
-
of this software and associated documentation files (the "Software"), to
|
3
|
-
deal in the Software without restriction, including without limitation the
|
4
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
5
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
6
|
-
furnished to do so, subject to the following conditions:
|
7
|
-
|
8
|
-
The above copyright notice and this permission notice shall be included in
|
9
|
-
all copies or substantial portions of the Software.
|
10
|
-
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
12
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
13
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
14
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
15
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
16
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
17
|
-
IN THE SOFTWARE.
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
2
|
+
of this software and associated documentation files (the "Software"), to
|
3
|
+
deal in the Software without restriction, including without limitation the
|
4
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
5
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
6
|
+
furnished to do so, subject to the following conditions:
|
7
|
+
|
8
|
+
The above copyright notice and this permission notice shall be included in
|
9
|
+
all copies or substantial portions of the Software.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
12
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
13
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
14
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
15
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
16
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
17
|
+
IN THE SOFTWARE.
|
@@ -1,13 +1,13 @@
|
|
1
1
|
PySimultan2/__init__.py,sha256=X10eSCNtac3CG28w7Ogo1csNalhapO9V4oVSIucc0Kw,1121
|
2
2
|
PySimultan2/config.py,sha256=Bazt2vDSEga_cFEIPWcAYBsj3TUN5jgtob8TtUvGm5E,1523
|
3
3
|
PySimultan2/data_model.py,sha256=2Qq_JyUxtDgsIt3p5hIXIqNy7eAtvn-6Of_Wzb9AWoE,28004
|
4
|
-
PySimultan2/default_types.py,sha256=
|
4
|
+
PySimultan2/default_types.py,sha256=E4aS3NuLl0mG5vBJv0saxbBFWk1s4eSg21cl4bcNAH8,22880
|
5
5
|
PySimultan2/files.py,sha256=q6A5KTqU1nCwh0W0Qf3Se7qcvhGiDAWza2v-X-rt6E4,12473
|
6
6
|
PySimultan2/multi_values.py,sha256=ZFXlTLuZo32x7_7diYAp2XEjp5uwgHLgNOzN7v74-5I,13650
|
7
|
-
PySimultan2/object_mapper.py,sha256=
|
8
|
-
PySimultan2/simultan_object.py,sha256=
|
7
|
+
PySimultan2/object_mapper.py,sha256=cvw0gJk3NzsSkN2UNd7nRxhBkTe7TYddmHwxW7VpIHg,8973
|
8
|
+
PySimultan2/simultan_object.py,sha256=PWpveGPFi1nlcHSK8vT_3lyEoa27eBY6ZpKAtgR-KGg,16215
|
9
9
|
PySimultan2/taxonomy_maps.py,sha256=qgKM0CdwwgLCFj-ivzY38VaCpE_eCPKyCiBaTBazpBk,7509
|
10
|
-
PySimultan2/utils.py,sha256=
|
10
|
+
PySimultan2/utils.py,sha256=U3Eru2uQbDCxraFbbbUO1wmVRxLXmo4lFksVcJcrtmg,62818
|
11
11
|
PySimultan2/geometry/__init__.py,sha256=nJolTD1i5J8qUkOQa-r3D20aq3Co3sN31Xc0n4wJpJo,248
|
12
12
|
PySimultan2/geometry/geometry_base.py,sha256=IQQPVxkgIdBsFJp8rPSCNiCiKO7TxkVWy-XmE8GjDbE,23367
|
13
13
|
PySimultan2/geometry/utils.py,sha256=K_3HnqPMAlJkOh01oqjspeqsLrooG9NwIQKWf14IJ48,8513
|
@@ -75,8 +75,8 @@ PySimultan2/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
|
|
75
75
|
PySimultan2/resources/assimp.dll,sha256=HwfDwXqoPDTFRyoQpA3qmgZoUdFtziJkV5fNtktEZEU,6081536
|
76
76
|
PySimultan2/resources/defaultsettings.xml,sha256=s6Tk1tubLz5UYqXZWpD42EDHzedemRY1nEneoIVcUfg,392
|
77
77
|
PySimultan2/resources/setup.bat,sha256=fjvvYfVM6TalS-QTSiKAbAId5nTsk8kGGo06ba-wWaY,32
|
78
|
-
PySimultan-0.3.
|
79
|
-
PySimultan-0.3.
|
80
|
-
PySimultan-0.3.
|
81
|
-
PySimultan-0.3.
|
82
|
-
PySimultan-0.3.
|
78
|
+
PySimultan-0.3.1.dist-info/LICENSE.txt,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
|
79
|
+
PySimultan-0.3.1.dist-info/METADATA,sha256=sikNq1pLMe2i0Gx3X1RFSofB9Rxae3u-PL0AJgefSto,1990
|
80
|
+
PySimultan-0.3.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
81
|
+
PySimultan-0.3.1.dist-info/top_level.txt,sha256=pbE6SbdKIEEK4vaDNmmdRTj0vesrjgRXGow8QWMTXvk,12
|
82
|
+
PySimultan-0.3.1.dist-info/RECORD,,
|
PySimultan2/default_types.py
CHANGED
@@ -97,7 +97,7 @@ class ComponentList(SimultanObject):
|
|
97
97
|
|
98
98
|
@property
|
99
99
|
def ref_components(self):
|
100
|
-
return [x.Target for x in self._wrapped_obj.ReferencedComponents.Items]
|
100
|
+
return [x.Target for x in self._wrapped_obj.ReferencedComponents.Items if x.Target is not None]
|
101
101
|
|
102
102
|
@property
|
103
103
|
def data(self) -> List[SimultanObject]:
|
@@ -109,7 +109,7 @@ class ComponentList(SimultanObject):
|
|
109
109
|
all_components = [*components, *ref_components]
|
110
110
|
|
111
111
|
slots = [*[x.Slot for x in self._wrapped_obj.Components.Items],
|
112
|
-
*[x.Slot for x in self._wrapped_obj.ReferencedComponents.Items]]
|
112
|
+
*[x.Slot for x in self._wrapped_obj.ReferencedComponents.Items if x.Target is not None]]
|
113
113
|
|
114
114
|
try:
|
115
115
|
indices = sort_slots(slots)
|
PySimultan2/object_mapper.py
CHANGED
@@ -12,6 +12,7 @@ from .simultan_object import SimultanObject
|
|
12
12
|
from .geometry.utils import create_python_geometry
|
13
13
|
|
14
14
|
from SIMULTAN.Data.Geometry import (Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop)
|
15
|
+
from SIMULTAN.Data.Components import SimComponent
|
15
16
|
from .geometry.geometry_base import (SimultanLayer, SimultanVertex, SimultanEdge, SimultanEdgeLoop, SimultanFace,
|
16
17
|
SimultanVolume)
|
17
18
|
|
@@ -94,31 +95,37 @@ class PythonMapper(object):
|
|
94
95
|
if data_model is None:
|
95
96
|
data_model = list(data_models)[0]
|
96
97
|
|
98
|
+
if create_all:
|
99
|
+
new_component_list = set()
|
100
|
+
|
101
|
+
def get_subcomponents(sim_component: Union[SimComponent, SimultanObject]):
|
102
|
+
print(sim_component.Id)
|
103
|
+
new_subcomponents = set()
|
104
|
+
if isinstance(sim_component, SimultanObject):
|
105
|
+
sim_component = sim_component._wrapped_obj
|
106
|
+
|
107
|
+
if sim_component in new_component_list:
|
108
|
+
return
|
109
|
+
else:
|
110
|
+
new_component_list.add(sim_component)
|
111
|
+
|
112
|
+
for sub_component in sim_component.Components.Items:
|
113
|
+
new_subcomponents.add(sub_component.Component)
|
114
|
+
for ref_component in sim_component.ReferencedComponents.Items:
|
115
|
+
new_subcomponents.add(ref_component.Target)
|
116
|
+
|
117
|
+
for new_subcomponent in new_subcomponents:
|
118
|
+
get_subcomponents(new_subcomponent)
|
119
|
+
|
120
|
+
new_component_list.update(new_subcomponents)
|
121
|
+
|
122
|
+
for component in component_list:
|
123
|
+
get_subcomponents(component)
|
124
|
+
component_list = list(new_component_list)
|
125
|
+
|
97
126
|
for component in component_list:
|
98
127
|
typed_object = self.create_python_object(component, data_model=data_model)
|
99
128
|
typed_data.append(typed_object)
|
100
|
-
if create_all:
|
101
|
-
|
102
|
-
def get_content(typed_object):
|
103
|
-
if isinstance(typed_object, SimultanObject):
|
104
|
-
for content in typed_object.__class__._taxonomy_map.content:
|
105
|
-
val = getattr(typed_object, content.property_name)
|
106
|
-
if isinstance(val, (SimultanObject, ComponentList, ComponentDictionary)):
|
107
|
-
typed_data.append(val)
|
108
|
-
get_content(val)
|
109
|
-
elif isinstance(typed_object, ComponentList):
|
110
|
-
for item in typed_object:
|
111
|
-
if isinstance(item, (SimultanObject, ComponentList, ComponentDictionary)):
|
112
|
-
typed_data.append(item)
|
113
|
-
get_content(item)
|
114
|
-
elif isinstance(typed_object, ComponentDictionary):
|
115
|
-
for item in typed_object.values():
|
116
|
-
if isinstance(item, (SimultanObject, ComponentList, ComponentDictionary)):
|
117
|
-
typed_data.append(item)
|
118
|
-
get_content(item)
|
119
|
-
|
120
|
-
get_content(typed_object)
|
121
|
-
|
122
129
|
return typed_data
|
123
130
|
|
124
131
|
# @lru_cache(maxsize=None)
|
PySimultan2/simultan_object.py
CHANGED
@@ -136,6 +136,15 @@ class SimultanObject(object, metaclass=MetaMock):
|
|
136
136
|
return instance
|
137
137
|
|
138
138
|
def __init__(self, *args, **kwargs):
|
139
|
+
"""
|
140
|
+
Initialize the SimultanObject. This method is only called if the object is initialized the first time without a
|
141
|
+
wrapped_obj. If a wrapped_obj is defined, the __new__ method is called and the object can be initialized with
|
142
|
+
the __load_init__ method.
|
143
|
+
|
144
|
+
:param args:
|
145
|
+
:param kwargs:
|
146
|
+
"""
|
147
|
+
|
139
148
|
self._wrapped_obj: Union[SimComponent, None] = kwargs.get('wrapped_obj', None)
|
140
149
|
self.__obj_init__ = kwargs.get('__obj_init__', False)
|
141
150
|
self._data_model_id = kwargs.get('data_model_id', None)
|
PySimultan2/utils.py
CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from . import config
|
4
4
|
from enum import Enum
|
5
|
+
from weakref import WeakSet
|
5
6
|
from functools import lru_cache
|
6
7
|
import numpy as np
|
7
8
|
import pandas as pd
|
@@ -45,6 +46,9 @@ class UnresolvedObject(object):
|
|
45
46
|
def resolve(self):
|
46
47
|
return self.cls._cls_instances_dict[self.wrapped_obj.Id]
|
47
48
|
|
49
|
+
def __getattr__(self, item):
|
50
|
+
return getattr(self.wrapped_obj, item)
|
51
|
+
|
48
52
|
|
49
53
|
class CircularReferenceResolver(object):
|
50
54
|
|
@@ -91,11 +95,25 @@ def create_python_object(wrapped_obj: SimComponent, cls: Type[SimultanObject], *
|
|
91
95
|
prop_name=content.text_or_key,
|
92
96
|
object_mapper=kwargs.get('object_mapper', None),
|
93
97
|
)
|
98
|
+
|
94
99
|
kwargs['name'] = wrapped_obj.Name
|
95
100
|
kwargs['__obj_init__'] = True
|
96
|
-
obj = cls(wrapped_obj=wrapped_obj, *args, **kwargs)
|
97
|
-
obj.__obj_init__ = False
|
98
101
|
|
102
|
+
obj = cls.__new__(cls)
|
103
|
+
obj._wrapped_obj = wrapped_obj
|
104
|
+
obj._data_model = kwargs.get('data_model', None)
|
105
|
+
obj._object_mapper = kwargs.get('object_mapper', None)
|
106
|
+
|
107
|
+
if "_cls_instances" not in cls.__dict__:
|
108
|
+
cls._cls_instances = WeakSet()
|
109
|
+
try:
|
110
|
+
cls._cls_instances.add(obj)
|
111
|
+
except Exception as e:
|
112
|
+
logger.error(f'Error adding instance {obj} to _cls_instances: {e}')
|
113
|
+
|
114
|
+
if hasattr(cls, '__load_init__'):
|
115
|
+
obj.__init__(*args, **kwargs)
|
116
|
+
#
|
99
117
|
circ_ref_resolver.unresolved_objects.pop(wrapped_obj.Id)
|
100
118
|
|
101
119
|
return obj
|
@@ -1283,7 +1301,6 @@ def add_properties(prop_name: str,
|
|
1283
1301
|
np.ndarray: set_property_to_value_field,
|
1284
1302
|
pd.DataFrame: set_property_to_value_field}
|
1285
1303
|
|
1286
|
-
# @lru_cache()
|
1287
1304
|
def getx(self):
|
1288
1305
|
return get_property(component=self,
|
1289
1306
|
prop_name=content.text_or_key,
|
File without changes
|
File without changes
|