PySimultan 0.4.6__py3-none-any.whl → 0.4.7__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
PySimultan2/__about__.py CHANGED
@@ -1 +1 @@
1
- version = '0.4.6'
1
+ version = '0.4.7'
PySimultan2/__init__.py CHANGED
@@ -109,3 +109,4 @@ config = Config()
109
109
  from .data_model import DataModel
110
110
  from .files import FileInfo
111
111
  from .object_mapper import PythonMapper
112
+ from .taxonomy_maps import Content, TaxonomyMap
PySimultan2/data_model.py CHANGED
@@ -263,7 +263,9 @@ class DataModel:
263
263
  def project(self, value):
264
264
  self._project = value
265
265
 
266
- def get_typed_data(self, mapper: 'PythonMapper', create_all=False) -> list[SimultanObject]:
266
+ def get_typed_data(self,
267
+ mapper: 'PythonMapper',
268
+ create_all=False) -> list[SimultanObject]:
267
269
  """
268
270
  Return the typed data from the project
269
271
  :param mapper:
@@ -14,6 +14,8 @@ from SIMULTAN.Data.Components import SimComponent
14
14
  from .geometry.geometry_base import (SimultanLayer, SimultanVertex, SimultanEdge, SimultanEdgeLoop, SimultanFace,
15
15
  SimultanVolume)
16
16
 
17
+ from .taxonomy_maps import TaxonomyMap, Content
18
+
17
19
  logger = getLogger('PySimultan')
18
20
 
19
21
  default_registered_classes = {'ComponentList': ComponentList,
@@ -33,8 +35,10 @@ class PythonMapper(object):
33
35
  def __init__(self, *args, **kwargs):
34
36
 
35
37
  self.name = kwargs.get('name', 'PythonMapper')
36
- self.registered_classes = copy(
37
- default_registered_classes) # dict with all registered classes: {taxonomy: class}
38
+ self.registered_classes: dict[str: SimultanObject] = copy(default_registered_classes) # dict with all registered classes: {taxonomy: class}
39
+
40
+ self.undefined_registered_classes: dict[str: SimultanObject] = {} # dict with all registered classes: {taxonomy: class}
41
+
38
42
  self.mapped_classes = copy(default_mapped_classes) # dict with all mapped classes: {taxonomy: class}
39
43
  self.taxonomy_maps = copy(default_taxonomy_maps) # dict with all taxonomie maps: {taxonomy: taxonomie_map}
40
44
 
@@ -46,11 +50,18 @@ class PythonMapper(object):
46
50
  EdgeLoop: SimultanEdgeLoop}
47
51
 
48
52
  self.re_register = False
53
+ self.load_undefined = True
49
54
 
50
55
  def register(self, taxonomy, cls, taxonomy_map=None):
51
56
  if not self.re_register and taxonomy in self.registered_classes.keys():
52
57
  return
53
58
 
59
+ if taxonomy_map is None:
60
+ taxonomy_map = TaxonomyMap(taxonomy_name='PySimultan',
61
+ taxonomy_key='PySimultan',
62
+ taxonomy_entry_name=taxonomy,
63
+ taxonomy_entry_key=taxonomy)
64
+
54
65
  self.registered_classes[taxonomy] = cls
55
66
  self.taxonomy_maps[taxonomy] = taxonomy_map
56
67
 
@@ -166,16 +177,20 @@ class PythonMapper(object):
166
177
  logger.warning(f'No data model provided. Using default data model: {config.get_default_data_model().id}.')
167
178
  data_model = config.get_default_data_model()
168
179
 
169
- if isinstance(component, (Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop)):
180
+ if isinstance(component,
181
+ (Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop)
182
+ ):
170
183
  self.create_python_geometry_object(component, data_model, *args, **kwargs)
171
184
 
172
185
  if cls is None:
173
186
  c_slots = [x.Target.Key for x in component.Slots.Items]
174
187
  c_slot = list(set(c_slots) & set(self.registered_classes.keys()))
175
188
  if len(c_slot) == 0:
176
- if c_slots[0] not in self.registered_classes.keys():
189
+ if c_slots[0] not in self.registered_classes.keys() and self.load_undefined:
177
190
  self.register(c_slots[0], SimultanObject)
178
191
  c_slot = [c_slots[0]]
192
+ self.undefined_registered_classes[c_slot[0]] = SimultanObject
193
+ self.create_mapped_class(c_slot[0], self.registered_classes[c_slot[0]])
179
194
  elif len(c_slot) > 1:
180
195
  num_superclasses = [len(self.registered_classes[x].__mro__) for x in c_slot]
181
196
  c_slot = [c_slot[num_superclasses.index(max(num_superclasses))]]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: PySimultan
3
- Version: 0.4.6
3
+ Version: 0.4.7
4
4
  Project-URL: Documentation, https://github.com/Bühler Maximilian/PySimultan2#readme
5
5
  Project-URL: Issues, https://github.com/Bühler Maximilian/PySimultan2/issues
6
6
  Project-URL: Source, https://github.com/Bühler Maximilian/PySimultan2
@@ -1,10 +1,10 @@
1
- PySimultan2/__about__.py,sha256=UCTGJEVb-PbbGu_x1hnvDBb7cwYzpkNeq4iR7-6Jofo,19
2
- PySimultan2/__init__.py,sha256=Ikslbg50cGpasYNu28JiYrNr_-OxOpz14YX-JMhAYDM,3175
3
- PySimultan2/data_model.py,sha256=m9q3P5SfxYXdmwdQuPoTazHZAJ1xwazixFtdetJ2Dgk,26968
1
+ PySimultan2/__about__.py,sha256=EXLXxXcwrzEc6_sD7Rj1mFJyQXofYegqzwczrtGZZUw,19
2
+ PySimultan2/__init__.py,sha256=cabTN1Oz8xtFM31ouBKg5lwLqW5vtexDP669PYyNLnA,3224
3
+ PySimultan2/data_model.py,sha256=CHLfdOFF1blU-TBcn9vK98ejNRMrXUS-hvQEkZI9y4U,27016
4
4
  PySimultan2/default_types.py,sha256=v_4awsUURLbu4Sfw7J_7BoQKirXbKdU9s7-wqgA4nNE,23112
5
5
  PySimultan2/files.py,sha256=gx3BA6WYjNVplqqes7jkPopp6O50pgLvantXgmitx54,12657
6
6
  PySimultan2/multi_values.py,sha256=ZFXlTLuZo32x7_7diYAp2XEjp5uwgHLgNOzN7v74-5I,13650
7
- PySimultan2/object_mapper.py,sha256=d60SksRBKXA5GcvcXKgxv4XiTm8L99RB3hz0tyce1Sw,10125
7
+ PySimultan2/object_mapper.py,sha256=CM8L00-RRwUrU_wuhPAIgWJ_-Z0zLCbxo8rkxDzEoe8,10916
8
8
  PySimultan2/simultan_object.py,sha256=Plr9nwgRmKzdkTO7l8ksWekEow9pT-MgjjAfLlChgDI,17208
9
9
  PySimultan2/taxonomy_maps.py,sha256=aU9zUJph7QcInIZq0W-Vqoy4DYr0CEs-VsXwPMK_cxU,7976
10
10
  PySimultan2/utils.py,sha256=J3T7KDfONFeLWBulXmGMCaaOu5sfkDSHmI92JWO8dW4,62553
@@ -75,7 +75,7 @@ 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.4.6.dist-info/METADATA,sha256=0-4rmOjgV_OfFFN8_abeGg53oOiXrWIFH-kXGW3Sqdw,1657
79
- pysimultan-0.4.6.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
80
- pysimultan-0.4.6.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
- pysimultan-0.4.6.dist-info/RECORD,,
78
+ pysimultan-0.4.7.dist-info/METADATA,sha256=9PcCjKXasMhL1RrV9bLtZr8TaynqhDK22xXVpvsjtZo,1657
79
+ pysimultan-0.4.7.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
80
+ pysimultan-0.4.7.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
+ pysimultan-0.4.7.dist-info/RECORD,,