PySimultan 0.4.3__py3-none-any.whl → 0.4.6__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.3'
1
+ version = '0.4.6'
PySimultan2/__init__.py CHANGED
@@ -1,8 +1,12 @@
1
1
  import os
2
2
  import sys
3
3
  import colorlog
4
- # from .config import *
5
- from ruamel.yaml import YAML, yaml_object, add_representer
4
+ from ruamel.yaml import YAML, add_representer
5
+
6
+ from typing import TYPE_CHECKING
7
+ if TYPE_CHECKING:
8
+ from .data_model import DataModel
9
+ from .object_mapper import PythonMapper
6
10
 
7
11
  def setup_logging():
8
12
  handler = colorlog.StreamHandler()
@@ -85,16 +89,18 @@ class Config:
85
89
  self._default_mapper = None
86
90
  self.logger = logger
87
91
 
88
- def get_default_data_model(self, *args, **kwargs):
92
+ def get_default_data_model(self, *args, **kwargs) -> 'DataModel':
89
93
  return self._default_data_model
90
94
 
91
- def get_default_mapper(self, *args, **kwargs):
95
+ def get_default_mapper(self, *args, **kwargs) -> 'PythonMapper':
92
96
  return self._default_mapper
93
97
 
94
- def set_default_data_model(self, data_model):
98
+ def set_default_data_model(self, data_model: 'DataModel'):
99
+ self.logger.debug(f'set_default_data_model: {id(data_model)}')
95
100
  self._default_data_model = data_model
96
101
 
97
- def set_default_mapper(self, mapper):
102
+ def set_default_mapper(self, mapper: 'PythonMapper'):
103
+ self.logger.debug(f'set_default_mapper: {id(mapper)}')
98
104
  self._default_mapper = mapper
99
105
 
100
106
 
@@ -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
@@ -35,9 +33,10 @@ class PythonMapper(object):
35
33
  def __init__(self, *args, **kwargs):
36
34
 
37
35
  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}
36
+ self.registered_classes = copy(
37
+ default_registered_classes) # dict with all registered classes: {taxonomy: class}
38
+ self.mapped_classes = copy(default_mapped_classes) # dict with all mapped classes: {taxonomy: class}
39
+ self.taxonomy_maps = copy(default_taxonomy_maps) # dict with all taxonomie maps: {taxonomy: taxonomie_map}
41
40
 
42
41
  self.registered_geometry_classes = {Layer: SimultanLayer,
43
42
  Vertex: SimultanVertex,
@@ -220,7 +219,7 @@ class PythonMapper(object):
220
219
 
221
220
  return prop_dict
222
221
 
223
- def clear(self):
222
+ def clear(self, remove_from_default=False):
224
223
  for cls in self.registered_classes.values():
225
224
  cls._cls_instances = WeakSet()
226
225
 
@@ -228,7 +227,7 @@ class PythonMapper(object):
228
227
  cls._cls_instances = WeakSet()
229
228
  cls.__property_cache__ = {}
230
229
 
231
- if config.get_default_mapper() is self:
230
+ if remove_from_default and config.get_default_mapper() is self:
232
231
  config.set_default_mapper(None)
233
232
 
234
233
  def copy(self):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: PySimultan
3
- Version: 0.4.3
3
+ Version: 0.4.6
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=l1cddhN_DochM-HfCX27Wng2U2p8iuhA7C5-Wd08cIA,19
2
- PySimultan2/__init__.py,sha256=2pdrZP8ECaVRlaCfwzFblht_30JfenzyQ2rEt-QldeU,2876
1
+ PySimultan2/__about__.py,sha256=UCTGJEVb-PbbGu_x1hnvDBb7cwYzpkNeq4iR7-6Jofo,19
2
+ PySimultan2/__init__.py,sha256=Ikslbg50cGpasYNu28JiYrNr_-OxOpz14YX-JMhAYDM,3175
3
3
  PySimultan2/data_model.py,sha256=m9q3P5SfxYXdmwdQuPoTazHZAJ1xwazixFtdetJ2Dgk,26968
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=UUP8oZNkCG68DpizNJlcj14nrPTKMiq5oWAmA_XO1AY,10116
7
+ PySimultan2/object_mapper.py,sha256=d60SksRBKXA5GcvcXKgxv4XiTm8L99RB3hz0tyce1Sw,10125
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.3.dist-info/METADATA,sha256=Pf9TmV9HU7TQg3_pk6bdKxPs_zXZjppZpgEvOCwUMAk,1657
79
- pysimultan-0.4.3.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
80
- pysimultan-0.4.3.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
- pysimultan-0.4.3.dist-info/RECORD,,
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,,