PySimultan 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySimultan
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Home-page:
5
5
  Author: Max Buehler
6
6
  Author-email: Max Bühler <maximilian.buehler@tuwien.ac.at>
@@ -1,13 +1,13 @@
1
1
  PySimultan2/__init__.py,sha256=X10eSCNtac3CG28w7Ogo1csNalhapO9V4oVSIucc0Kw,1121
2
2
  PySimultan2/config.py,sha256=Bazt2vDSEga_cFEIPWcAYBsj3TUN5jgtob8TtUvGm5E,1523
3
- PySimultan2/data_model.py,sha256=juyjhyYwewkh_VCeopSM9JDNFGKsjH30pC-ATDJsZy8,27784
3
+ PySimultan2/data_model.py,sha256=2Qq_JyUxtDgsIt3p5hIXIqNy7eAtvn-6Of_Wzb9AWoE,28004
4
4
  PySimultan2/default_types.py,sha256=1HJ6IZt3Lm3Hhq3A9dDmvIO46Fk9bGqDng6yTtYKmO4,22585
5
5
  PySimultan2/files.py,sha256=q6A5KTqU1nCwh0W0Qf3Se7qcvhGiDAWza2v-X-rt6E4,12473
6
6
  PySimultan2/multi_values.py,sha256=w8fy0Is5Eqr4dQ0De0ikWH__qtWtvC6NGEYreIW7VUw,12961
7
- PySimultan2/object_mapper.py,sha256=dg5Nw_oEWb3jTRFAU4CopNGsereITGcdHM1ZoKO_qNk,8564
8
- PySimultan2/simultan_object.py,sha256=XvjoqmbSG0R9kEvD4lXS4IMCZrI2_Zp5TatxGnwYxBk,15101
7
+ PySimultan2/object_mapper.py,sha256=fpr8HsnMfhzCNSLenWHDyUtkKQdeCjaSdjIV5ofmed8,8720
8
+ PySimultan2/simultan_object.py,sha256=Kv6UziARvvYmTcuagA8k3HrAUwWVNO3BrvUqeA3LpzE,15067
9
9
  PySimultan2/taxonomy_maps.py,sha256=qgKM0CdwwgLCFj-ivzY38VaCpE_eCPKyCiBaTBazpBk,7509
10
- PySimultan2/utils.py,sha256=5Qrlbsd3K-sZsBUl2hHGl-JV-WJtN2_GTZshMv-dcl0,61849
10
+ PySimultan2/utils.py,sha256=uxnvqa6JYo28h8eDg1hbxXithVNUImn9JkbW6TtGdFE,61861
11
11
  PySimultan2/geometry/__init__.py,sha256=nJolTD1i5J8qUkOQa-r3D20aq3Co3sN31Xc0n4wJpJo,248
12
12
  PySimultan2/geometry/geometry_base.py,sha256=9qePzRroQ4vDckTT9L7vI4KMydpYO8Rsj5OvbU4ZRSo,23367
13
13
  PySimultan2/geometry/utils.py,sha256=K_3HnqPMAlJkOh01oqjspeqsLrooG9NwIQKWf14IJ48,8513
@@ -75,8 +75,8 @@ 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.2.2.dist-info/LICENSE.txt,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
79
- PySimultan-0.2.2.dist-info/METADATA,sha256=cPZkD23Jxyx1CpBLoZ-4GM_4PvhfpIxc3WgChMkDHow,1801
80
- PySimultan-0.2.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
81
- PySimultan-0.2.2.dist-info/top_level.txt,sha256=pbE6SbdKIEEK4vaDNmmdRTj0vesrjgRXGow8QWMTXvk,12
82
- PySimultan-0.2.2.dist-info/RECORD,,
78
+ PySimultan-0.2.4.dist-info/LICENSE.txt,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
79
+ PySimultan-0.2.4.dist-info/METADATA,sha256=xShPfKbqMDA-N_l9VH0D7zjayN8IlAlEj4ENWxeGggw,1801
80
+ PySimultan-0.2.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
81
+ PySimultan-0.2.4.dist-info/top_level.txt,sha256=pbE6SbdKIEEK4vaDNmmdRTj0vesrjgRXGow8QWMTXvk,12
82
+ PySimultan-0.2.4.dist-info/RECORD,,
PySimultan2/data_model.py CHANGED
@@ -8,7 +8,7 @@ from weakref import WeakSet, WeakValueDictionary
8
8
  from . import config
