PySimultan 0.4.1__py3-none-any.whl → 0.4.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- PySimultan2/__about__.py +1 -1
- PySimultan2/__init__.py +6 -0
- PySimultan2/data_model.py +3 -3
- PySimultan2/files.py +4 -4
- PySimultan2/geometry/geometry_base.py +4 -4
- PySimultan2/object_mapper.py +6 -6
- PySimultan2/simultan_object.py +5 -5
- PySimultan2/utils.py +8 -9
- {pysimultan-0.4.1.dist-info → pysimultan-0.4.2.dist-info}/METADATA +1 -1
- {pysimultan-0.4.1.dist-info → pysimultan-0.4.2.dist-info}/RECORD +12 -12
- {pysimultan-0.4.1.dist-info → pysimultan-0.4.2.dist-info}/WHEEL +0 -0
- {pysimultan-0.4.1.dist-info → pysimultan-0.4.2.dist-info}/licenses/LICENSE.txt +0 -0
PySimultan2/__about__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = '0.4.
|
1
|
+
version = '0.4.2'
|
PySimultan2/__init__.py
CHANGED
@@ -91,6 +91,12 @@ class Config:
|
|
91
91
|
def get_default_mapper(self, *args, **kwargs):
|
92
92
|
return self._default_mapper
|
93
93
|
|
94
|
+
def set_default_data_model(self, data_model):
|
95
|
+
self._default_data_model = data_model
|
96
|
+
|
97
|
+
def set_default_mapper(self, mapper):
|
98
|
+
self._default_mapper = mapper
|
99
|
+
|
94
100
|
|
95
101
|
config = Config()
|
96
102
|
|
PySimultan2/data_model.py
CHANGED
@@ -119,7 +119,7 @@ class DataModel:
|
|
119
119
|
def __new__(cls, *args, **kwargs):
|
120
120
|
|
121
121
|
instance = super().__new__(cls)
|
122
|
-
config.
|
122
|
+
config.set_default_data_model(instance)
|
123
123
|
try:
|
124
124
|
data_models.add(instance)
|
125
125
|
except Exception as e:
|
@@ -378,8 +378,8 @@ class DataModel:
|
|
378
378
|
data_models = WeakSet()
|
379
379
|
data_models_dict = WeakValueDictionary()
|
380
380
|
|
381
|
-
if config.
|
382
|
-
config.
|
381
|
+
if config.get_default_data_model() is self:
|
382
|
+
config.set_default_data_model(None)
|
383
383
|
|
384
384
|
del self
|
385
385
|
|
PySimultan2/files.py
CHANGED
@@ -20,7 +20,7 @@ from SIMULTAN.Data.Components import SimComponent, ComponentMapping
|
|
20
20
|
|
21
21
|
# from .config import default_data_model
|
22
22
|
|
23
|
-
from . import config
|
23
|
+
from . import config, logger
|
24
24
|
|
25
25
|
from typing import TYPE_CHECKING
|
26
26
|
if TYPE_CHECKING:
|
@@ -197,7 +197,7 @@ class FileInfo(object, metaclass=MetaMock):
|
|
197
197
|
:return: FileInfo
|
198
198
|
"""
|
199
199
|
|
200
|
-
data_model = kwargs.get('data_model', config.
|
200
|
+
data_model = kwargs.get('data_model', config.get_default_data_model())
|
201
201
|
resource = create_asset_from_string(filename, content, *args, **kwargs)
|
202
202
|
|
203
203
|
file_info = cls(resource_entry=resource,
|
@@ -241,8 +241,8 @@ class FileInfo(object, metaclass=MetaMock):
|
|
241
241
|
def resource_entry(self) -> Union[ResourceFileEntry, ContainedResourceFileEntry, None]:
|
242
242
|
if self._resource_entry is None:
|
243
243
|
if self.data_model is None:
|
244
|
-
logger.warning(f'No data model provided. Using default data model: {config.
|
245
|
-
self.data_model = config.
|
244
|
+
logger.warning(f'No data model provided. Using default data model: {config.get_default_data_model().id}.')
|
245
|
+
self.data_model = config.get_default_data_model()
|
246
246
|
if self.data_model is not None:
|
247
247
|
self.resource_entry = self.data_model.add_resource(self.file_path)
|
248
248
|
return self._resource_entry
|
@@ -63,7 +63,7 @@ class BaseGeometry(object, metaclass=MetaMock):
|
|
63
63
|
def __init__(self, *args, **kwargs):
|
64
64
|
self._wrapped_object: Union[Vertex, Edge, Face, Volume, EdgeLoop, Layer] = kwargs.get('wrapped_object', None)
|
65
65
|
self._geometry_model: Optional[GeometryModel] = kwargs.get('geometry_model', None)
|
66
|
-
self._object_mapper = kwargs.get('object_mapper', config.
|
66
|
+
self._object_mapper = kwargs.get('object_mapper', config.get_default_mapper())
|
67
67
|
self._data_model = kwargs.get('data_model', None)
|
68
68
|
|
69
69
|
@property
|
@@ -537,7 +537,7 @@ class GeometryModel(object, metaclass=MetaMock):
|
|
537
537
|
@classmethod
|
538
538
|
def create_simultan_instance(cls, *args, **kwargs):
|
539
539
|
|
540
|
-
data_model: DataModel = kwargs.get('data_model', config.
|
540
|
+
data_model: DataModel = kwargs.get('data_model', config.get_default_data_model())
|
541
541
|
name: str = kwargs.get('name', 'GeometryModel')
|
542
542
|
|
543
543
|
new_geo_model, resource = data_model.create_new_geometry_model(name=name)
|
@@ -549,8 +549,8 @@ class GeometryModel(object, metaclass=MetaMock):
|
|
549
549
|
|
550
550
|
def __init__(self, *args, **kwargs):
|
551
551
|
self._wrapped_object: NetGeometryModel = kwargs.get('wrapped_object', None)
|
552
|
-
self._object_mapper = kwargs.get('object_mapper', config.
|
553
|
-
self._data_model = kwargs.get('data_model', config.
|
552
|
+
self._object_mapper = kwargs.get('object_mapper', config.get_default_mapper())
|
553
|
+
self._data_model = kwargs.get('data_model', config.get_default_data_model())
|
554
554
|
|
555
555
|
@property
|
556
556
|
def name(self):
|
PySimultan2/object_mapper.py
CHANGED
@@ -29,7 +29,7 @@ class PythonMapper(object):
|
|
29
29
|
|
30
30
|
def __new__(cls, *args, **kwargs):
|
31
31
|
instance = super(PythonMapper, cls).__new__(cls)
|
32
|
-
config.
|
32
|
+
config.set_default_mapper(instance)
|
33
33
|
return instance
|
34
34
|
|
35
35
|
def __init__(self, *args, **kwargs):
|
@@ -143,8 +143,8 @@ class PythonMapper(object):
|
|
143
143
|
return None
|
144
144
|
|
145
145
|
if data_model is None:
|
146
|
-
logger.warning(f'No data model provided. Using default data model: {config.
|
147
|
-
data_model = config.
|
146
|
+
logger.warning(f'No data model provided. Using default data model: {config.get_default_data_model().id}.')
|
147
|
+
data_model = config.get_default_data_model()
|
148
148
|
data_model_id = data_model.id
|
149
149
|
# data_model_id = list(data_models)[0].id
|
150
150
|
# data_model = list(data_models)[0]
|
@@ -219,8 +219,8 @@ class PythonMapper(object):
|
|
219
219
|
cls._cls_instances = WeakSet()
|
220
220
|
cls.__property_cache__ = {}
|
221
221
|
|
222
|
-
if config.
|
223
|
-
config.
|
222
|
+
if config.get_default_mapper() is self:
|
223
|
+
config.set_default_mapper(None)
|
224
224
|
|
225
225
|
def copy(self):
|
226
226
|
new_mapper = PythonMapper()
|
@@ -231,4 +231,4 @@ class PythonMapper(object):
|
|
231
231
|
|
232
232
|
|
233
233
|
if config.get_default_mapper() is None:
|
234
|
-
config.
|
234
|
+
config.set_default_mapper(PythonMapper())
|
PySimultan2/simultan_object.py
CHANGED
@@ -68,10 +68,10 @@ class MetaMock(type):
|
|
68
68
|
data_model = list(data_models.data)[0]()
|
69
69
|
kwargs['data_model'] = data_model
|
70
70
|
else:
|
71
|
-
if config.
|
71
|
+
if config.get_default_data_model() is not None:
|
72
72
|
logger.warning(
|
73
|
-
f'No data model provided. Using default data model: {config.
|
74
|
-
data_model = config.
|
73
|
+
f'No data model provided. Using default data model: {config.get_default_data_model().id}')
|
74
|
+
data_model = config.get_default_data_model()
|
75
75
|
kwargs['data_model'] = data_model
|
76
76
|
else:
|
77
77
|
raise TypeError((f'Error creating new instance of class {cls.__name__}:\n'
|
@@ -154,8 +154,8 @@ class SimultanObject(object, metaclass=MetaMock):
|
|
154
154
|
|
155
155
|
self._wrapped_obj: Union[SimComponent, None] = kwargs.get('wrapped_obj', None)
|
156
156
|
self.__obj_init__ = kwargs.get('__obj_init__', False)
|
157
|
-
self._data_model: Union[DataModel, None] = kwargs.get('data_model', config.
|
158
|
-
self._object_mapper: Union[PythonMapper, None] = kwargs.get('object_mapper', config.
|
157
|
+
self._data_model: Union[DataModel, None] = kwargs.get('data_model', config.get_default_data_model())
|
158
|
+
self._object_mapper: Union[PythonMapper, None] = kwargs.get('object_mapper', config.get_default_mapper())
|
159
159
|
self.name = kwargs.get('name', None)
|
160
160
|
|
161
161
|
self.__property_cache__ = {}
|
PySimultan2/utils.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from . import config
|
4
3
|
from enum import Enum
|
5
4
|
from weakref import WeakSet
|
6
5
|
import numpy as np
|
@@ -227,7 +226,7 @@ def get_default_slot(default_type: Union[SimTaxonomyEntryReference, SimTaxonomyE
|
|
227
226
|
:return:
|
228
227
|
"""
|
229
228
|
|
230
|
-
default_taxonomy_entry = SimDefaultSlotKeys.GetDefaultSlot(config.
|
229
|
+
default_taxonomy_entry = SimDefaultSlotKeys.GetDefaultSlot(config.get_default_data_model().project_data_manager.Taxonomies,
|
231
230
|
SimDefaultSlotKeys.Undefined)
|
232
231
|
|
233
232
|
if default_type is SimTaxonomyEntryReference:
|
@@ -604,7 +603,7 @@ def create_simultan_component_for_taxonomy(cls, *args, **kwargs) -> SimComponent
|
|
604
603
|
|
605
604
|
data_model = kwargs.get('data_model', None)
|
606
605
|
if data_model is None:
|
607
|
-
data_model = config.
|
606
|
+
data_model = config.get_default_data_model()
|
608
607
|
|
609
608
|
# simultan_taxonomy = cls._taxonomy_map.get_or_create_simultan_taxonomy(data_model=data_model)
|
610
609
|
# tayonomy_entry = cls._taxonomy_map.get_or_create_simultan_taxonomy_entry(data_model=data_model)
|
@@ -679,7 +678,7 @@ def get_property(prop_name: Optional[str] = None,
|
|
679
678
|
data_model = component._data_model
|
680
679
|
object_mapper = component._object_mapper
|
681
680
|
else:
|
682
|
-
data_model = config.
|
681
|
+
data_model = config.get_default_data_model()
|
683
682
|
obj = get_component_taxonomy_entry(wrapped_obj, text_or_key)
|
684
683
|
|
685
684
|
return get_obj_value(obj, data_model=data_model, object_mapper=object_mapper)
|
@@ -877,7 +876,7 @@ def create_mapped_python_object(value: SimComponent,
|
|
877
876
|
"""
|
878
877
|
|
879
878
|
if object_mapper is None:
|
880
|
-
object_mapper = config.
|
879
|
+
object_mapper = config.get_default_mapper()
|
881
880
|
|
882
881
|
# logger.debug(f'Creating mapped python object for {value}.')
|
883
882
|
if type(value) in object_mapper.registered_classes.values():
|
@@ -973,13 +972,13 @@ def set_property_to_list(value: Union[list, tuple, set, ComponentList],
|
|
973
972
|
|
974
973
|
if 'ComponentList' in [x.Target.Key for x in component.Slots]:
|
975
974
|
if not hasattr(component, '_object_mapper'):
|
976
|
-
mapper = config.
|
975
|
+
mapper = config.get_default_mapper()
|
977
976
|
component._object_mapper = mapper
|
978
977
|
else:
|
979
978
|
mapper = component._object_mapper
|
980
979
|
|
981
980
|
if not hasattr(component, '_data_model'):
|
982
|
-
data_model = config.
|
981
|
+
data_model = config.get_default_data_model()
|
983
982
|
component._data_model = data_model
|
984
983
|
else:
|
985
984
|
data_model = component._data_model
|
@@ -1240,13 +1239,13 @@ def set_property_to_dict(value: dict,
|
|
1240
1239
|
|
1241
1240
|
if 'ComponentDictionary' in [x.Target.Key for x in component.Slots]:
|
1242
1241
|
if not hasattr(component, '_object_mapper'):
|
1243
|
-
mapper = config.
|
1242
|
+
mapper = config.get_default_mapper()
|
1244
1243
|
component._object_mapper = mapper
|
1245
1244
|
else:
|
1246
1245
|
mapper = component._object_mapper
|
1247
1246
|
|
1248
1247
|
if not hasattr(component, '_data_model'):
|
1249
|
-
data_model = config.
|
1248
|
+
data_model = config.get_default_data_model()
|
1250
1249
|
component._data_model = data_model
|
1251
1250
|
else:
|
1252
1251
|
data_model = component._data_model
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: PySimultan
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.2
|
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,15 +1,15 @@
|
|
1
|
-
PySimultan2/__about__.py,sha256=
|
2
|
-
PySimultan2/__init__.py,sha256=
|
3
|
-
PySimultan2/data_model.py,sha256=
|
1
|
+
PySimultan2/__about__.py,sha256=Dz7KO6jRqp7b9P43mwLgOykNdRlA8qMxtHiAsqZsQbE,19
|
2
|
+
PySimultan2/__init__.py,sha256=2pdrZP8ECaVRlaCfwzFblht_30JfenzyQ2rEt-QldeU,2876
|
3
|
+
PySimultan2/data_model.py,sha256=m9q3P5SfxYXdmwdQuPoTazHZAJ1xwazixFtdetJ2Dgk,26968
|
4
4
|
PySimultan2/default_types.py,sha256=GGAnuOCwF7YSt6tPDMr6houAILWyRsAhMfb9Y_Rpetk,22946
|
5
|
-
PySimultan2/files.py,sha256=
|
5
|
+
PySimultan2/files.py,sha256=gx3BA6WYjNVplqqes7jkPopp6O50pgLvantXgmitx54,12657
|
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=hRYvgQYZb4NBZ1DyA9Nwd04i19q8SawFv-8aJHFba_g,9702
|
8
|
+
PySimultan2/simultan_object.py,sha256=F5XeHHmbh4s3hb4K8f4m-Pl9Oz1d0Pxc72VV91CQi3w,16929
|
9
9
|
PySimultan2/taxonomy_maps.py,sha256=aU9zUJph7QcInIZq0W-Vqoy4DYr0CEs-VsXwPMK_cxU,7976
|
10
|
-
PySimultan2/utils.py,sha256=
|
10
|
+
PySimultan2/utils.py,sha256=j5xnjPIWy6k3_zY2xTXN0VsnpjQgRSyakbO9DIqBsLo,62482
|
11
11
|
PySimultan2/geometry/__init__.py,sha256=nJolTD1i5J8qUkOQa-r3D20aq3Co3sN31Xc0n4wJpJo,248
|
12
|
-
PySimultan2/geometry/geometry_base.py,sha256=
|
12
|
+
PySimultan2/geometry/geometry_base.py,sha256=jOTNMISGLRjUUjVfPZ64A2Fp4oinv42polIct9bgIY4,23417
|
13
13
|
PySimultan2/geometry/utils.py,sha256=J25YsK8sso_UL7xRusItQZvyjtvxdOsSPelBQYFABhY,8519
|
14
14
|
PySimultan2/resources/AssimpNet.dll,sha256=x8uwMHPRmEH9fDQihfEQLUdblM1u7RP-CCnUjOpXcLo,205312
|
15
15
|
PySimultan2/resources/AvalonDock.dll,sha256=9tCcw7cpaVq0bh1H2sfcxb8EWhySmgujPs89lAqIPZs,500224
|
@@ -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.
|
79
|
-
pysimultan-0.4.
|
80
|
-
pysimultan-0.4.
|
81
|
-
pysimultan-0.4.
|
78
|
+
pysimultan-0.4.2.dist-info/METADATA,sha256=bwynJBG0p5oUVISh5e51xjWYfKmdU5IGPYpCkRmt7Tk,1657
|
79
|
+
pysimultan-0.4.2.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
80
|
+
pysimultan-0.4.2.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
|
81
|
+
pysimultan-0.4.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|