PySimultan 0.3.0__tar.gz → 0.3.2__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {pysimultan-0.3.0 → pysimultan-0.3.2}/LICENSE.txt +17 -17
- {pysimultan-0.3.0 → pysimultan-0.3.2}/MANIFEST.in +9 -9
- {pysimultan-0.3.0/src/PySimultan.egg-info → pysimultan-0.3.2}/PKG-INFO +1 -1
- {pysimultan-0.3.0 → pysimultan-0.3.2}/README.md +5 -5
- {pysimultan-0.3.0 → pysimultan-0.3.2}/pyproject.toml +1 -1
- {pysimultan-0.3.0 → pysimultan-0.3.2}/requirements.txt +14 -14
- {pysimultan-0.3.0 → pysimultan-0.3.2}/setup.py +1 -1
- {pysimultan-0.3.0 → pysimultan-0.3.2/src/PySimultan.egg-info}/PKG-INFO +1 -1
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan.egg-info/SOURCES.txt +1 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan.egg-info/top_level.txt +1 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/default_types.py +2 -2
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/object_mapper.py +29 -22
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/simultan_object.py +9 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/utils.py +21 -3
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_calculate_steady_state_temperature.py +0 -2
- pysimultan-0.3.2/tests/test_circular_references.py +162 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_set_attr_property.py +14 -3
- {pysimultan-0.3.0 → pysimultan-0.3.2}/setup.cfg +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan.egg-info/dependency_links.txt +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan.egg-info/not-zip-safe +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan.egg-info/requires.txt +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/__init__.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/config.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/data_model.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/files.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/geometry/__init__.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/geometry/geometry_base.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/geometry/utils.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/multi_values.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/AssimpNet.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/AvalonDock.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/BruTile.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ClosedXML.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ComponentBuilder.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ComponentBuilder.dll.config +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ComponentBuilder.runtimeconfig.json +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ComponentBuilder.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ControlzEx.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/DocumentFormat.OpenXml.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/DotSpatial.Projections.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ExcelNumberFormat.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Fluent.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/GeometryViewer.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/GeometryViewer.dll.config +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/GeometryViewer.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/HelixToolkit.Core.Wpf.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/HelixToolkit.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/MathNet.Numerics.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.AspNetCore.Authorization.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Extensions.Options.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Extensions.Primitives.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Xaml.Behaviors.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Newtonsoft.Json.Bson.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Newtonsoft.Json.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll.config +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll.config +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.Lang.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.Plugins.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.Plugins.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.UI.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.UI.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SharpDX.D3DCompiler.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SharpDX.DXGI.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SharpDX.Direct2D1.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SharpDX.Direct3D11.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SharpDX.Direct3D9.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SharpDX.Mathematics.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SharpDX.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SitePlanner.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SitePlanner.dll.config +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SitePlanner.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Sprache.Calc.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Sprache.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/System.Data.OleDb.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/System.Net.Http.Formatting.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/XAMLMarkupExtensions.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/__init__.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/assimp.dll +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/defaultsettings.xml +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/setup.bat +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/taxonomy_maps.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_calc_static_zone_temperature.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_create_geometry.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_files.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_files_load.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_load_geometry.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_load_multi_values.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_new_dll.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_new_project_creation.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_numeric_map.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_pythonnet.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_register_class.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_set_dictionary.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_set_properties.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_taxonomie_maps.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_taxonomies.py +0 -0
- {pysimultan-0.3.0 → pysimultan-0.3.2}/tests/test_ui.py +0 -0
@@ -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,9 +1,9 @@
|
|
1
|
-
include README.rst
|
2
|
-
include LICENSE.txt
|
3
|
-
include requirements.txt
|
4
|
-
|
5
|
-
graft src/py_plot_tools/resources
|
6
|
-
graft src/py_plot_tools/basic_geometries/gui_adaptions/infos/generated
|
7
|
-
graft src/py_plot_tools/generated
|
8
|
-
recursive-exclude src/tests *
|
9
|
-
recursive-include src/resources *
|
1
|
+
include README.rst
|
2
|
+
include LICENSE.txt
|
3
|
+
include requirements.txt
|
4
|
+
|
5
|
+
graft src/py_plot_tools/resources
|
6
|
+
graft src/py_plot_tools/basic_geometries/gui_adaptions/infos/generated
|
7
|
+
graft src/py_plot_tools/generated
|
8
|
+
recursive-exclude src/tests *
|
9
|
+
recursive-include src/resources *
|
@@ -1,5 +1,5 @@
|
|
1
|
-
===================================================
|
2
|
-
geometry_utils: Several tools to work with geometry
|
3
|
-
===================================================
|
4
|
-
|
5
|
-
Python library with several tools to work with geometry
|
1
|
+
===================================================
|
2
|
+
geometry_utils: Several tools to work with geometry
|
3
|
+
===================================================
|
4
|
+
|
5
|
+
Python library with several tools to work with geometry
|
@@ -1,14 +1,14 @@
|
|
1
|
-
#
|
2
|
-
# This file is autogenerated by pip-compile
|
3
|
-
# To update, run:
|
4
|
-
#
|
5
|
-
# pip-compile requirements.in
|
6
|
-
#
|
7
|
-
six
|
8
|
-
numpy
|
9
|
-
pythonnet
|
10
|
-
colorlog
|
11
|
-
ruamel.yaml
|
12
|
-
tqdm
|
13
|
-
pandas
|
14
|
-
pyarrow
|
1
|
+
#
|
2
|
+
# This file is autogenerated by pip-compile
|
3
|
+
# To update, run:
|
4
|
+
#
|
5
|
+
# pip-compile requirements.in
|
6
|
+
#
|
7
|
+
six
|
8
|
+
numpy
|
9
|
+
pythonnet
|
10
|
+
colorlog
|
11
|
+
ruamel.yaml
|
12
|
+
tqdm
|
13
|
+
pandas
|
14
|
+
pyarrow
|
@@ -11,7 +11,7 @@ with project_dir.joinpath("requirements.txt").open() as f:
|
|
11
11
|
|
12
12
|
setuptools.setup(
|
13
13
|
name="PySimultan",
|
14
|
-
version="0.3.
|
14
|
+
version="0.3.2",
|
15
15
|
description="Integrate SIMULTAN into Python",
|
16
16
|
# Allow UTF-8 characters in README with encoding argument.
|
17
17
|
long_description=project_dir.joinpath("README.md").read_text(encoding="utf-8"),
|
@@ -90,6 +90,7 @@ src/PySimultan2/resources/defaultsettings.xml
|
|
90
90
|
src/PySimultan2/resources/setup.bat
|
91
91
|
tests/test_calc_static_zone_temperature.py
|
92
92
|
tests/test_calculate_steady_state_temperature.py
|
93
|
+
tests/test_circular_references.py
|
93
94
|
tests/test_create_geometry.py
|
94
95
|
tests/test_files.py
|
95
96
|
tests/test_files_load.py
|
@@ -97,7 +97,7 @@ class ComponentList(SimultanObject):
|
|
97
97
|
|
98
98
|
@property
|
99
99
|
def ref_components(self):
|
100
|
-
return [x.Target for x in self._wrapped_obj.ReferencedComponents.Items]
|
100
|
+
return [x.Target for x in self._wrapped_obj.ReferencedComponents.Items if x.Target is not None]
|
101
101
|
|
102
102
|
@property
|
103
103
|
def data(self) -> List[SimultanObject]:
|
@@ -109,7 +109,7 @@ class ComponentList(SimultanObject):
|
|
109
109
|
all_components = [*components, *ref_components]
|
110
110
|
|
111
111
|
slots = [*[x.Slot for x in self._wrapped_obj.Components.Items],
|
112
|
-
*[x.Slot for x in self._wrapped_obj.ReferencedComponents.Items]]
|
112
|
+
*[x.Slot for x in self._wrapped_obj.ReferencedComponents.Items if x.Target is not None]]
|
113
113
|
|
114
114
|
try:
|
115
115
|
indices = sort_slots(slots)
|
@@ -12,6 +12,7 @@ from .simultan_object import SimultanObject
|
|
12
12
|
from .geometry.utils import create_python_geometry
|
13
13
|
|
14
14
|
from SIMULTAN.Data.Geometry import (Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop)
|
15
|
+
from SIMULTAN.Data.Components import SimComponent
|
15
16
|
from .geometry.geometry_base import (SimultanLayer, SimultanVertex, SimultanEdge, SimultanEdgeLoop, SimultanFace,
|
16
17
|
SimultanVolume)
|
17
18
|
|
@@ -94,31 +95,37 @@ class PythonMapper(object):
|
|
94
95
|
if data_model is None:
|
95
96
|
data_model = list(data_models)[0]
|
96
97
|
|
98
|
+
if create_all:
|
99
|
+
new_component_list = set()
|
100
|
+
|
101
|
+
def get_subcomponents(sim_component: Union[SimComponent, SimultanObject]):
|
102
|
+
print(sim_component.Id)
|
103
|
+
new_subcomponents = set()
|
104
|
+
if isinstance(sim_component, SimultanObject):
|
105
|
+
sim_component = sim_component._wrapped_obj
|
106
|
+
|
107
|
+
if sim_component in new_component_list:
|
108
|
+
return
|
109
|
+
else:
|
110
|
+
new_component_list.add(sim_component)
|
111
|
+
|
112
|
+
for sub_component in sim_component.Components.Items:
|
113
|
+
new_subcomponents.add(sub_component.Component)
|
114
|
+
for ref_component in sim_component.ReferencedComponents.Items:
|
115
|
+
new_subcomponents.add(ref_component.Target)
|
116
|
+
|
117
|
+
for new_subcomponent in new_subcomponents:
|
118
|
+
get_subcomponents(new_subcomponent)
|
119
|
+
|
120
|
+
new_component_list.update(new_subcomponents)
|
121
|
+
|
122
|
+
for component in component_list:
|
123
|
+
get_subcomponents(component)
|
124
|
+
component_list = list(new_component_list)
|
125
|
+
|
97
126
|
for component in component_list:
|
98
127
|
typed_object = self.create_python_object(component, data_model=data_model)
|
99
128
|
typed_data.append(typed_object)
|
100
|
-
if create_all:
|
101
|
-
|
102
|
-
def get_content(typed_object):
|
103
|
-
if isinstance(typed_object, SimultanObject):
|
104
|
-
for content in typed_object.__class__._taxonomy_map.content:
|
105
|
-
val = getattr(typed_object, content.property_name)
|
106
|
-
if isinstance(val, (SimultanObject, ComponentList, ComponentDictionary)):
|
107
|
-
typed_data.append(val)
|
108
|
-
get_content(val)
|
109
|
-
elif isinstance(typed_object, ComponentList):
|
110
|
-
for item in typed_object:
|
111
|
-
if isinstance(item, (SimultanObject, ComponentList, ComponentDictionary)):
|
112
|
-
typed_data.append(item)
|
113
|
-
get_content(item)
|
114
|
-
elif isinstance(typed_object, ComponentDictionary):
|
115
|
-
for item in typed_object.values():
|
116
|
-
if isinstance(item, (SimultanObject, ComponentList, ComponentDictionary)):
|
117
|
-
typed_data.append(item)
|
118
|
-
get_content(item)
|
119
|
-
|
120
|
-
get_content(typed_object)
|
121
|
-
|
122
129
|
return typed_data
|
123
130
|
|
124
131
|
# @lru_cache(maxsize=None)
|
@@ -136,6 +136,15 @@ class SimultanObject(object, metaclass=MetaMock):
|
|
136
136
|
return instance
|
137
137
|
|
138
138
|
def __init__(self, *args, **kwargs):
|
139
|
+
"""
|
140
|
+
Initialize the SimultanObject. This method is only called if the object is initialized the first time without a
|
141
|
+
wrapped_obj. If a wrapped_obj is defined, the __new__ method is called and the object can be initialized with
|
142
|
+
the __load_init__ method.
|
143
|
+
|
144
|
+
:param args:
|
145
|
+
:param kwargs:
|
146
|
+
"""
|
147
|
+
|
139
148
|
self._wrapped_obj: Union[SimComponent, None] = kwargs.get('wrapped_obj', None)
|
140
149
|
self.__obj_init__ = kwargs.get('__obj_init__', False)
|
141
150
|
self._data_model_id = kwargs.get('data_model_id', None)
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
from . import config
|
4
4
|
from enum import Enum
|
5
|
+
from weakref import WeakSet
|
5
6
|
from functools import lru_cache
|
6
7
|
import numpy as np
|
7
8
|
import pandas as pd
|
@@ -45,6 +46,9 @@ class UnresolvedObject(object):
|
|
45
46
|
def resolve(self):
|
46
47
|
return self.cls._cls_instances_dict[self.wrapped_obj.Id]
|
47
48
|
|
49
|
+
def __getattr__(self, item):
|
50
|
+
return getattr(self.wrapped_obj, item)
|
51
|
+
|
48
52
|
|
49
53
|
class CircularReferenceResolver(object):
|
50
54
|
|
@@ -91,11 +95,26 @@ def create_python_object(wrapped_obj: SimComponent, cls: Type[SimultanObject], *
|
|
91
95
|
prop_name=content.text_or_key,
|
92
96
|
object_mapper=kwargs.get('object_mapper', None),
|
93
97
|
)
|
98
|
+
|
94
99
|
kwargs['name'] = wrapped_obj.Name
|
95
100
|
kwargs['__obj_init__'] = True
|
96
|
-
obj = cls(wrapped_obj=wrapped_obj, *args, **kwargs)
|
97
|
-
obj.__obj_init__ = False
|
98
101
|
|
102
|
+
obj = cls.__new__(cls)
|
103
|
+
obj._wrapped_obj = wrapped_obj
|
104
|
+
obj._data_model = kwargs.get('data_model', None)
|
105
|
+
obj._object_mapper = kwargs.get('object_mapper', None)
|
106
|
+
obj.component_policy = kwargs.get('component_policy', 'subcomponent')
|
107
|
+
|
108
|
+
if "_cls_instances" not in cls.__dict__:
|
109
|
+
cls._cls_instances = WeakSet()
|
110
|
+
try:
|
111
|
+
cls._cls_instances.add(obj)
|
112
|
+
except Exception as e:
|
113
|
+
logger.error(f'Error adding instance {obj} to _cls_instances: {e}')
|
114
|
+
|
115
|
+
if hasattr(cls, '__load_init__'):
|
116
|
+
obj.__init__(*args, **kwargs)
|
117
|
+
#
|
99
118
|
circ_ref_resolver.unresolved_objects.pop(wrapped_obj.Id)
|
100
119
|
|
101
120
|
return obj
|
@@ -1283,7 +1302,6 @@ def add_properties(prop_name: str,
|
|
1283
1302
|
np.ndarray: set_property_to_value_field,
|
1284
1303
|
pd.DataFrame: set_property_to_value_field}
|
1285
1304
|
|
1286
|
-
# @lru_cache()
|
1287
1305
|
def getx(self):
|
1288
1306
|
return get_property(component=self,
|
1289
1307
|
prop_name=content.text_or_key,
|
@@ -0,0 +1,162 @@
|
|
1
|
+
from src.PySimultan2 import FileInfo
|
2
|
+
from src.PySimultan2 import DataModel
|
3
|
+
from src.PySimultan2 import PythonMapper
|
4
|
+
from src.PySimultan2.taxonomy_maps import TaxonomyMap, Content
|
5
|
+
|
6
|
+
from typing import List
|
7
|
+
|
8
|
+
from tests import resources
|
9
|
+
|
10
|
+
try:
|
11
|
+
import importlib.resources as pkg_resources
|
12
|
+
except ImportError:
|
13
|
+
import importlib_resources as pkg_resources
|
14
|
+
|
15
|
+
with pkg_resources.path(resources, 'new_geometry_test.simultan') as r_path:
|
16
|
+
project_path = str(r_path)
|
17
|
+
|
18
|
+
|
19
|
+
def create_classes() -> tuple[dict[str, type], PythonMapper]:
|
20
|
+
|
21
|
+
class Class1(object):
|
22
|
+
def __init__(self, *args, **kwargs):
|
23
|
+
self.temperature = kwargs.get('temperature', 125.15)
|
24
|
+
self.obj_1 = kwargs.get('obj_1', None)
|
25
|
+
|
26
|
+
class Class2(object):
|
27
|
+
def __init__(self, *args, **kwargs):
|
28
|
+
self.temperature = kwargs.get('temperature', 225.15)
|
29
|
+
self.obj_1 = kwargs.get('obj_1', None)
|
30
|
+
|
31
|
+
class Class3(object):
|
32
|
+
def __init__(self, *args, **kwargs):
|
33
|
+
self.temperature = kwargs.get('temperature', 325.15)
|
34
|
+
self.obj_1 = kwargs.get('obj_1', None)
|
35
|
+
|
36
|
+
cls_dict = {'Class1': Class1,
|
37
|
+
'Class2': Class2,
|
38
|
+
'Class3': Class3,
|
39
|
+
}
|
40
|
+
|
41
|
+
return cls_dict
|
42
|
+
|
43
|
+
|
44
|
+
def create_mapped_classes(classes: dict[str, type]) -> dict[str, type]:
|
45
|
+
mapper = PythonMapper()
|
46
|
+
|
47
|
+
def create_contents() -> dict[str, Content]:
|
48
|
+
contents = {}
|
49
|
+
|
50
|
+
contents['temperature'] = Content(text_or_key='temperature',
|
51
|
+
property_name='temperature',
|
52
|
+
type=None,
|
53
|
+
unit='K',
|
54
|
+
documentation='temperature in K')
|
55
|
+
|
56
|
+
contents['obj_1'] = Content(text_or_key='obj_1',
|
57
|
+
property_name='obj_1',
|
58
|
+
type=None,
|
59
|
+
unit=None,
|
60
|
+
documentation='obj_1')
|
61
|
+
|
62
|
+
contents['obj_2'] = Content(text_or_key='obj_2',
|
63
|
+
property_name='obj_2',
|
64
|
+
type=None,
|
65
|
+
unit=None,
|
66
|
+
documentation='obj_2')
|
67
|
+
|
68
|
+
return contents
|
69
|
+
|
70
|
+
def create_mapped_cls_1(cls, contents: dict[str, Content]):
|
71
|
+
cls_map = TaxonomyMap(taxonomy_name='PySimultan',
|
72
|
+
taxonomy_key='PySimultan',
|
73
|
+
taxonomy_entry_name='Class1',
|
74
|
+
taxonomy_entry_key='Class1',
|
75
|
+
content=[contents['temperature'],
|
76
|
+
contents['obj_1']],
|
77
|
+
)
|
78
|
+
|
79
|
+
mapper.register(cls_map.taxonomy_entry_key, cls, taxonomy_map=cls_map)
|
80
|
+
mapped_cls = mapper.get_mapped_class(cls_map.taxonomy_entry_key)
|
81
|
+
return mapped_cls
|
82
|
+
|
83
|
+
def create_mapped_cls_2(cls, contents: dict[str, Content]):
|
84
|
+
cls_map = TaxonomyMap(taxonomy_name='PySimultan',
|
85
|
+
taxonomy_key='PySimultan',
|
86
|
+
taxonomy_entry_name='Class2',
|
87
|
+
taxonomy_entry_key='Class2',
|
88
|
+
content=[contents['temperature'],
|
89
|
+
contents['obj_1']],
|
90
|
+
)
|
91
|
+
|
92
|
+
mapper.register(cls_map.taxonomy_entry_key, cls, taxonomy_map=cls_map)
|
93
|
+
mapped_cls = mapper.get_mapped_class(cls_map.taxonomy_entry_key)
|
94
|
+
return mapped_cls
|
95
|
+
|
96
|
+
def create_mapped_cls_3(cls, contents: dict[str, Content]):
|
97
|
+
cls_map = TaxonomyMap(taxonomy_name='PySimultan',
|
98
|
+
taxonomy_key='PySimultan',
|
99
|
+
taxonomy_entry_name='Class3',
|
100
|
+
taxonomy_entry_key='Class3',
|
101
|
+
content=[contents['temperature'],
|
102
|
+
contents['obj_1']],
|
103
|
+
)
|
104
|
+
|
105
|
+
mapper.register(cls_map.taxonomy_entry_key, cls, taxonomy_map=cls_map)
|
106
|
+
mapped_cls = mapper.get_mapped_class(cls_map.taxonomy_entry_key)
|
107
|
+
return mapped_cls
|
108
|
+
|
109
|
+
tax_contents = create_contents()
|
110
|
+
|
111
|
+
mapped_cls_1 = create_mapped_cls_1(classes['Class1'], tax_contents)
|
112
|
+
mapped_cls_2 = create_mapped_cls_2(classes['Class2'], tax_contents)
|
113
|
+
mapped_cls_3 = create_mapped_cls_3(classes['Class3'], tax_contents)
|
114
|
+
|
115
|
+
mapped_cls_dict = {'Class1': mapped_cls_1,
|
116
|
+
'Class2': mapped_cls_2,
|
117
|
+
'Class3': mapped_cls_3}
|
118
|
+
|
119
|
+
return mapped_cls_dict, mapper
|
120
|
+
|
121
|
+
|
122
|
+
def create_model():
|
123
|
+
data_model = DataModel.create_new_project(project_path=project_path,
|
124
|
+
user_name='admin',
|
125
|
+
password='admin')
|
126
|
+
classes = create_classes()
|
127
|
+
mapped_classes, mapper = create_mapped_classes(classes)
|
128
|
+
|
129
|
+
class_1 = mapped_classes['Class1']
|
130
|
+
class_2 = mapped_classes['Class2']
|
131
|
+
class_3 = mapped_classes['Class3']
|
132
|
+
|
133
|
+
obj_1 = class_1(temperature=125.15)
|
134
|
+
obj_2 = class_2(temperature=225.15, obj_1=obj_1)
|
135
|
+
obj_3 = class_3(temperature=325.15, obj_1=obj_2)
|
136
|
+
|
137
|
+
obj_1.obj_1 = obj_2
|
138
|
+
|
139
|
+
data_model.save()
|
140
|
+
|
141
|
+
data_model.cleanup()
|
142
|
+
mapper.clear()
|
143
|
+
|
144
|
+
|
145
|
+
def load_model():
|
146
|
+
mapped_cls_dict, mapper = create_mapped_classes(create_classes())
|
147
|
+
|
148
|
+
# create copy of the mapper to test mapper.copy
|
149
|
+
mapper_copy = mapper.copy()
|
150
|
+
data_model = DataModel(project_path=project_path,
|
151
|
+
user_name='admin',
|
152
|
+
password='admin')
|
153
|
+
typed_data = data_model.get_typed_data(mapper=mapper_copy, create_all=True)
|
154
|
+
class_1 = mapper.get_mapped_class('Class1')
|
155
|
+
obj_1 = list(class_1._cls_instances_dict.values())[0]
|
156
|
+
assert obj_1.obj_1.obj_1 is obj_1
|
157
|
+
return typed_data
|
158
|
+
|
159
|
+
|
160
|
+
if __name__ == '__main__':
|
161
|
+
create_model()
|
162
|
+
typed_data = load_model()
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import resources
|
2
|
-
from PySimultan2.data_model import DataModel
|
3
|
-
from PySimultan2.object_mapper import PythonMapper
|
4
|
-
from PySimultan2.taxonomy_maps import TaxonomyMap, Content
|
2
|
+
from src.PySimultan2.data_model import DataModel
|
3
|
+
from src.PySimultan2.object_mapper import PythonMapper
|
4
|
+
from src.PySimultan2.taxonomy_maps import TaxonomyMap, Content
|
5
5
|
|
6
6
|
try:
|
7
7
|
import importlib.resources as pkg_resources
|
@@ -63,3 +63,14 @@ component.set_attr_prop('value', 'ValueMax', 200)
|
|
63
63
|
|
64
64
|
data_model.save()
|
65
65
|
data_model.cleanup()
|
66
|
+
mapper.clear()
|
67
|
+
|
68
|
+
|
69
|
+
data_model = DataModel(project_path=project_path,
|
70
|
+
user_name='admin',
|
71
|
+
password='admin')
|
72
|
+
|
73
|
+
|
74
|
+
typed_data = mapper.get_typed_data(component_list=data_model.data, data_model=data_model)
|
75
|
+
|
76
|
+
pass
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/ComponentBuilder.runtimeconfig.json
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll
RENAMED
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Extensions.Options.dll
RENAMED
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Extensions.Primitives.dll
RENAMED
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.dll
RENAMED
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/Microsoft.Xaml.Behaviors.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{pysimultan-0.3.0 → pysimultan-0.3.2}/src/PySimultan2/resources/System.Net.Http.Formatting.dll
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|