9
9
  from .utils import *
10
10
  from pathlib import PosixPath, WindowsPath
11
- from typing import Union, Tuple
11
+ from typing import Union, Tuple, TYPE_CHECKING
12
12
 
13
13
 
14
14
  # from SIMULTAN import Projects
@@ -17,7 +17,7 @@ from SIMULTAN.Projects import ExtendedProjectData
17
17
  # noinspection PyUnresolvedReferences
18
18
  from SIMULTAN import Utils
19
19
  # noinspection PyUnresolvedReferences
20
- from SIMULTAN.Data import Users
20
+ from SIMULTAN.Data import Users as SimultanUsers
21
21
  # from SIMULTAN.Serializer import Projects
22
22
  from SIMULTAN.Serializer.SimGeo import *
23
23
  from SIMULTAN.Serializer.Projects import *
@@ -44,10 +44,14 @@ from System.Text import *
44
44
  from .files import add_tag_to_resource
45
45
 
46
46
 
47
+ if TYPE_CHECKING:
48
+ from .object_mapper import PythonMapper
49
+
50
+
47
51
  logger = getLogger('PySimultan')
48
52
 
49
53
 
50
- class IAuthenticationServiceNew(Users.IAuthenticationService):
54
+ class IAuthenticationServiceNew(SimultanUsers.IAuthenticationService):
51
55
  __namespace__ = "authenticate_namespace"
52
56
 
53
57
  user_name = None
@@ -88,13 +92,13 @@ class DataModel:
88
92
 
89
93
  passwordArray = Encoding.UTF8.GetBytes(password)
90
94
  encryptionKey = RandomNumberGenerator.GetBytes(32)
91
- encryptedEncryptionKey = Users.SimUsersManager.EncryptEncryptionKey(encryptionKey, passwordArray)
92
- passwordHash = Users.SimUsersManager.HashPassword(passwordArray)
93
- initialUser = Users.SimUser(Guid.NewGuid(),
94
- user_name,
95
- passwordHash,
96
- encryptedEncryptionKey,
97
- Users.SimUserRole.ADMINISTRATOR)
95
+ encryptedEncryptionKey = SimultanUsers.SimUsersManager.EncryptEncryptionKey(encryptionKey, passwordArray)
96
+ passwordHash = SimultanUsers.SimUsersManager.HashPassword(passwordArray)
97
+ initialUser = SimultanUsers.SimUser(Guid.NewGuid(),
98
+ user_name,
99
+ passwordHash,
100
+ encryptedEncryptionKey,
101
+ SimultanUsers.SimUserRole.ADMINISTRATOR)
98
102
 
99
103
  tempPath = Path.GetTempPath()
100
104
  projectFile = FileInfo(project_path)
@@ -151,7 +155,7 @@ class DataModel:
151
155
  self.i_aut_service.user_name = self.user_name
152
156
  self.i_aut_service.password = self.password
153
157
 
154
- self.service_provider.AddService[Users.IAuthenticationService](self.i_aut_service())
158
+ self.service_provider.AddService[SimultanUsers.IAuthenticationService](self.i_aut_service())
155
159
 
156
160
  # self.serv = GeometryViewerService([], self.service_provider)
157
161
  # self.service_provider.AddService[IGeometryViewerService](self.serv)
@@ -249,13 +253,13 @@ class DataModel:
249
253
  self._project_data_manager = value
250
254
 
