PySimultan 0.6.0.4__py3-none-any.whl → 0.6.0.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
PySimultan2/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ Version 0.6.0.3 (23.01.2024)
2
+ - Added sub_classes and super_classes to SimultanObject
3
+
1
4
  Version 0.6.0.2 (16.01.2024)
2
5
  - Added __delitem__ method to default_types.ComponentList
3
6
 
PySimultan2/__about__.py CHANGED
@@ -1 +1 @@
1
- version = '0.6.0.4'
1
+ version = '0.6.0.5'
@@ -5,6 +5,7 @@ import numpy as np
5
5
  import colorlog
6
6
  from typing import Union, List, Type, Set, Tuple, Any, Optional
7
7
 
8
+ from .geometry.geometry_base import classproperty
8
9
  from .utils import (sort_slots, create_simultan_component_for_taxonomy, create_mapped_python_object,
9
10
  set_property_to_sim_component, set_property_to_parameter, set_property_to_file_info,
10
11
  set_property_to_list, set_property_to_value_field, set_property_to_unknown_type,
@@ -32,6 +33,10 @@ class ComponentList(SimultanObject):
32
33
  _create_all = False # if true all properties are evaluated to create python objects when initialized
33
34
  _taxonomy = 'ComponentList'
34
35
 
36
+ @classproperty
37
+ def _original_class(cls) -> Type[ComponentList]:
38
+ return cls
39
+
35
40
  def __init__(self, *args, **kwargs):
36
41
  super().__init__(*args, **kwargs)
37
42
  self.component_policy = kwargs.get('component_policy', 'subcomponent') # component add policy of the content/parameter/property, 'reference' or 'subcomponent'
@@ -405,6 +410,10 @@ class ComponentDictionary(SimultanObject):
405
410
 
406
411
  _taxonomy = 'ComponentDict'
407
412
 
413
+ @classproperty
414
+ def _original_class(cls) -> Type[ComponentList]:
415
+ return cls
416
+
408
417
  def __init__(self, *args, **kwargs):
409
418
  self._dict = {}
410
419
  super().__init__(*args, **kwargs)
@@ -168,6 +168,7 @@ class PythonMapper(object):
168
168
  '_cls_instances': WeakSet(),
169
169
  '_taxonomy_map': self.taxonomy_maps.get(taxonomy, None),
170
170
  '_base': bases,
171
+ '_original_cls': cls,
171
172
  '_object_mapper': self}
172
173
 
173
174
  new_class_dict.update(self.get_properties(taxonomy))
@@ -130,6 +130,40 @@ class SimultanObject(object, metaclass=MetaMock):
130
130
  logger.error(f'Error getting cls_instances: {e}')
131
131
  return []
132
132
 
133
+ @classproperty
134
+ def super_classes(cls):
135
+ superclasses = []
136
+ for key, mcls in cls._object_mapper.mapped_classes.items():
137
+ if mcls is cls:
138
+ continue
139
+ if set(cls._original_cls.__mro__) & set(mcls._original_cls.__mro__) - set([object]) and \
140
+ set(mcls._original_cls.__mro__) - set(cls._original_cls.__mro__) - set((SimultanObject,
141
+ object)):
142
+ superclasses.append(mcls)
143
+ return superclasses
144
+
145
+ @classproperty
146
+ def sub_classes(cls):
147
+ subclasses = []
148
+ for key, mcls in cls._object_mapper.mapped_classes.items():
149
+ if mcls is cls:
150
+ continue
151
+ if set(cls._original_cls.__mro__) & set(mcls._original_cls.__mro__) - set([object]) and \
152
+ set(cls._original_cls.__mro__) - set(mcls._original_cls.__mro__) - set((SimultanObject,
153
+ object)):
154
+ subclasses.append(mcls)
155
+ return subclasses
156
+
157
+ @classproperty
158
+ def super_class_instances(cls) -> list['SimultanObject']:
159
+ instances = set()
160
+ return [instances.update(x.cls_instances) for x in cls.super_classes]
161
+
162
+ @classproperty
163
+ def sub_class_instances(cls) -> list['SimultanObject']:
164
+ instances = set()
165
+ return [instances.update(x.cls_instances) for x in cls.sub_classes]
166
+
133
167
  @classmethod
134
168
  def create_simultan_component(cls, *args, **kwargs) -> SimComponent:
