PySimultan 0.2.3__py3-none-any.whl → 0.2.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,17 @@
1
- Permission is hereby granted, free of charge, to any person obtaining a copy
2
- of this software and associated documentation files (the "Software"), to
3
- deal in the Software without restriction, including without limitation the
4
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5
- sell copies of the Software, and to permit persons to whom the Software is
6
- furnished to do so, subject to the following conditions:
7
-
8
- The above copyright notice and this permission notice shall be included in
9
- all copies or substantial portions of the Software.
10
-
11
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
17
- IN THE SOFTWARE.
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy
2
+ of this software and associated documentation files (the "Software"), to
3
+ deal in the Software without restriction, including without limitation the
4
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
5
+ sell copies of the Software, and to permit persons to whom the Software is
6
+ furnished to do so, subject to the following conditions:
7
+
8
+ The above copyright notice and this permission notice shall be included in
9
+ all copies or substantial portions of the Software.
10
+
11
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
16
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
17
+ IN THE SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PySimultan
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Home-page:
5
5
  Author: Max Buehler
6
6
  Author-email: Max Bühler <maximilian.buehler@tuwien.ac.at>
@@ -28,6 +28,14 @@ Classifier: Operating System :: OS Independent
28
28
  Requires-Python: >=3.10
29
29
  Description-Content-Type: text/markdown
30
30
  License-File: LICENSE.txt
31
+ Requires-Dist: six
32
+ Requires-Dist: numpy
33
+ Requires-Dist: pythonnet
34
+ Requires-Dist: colorlog
35
+ Requires-Dist: ruamel.yaml
36
+ Requires-Dist: tqdm
37
+ Requires-Dist: pandas
38
+ Requires-Dist: pyarrow
31
39
 
32
40
  ===================================================
33
41
  geometry_utils: Several tools to work with geometry
@@ -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=ATpwOZHq7Fl33uV4y4wRhM7vPuCL_KnjtRkltMm5vMw,8664
8
- PySimultan2/simultan_object.py,sha256=XvjoqmbSG0R9kEvD4lXS4IMCZrI2_Zp5TatxGnwYxBk,15101
7
+ PySimultan2/object_mapper.py,sha256=fpr8HsnMfhzCNSLenWHDyUtkKQdeCjaSdjIV5ofmed8,8720
8
+ PySimultan2/simultan_object.py,sha256=3uTNbw_acTj_4_ZVE8n5D0zLxuSnSH58tDfgrxOBs-Y,15206
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=eCClnI1UpAOACiCMu5BmoVZ8oeR_FEWUugzsbaw41Yk,62038
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.3.dist-info/LICENSE.txt,sha256=53SfqMB8o2gCG74cXKJb1NtKYYrtw5S2hvtPeB5vaig,1040
79
- PySimultan-0.2.3.dist-info/METADATA,sha256=OworimYpJBeBn2nPONRiZbRLVgFlMXzorcg8wUAlqYs,1801
80
- PySimultan-0.2.3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
81
- PySimultan-0.2.3.dist-info/top_level.txt,sha256=pbE6SbdKIEEK4vaDNmmdRTj0vesrjgRXGow8QWMTXvk,12
82
- PySimultan-0.2.3.dist-info/RECORD,,
78
+ PySimultan-0.2.5.dist-info/LICENSE.txt,sha256=htoPAa6uRjSKPD1GUZXcHOzN55956HdppkuNoEsqR0E,1023
79
+ PySimultan-0.2.5.dist-info/METADATA,sha256=tBYnPWk-05KRdrhN4wfz9HrkTHeTZ47PR00qDVUyc_s,1990
80
+ PySimultan-0.2.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
81
+ PySimultan-0.2.5.dist-info/top_level.txt,sha256=pbE6SbdKIEEK4vaDNmmdRTj0vesrjgRXGow8QWMTXvk,12
82
+ PySimultan-0.2.5.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}
@@ -102,6 +102,10 @@ class SimultanObject(object, metaclass=MetaMock):
102
102
  _cls_instances_dict_cache = None
103
103
  __type_view__ = None # ui view cls
104
104
 
105
+ @classmethod
106
+ def get_instance_by_id(cls, id: SimId) -> 'SimultanObject':
107
+ return cls._cls_instances_dict.get(id, None)
108
+
105
109
  @classproperty
106
110
  def _cls_instances_dict(cls) -> dict[SimId, 'SimultanObject']:
107
111
  return dict(zip([x.id for x in cls._cls_instances], [x for x in cls._cls_instances]))
@@ -109,7 +113,6 @@ class SimultanObject(object, metaclass=MetaMock):
109
113
  @classproperty
110
114
  def cls_instances(cls) -> list['SimultanObject']:
111
115
  try:
112
- _ = cls._cls_instances
113
116
  return list(cls._cls_instances)
114
117
  except Exception as e:
115
118
  logger.error(f'Error getting cls_instances: {e}')
@@ -123,7 +126,7 @@ class SimultanObject(object, metaclass=MetaMock):
123
126
 
124
127
  def __new__(cls, *args, **kwargs):
125
128
  instance = super().__new__(cls)
126
- if not hasattr(cls, '_cls_instances'):
129
+ if "_cls_instances" not in cls.__dict__:
127
130
  cls._cls_instances = WeakSet()
128
131
  try:
129
132
  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
@@ -1143,6 +1143,7 @@ def set_property_to_value_field(value: Union[np.ndarray, pd.DataFrame],
1143
1143
  data_model=component._data_model)
1144
1144
 
1145
1145
  if parameter_idx is None:
1146
+
1146
1147
  param = create_field_parameter(field_name=str(component.id) + '_' + prop_name,
1147
1148
  value=value,
1148
1149
  slot=taxonomy_entry,
@@ -1264,6 +1265,8 @@ def add_properties(prop_name: str,
1264
1265
  SimStringParameter: set_property_to_parameter,
1265
1266
  SimBoolParameter: set_property_to_parameter,
1266
1267
  SimEnumParameter: set_property_to_parameter,
1268
+ SimMultiValueField3D: set_property_to_value_field,
1269
+ SimMultiValueBigTable: set_property_to_value_field,
1267
1270
  int: set_property_to_parameter,
1268
1271
  float: set_property_to_parameter,
1269
1272
  str: set_property_to_parameter,