251
255
  @property
252
- def user(self) -> Users.SimUserRole:
256
+ def user(self) -> SimultanUsers.SimUserRole:
253
257
  if self._user is None:
254
- self._user = Users.SimUserRole.ADMINISTRATOR
258
+ self._user = SimultanUsers.SimUserRole.ADMINISTRATOR
255
259
  return self._user
256
260
 
257
261
  @user.setter
258
- def user(self, value: Users.SimUserRole):
262
+ def user(self, value: SimultanUsers.SimUserRole):
259
263
  if value != self._user:
260
264
  self.project_data_manager = None
261
265
  self._project = None
@@ -279,7 +283,7 @@ class DataModel:
279
283
  def project(self, value):
280
284
  self._project = value
281
285
 
282
- def get_typed_data(self, mapper, create_all=False) -> list[SimultanObject]:
286
+ def get_typed_data(self, mapper: 'PythonMapper', create_all=False) -> list[SimultanObject]:
283
287
  """
284
288
  Return the typed data from the project
285
289
  :param mapper:
@@ -66,6 +66,7 @@ class PythonMapper(object):
66
66
  new_class_dict = {'__init__': new_init,
67
67
  '__name__': cls.__name__,
68
68
  '_taxonomy': taxonomy,
69
+ '_cls_instances': WeakSet(),
69
70
  '_taxonomy_map': self.taxonomy_maps.get(taxonomy, None),
70
71
  '_base': bases,
71
72
  '_object_mapper': self}
@@ -192,6 +193,9 @@ class PythonMapper(object):
192
193
  return prop_dict
193
194
 
194
195
  def clear(self):
196
+ for cls in self.registered_classes.values():
197
+ cls._cls_instances = WeakSet()
198
+
195
199
  for cls in self.mapped_classes.values():
196
200
  cls._cls_instances = WeakSet()
197
201
 
@@ -109,7 +109,6 @@ class SimultanObject(object, metaclass=MetaMock):
109
109
  @classproperty
110
110
  def cls_instances(cls) -> list['SimultanObject']:
111
111
  try:
112
- _ = cls._cls_instances
113
112
  return list(cls._cls_instances)
114
113
  except Exception as e:
115
114
  logger.error(f'Error getting cls_instances: {e}')
@@ -123,7 +122,7 @@ class SimultanObject(object, metaclass=MetaMock):
123
122
 
124
123
  def __new__(cls, *args, **kwargs):
125
124
  instance = super().__new__(cls)
126
- if not hasattr(cls, '_cls_instances'):
125
+ if "_cls_instances" not in cls.__dict__:
127
126
  cls._cls_instances = WeakSet()
128
127
  try:
129
128
  cls._cls_instances.add(instance)
PySimultan2/utils.py CHANGED
@@ -5,7 +5,7 @@ from enum import Enum
5
5
  from functools import lru_cache
6
6
  import numpy as np
7
7
  import pandas as pd
8
- from typing import List as TypeList, Union, Optional
8
+ from typing import List as TypeList, Union, Optional, Type
9
9
  from SIMULTAN.Data.Components import (ComponentWalker, SimComponent, SimBoolParameter, SimDoubleParameter,
10
10
  SimEnumParameter, SimIntegerParameter, SimStringParameter, ComponentMapping,
11
11
  SimSlot, SimComponentVisibility, SimChildComponentEntry, SimDefaultSlots,
@@ -55,7 +55,7 @@ class CircularReferenceResolver(object):
55
55
  circ_ref_resolver = CircularReferenceResolver()
56
56
 
57
57
 
58
- def create_python_object(wrapped_obj: SimComponent, cls: SimultanObject, *args, **kwargs):
58
+ def create_python_object(wrapped_obj: SimComponent, cls: Type[SimultanObject], *args, **kwargs):
59
59
  """
60
60
  Create a new mapped python object from a wrapped object
61
61
  :param wrapped_obj: wrapped object to create the python object from