135
169
  wrapped_obj = utils.create_simultan_component_for_taxonomy(cls, *args, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySimultan
3
- Version: 0.6.0.4
3
+ Version: 0.6.0.5
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,12 +1,12 @@
1
- PySimultan2/CHANGELOG.md,sha256=LEcptxMV0qCU5AyEhqo-k6pM1OfssnIV_aOdCbAS1ws,992
2
- PySimultan2/__about__.py,sha256=9_077puaOIxdv9gl0XGnRv618yBchxLnsqIuYL3PhLQ,21
1
+ PySimultan2/CHANGELOG.md,sha256=4oAIaQYO7SosBEuFQ-N7RsBkIUDksNeQjzcSkF0luH4,1081
2
+ PySimultan2/__about__.py,sha256=NIJixdlPZu8hYJt2irIp8uSErnnDSHe8FnOujnUwmJY,21
3
3
  PySimultan2/__init__.py,sha256=PGVR1uhY01dF5tHyad-znURUZ_LVB95vsjId2BT0aJM,3245
4
4
  PySimultan2/data_model.py,sha256=4TNhL_YnP7gYVEqIHAVjjmOYoEkKnU0daip0DvANdeE,37959
5
- PySimultan2/default_types.py,sha256=twkiexHeMgh20o406OYvsV9eiYy4jZxVeuyl48aLvpI,29231
5
+ PySimultan2/default_types.py,sha256=AYH4zaqoPZi3dOyoGAvpXCyb1QZUYNSbkZEtrqOa3ho,29474
6
6
  PySimultan2/files.py,sha256=nlfZpcdbQ1FxF7yK-ioS1mC5KejSQ-3wsnb-z3vrTWs,29371
7
7
  PySimultan2/multi_values.py,sha256=ZFXlTLuZo32x7_7diYAp2XEjp5uwgHLgNOzN7v74-5I,13650
8
- PySimultan2/object_mapper.py,sha256=Oz5KWvCzrYVb0ILj_WHuRarYIvVxOUGDGNeIVm5bGNQ,19839
9
- PySimultan2/simultan_object.py,sha256=7g-1VK6P3xotwP-IMz0QFiSiRlk3AXMtcoWpf0KcYQg,19278
8
+ PySimultan2/object_mapper.py,sha256=Vq4LsX5m6J1dsdlIC6V7sXEUGZYpkgPD6kwOdo5dLRI,19888
9
+ PySimultan2/simultan_object.py,sha256=WZijELW5JJK_YLEujBZasMfxI1k8v5w30Yp3K0amxF8,20793
10
10
  PySimultan2/taxonomy_maps.py,sha256=hhgXhRXIPTD2briG_yYZssJ9musOnzs0LC4e8e78e40,10323
11
11
  PySimultan2/type_setter_lookup.py,sha256=PGa5_EtV7SM15w3uxy0fA3LiQ0TaS4Ys0LYR5zs8aNk,3748
12
12
  PySimultan2/utils.py,sha256=hQpA14rtfmfSbEclwvel3cJclPu6kHIH_xAbefmLhkc,66967
@@ -70,7 +70,7 @@ PySimultan2/resources/assimp.dll,sha256=HwfDwXqoPDTFRyoQpA3qmgZoUdFtziJkV5fNtktE
70
70
  PySimultan2/resources/componentmanager.user,sha256=hrzr1US4pqkFnLHXcvPkvrgGd7QvlxaV8mhS6fuikEs,760
71
71
  PySimultan2/resources/defaultsettings.xml,sha256=QCkKmhNMxwSvC-aYUUMhkCkXqRSrkuFt5s4FEI5x1wo,396
72
72
  PySimultan2/resources/setup.bat,sha256=fjvvYfVM6TalS-QTSiKAbAId5nTsk8kGGo06ba-wWaY,32
73
- pysimultan-0.6.0.4.dist-info/METADATA,sha256=Gq62DwtaXSjfGaACm43YRMgaLQss_NhO0vmzUVoGtqI,6550
74
- pysimultan-0.6.0.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
75
- pysimultan-0.6.0.4.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
76
- pysimultan-0.6.0.4.dist-info/RECORD,,
73
+ pysimultan-0.6.0.5.dist-info/METADATA,sha256=UlW9VLFrT53lzSt4TrD4ShJfo_-VFo8PTnzQMHoVQHE,6550
74
+ pysimultan-0.6.0.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
75
+ pysimultan-0.6.0.5.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
76
+ pysimultan-0.6.0.5.dist-info/RECORD,,