PySimultan 0.4.5__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.5'
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:
@@ -1,9 +1,7 @@
1
+ from copy import copy
1
2
  from collections import UserList
2
- from weakref import WeakSet
3
- from typing import Type
4
3
  from colorlog import getLogger
5
4
 
6
- from . import config
7
5
  from .data_model import data_models
8
6
  from .utils import *
9
7
  from .default_types import ComponentList, component_list_map, ComponentDictionary, component_dict_map
@@ -16,6 +14,8 @@ from SIMULTAN.Data.Components import SimComponent
16
14
  from .geometry.geometry_base import (SimultanLayer, SimultanVertex, SimultanEdge, SimultanEdgeLoop, SimultanFace,
17
15
  SimultanVolume)
18
16
 
17
+ from .taxonomy_maps import TaxonomyMap, Content
18
+
19
19
  logger = getLogger('PySimultan')
20
20
 
21
21
  default_registered_classes = {'ComponentList': ComponentList,
@@ -35,9 +35,12 @@ class PythonMapper(object):
35
35
  def __init__(self, *args, **kwargs):
36
36
 
37
37
  self.name = kwargs.get('name', 'PythonMapper')
38
- self.registered_classes = default_registered_classes # dict with all registered classes: {taxonomy: class}
39
- self.mapped_classes = default_mapped_classes # dict with all mapped classes: {taxonomy: class}
40
- self.taxonomy_maps = default_taxonomy_maps # dict with all taxonomie maps: {taxonomy: taxonomie_map}
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
+
42
+ self.mapped_classes = copy(default_mapped_classes) # dict with all mapped classes: {taxonomy: class}
43
+ self.taxonomy_maps = copy(default_taxonomy_maps) # dict with all taxonomie maps: {taxonomy: taxonomie_map}
41
44
 
42
45
  self.registered_geometry_classes = {Layer: SimultanLayer,
43
46
  Vertex: SimultanVertex,
@@ -47,11 +50,18 @@ class PythonMapper(object):
47
50
  EdgeLoop: SimultanEdgeLoop}
48
51
 
49
52
  self.re_register = False
53
+ self.load_undefined = True
50
54
 
51
55
  def register(self, taxonomy, cls, taxonomy_map=None):
52
56
  if not self.re_register and taxonomy in self.registered_classes.keys():
53
57
  return
54
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
+
55
65
  self.registered_classes[taxonomy] = cls
56
66
  self.taxonomy_maps[taxonomy] = taxonomy_map
57
67
 
@@ -167,16 +177,20 @@ class PythonMapper(object):
167
177
  logger.warning(f'No data model provided. Using default data model: {config.get_default_data_model().id}.')
168
178
  data_model = config.get_default_data_model()
169
179
 
170
- if isinstance(component, (Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop)):
180
+ if isinstance(component,
181
+ (Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop)
182
+ ):
171
183
  self.create_python_geometry_object(component, data_model, *args, **kwargs)
172
184
 
173
185
  if cls is None:
174
186
  c_slots = [x.Target.Key for x in component.Slots.Items]
175
187
  c_slot = list(set(c_slots) & set(self.registered_classes.keys()))
176
188
  if len(c_slot) == 0:
177
- 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:
178
190
  self.register(c_slots[0], SimultanObject)
179
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]])
180
194
  elif len(c_slot) > 1:
181
195
  num_superclasses = [len(self.registered_classes[x].__mro__) for x in c_slot]
182
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.5
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=9O5pfKHtbvZDTy7tZvOfN3GgCJn-NcrpObF8IFoSmFo,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=Z3cyUMDFXDP5tkoTaZ7JNcI6Q6b-Obnz4-rnNTgWpuo,10167
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.5.dist-info/METADATA,sha256=om4m4-6FT9zzIa67Rt_K3TAAVnpH2cho7UAqw0Iqlqo,1657
79
- pysimultan-0.4.5.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
80
- pysimultan-0.4.5.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
- pysimultan-0.4.5.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,,