PySimultan 0.5.0__tar.gz → 0.5.3__tar.gz
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.
- {pysimultan-0.5.0 → pysimultan-0.5.3}/PKG-INFO +1 -1
- pysimultan-0.5.3/src/PySimultan2/CHANGELOG.md +7 -0
- pysimultan-0.5.3/src/PySimultan2/__about__.py +1 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/data_model.py +49 -7
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/default_types.py +0 -4
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/files.py +55 -7
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/object_mapper.py +95 -10
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/utils.py +39 -0
- pysimultan-0.5.3/tests/test_directory_and_files.py +44 -0
- pysimultan-0.5.3/tests/test_empty_file.txt +0 -0
- pysimultan-0.5.3/tests/test_register_decorator.py +41 -0
- pysimultan-0.5.0/src/PySimultan2/__about__.py +0 -1
- {pysimultan-0.5.0 → pysimultan-0.5.3}/.gitignore +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/LICENSE.txt +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/README.md +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/pyproject.toml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/__init__.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/geometry/__init__.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/geometry/geometry_base.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/geometry/utils.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/multi_values.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/AssimpNet.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/AvalonDock.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/BruTile.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ClosedXML.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ComponentBuilder.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ComponentBuilder.dll.config +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ComponentBuilder.runtimeconfig.json +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ComponentBuilder.xml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ControlzEx.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/DocumentFormat.OpenXml.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/DotSpatial.Projections.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ExcelNumberFormat.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Fluent.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/HelixToolkit.Core.Wpf.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/HelixToolkit.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/MathNet.Numerics.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.AspNetCore.Authorization.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Extensions.Options.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Extensions.Primitives.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Xaml.Behaviors.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Newtonsoft.Json.Bson.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Newtonsoft.Json.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll.config +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll.config +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.Lang.xml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.Plugins.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.Plugins.xml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.UI.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.UI.xml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SIMULTAN.xml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SharpDX.D3DCompiler.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SharpDX.DXGI.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SharpDX.Direct2D1.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SharpDX.Direct3D11.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SharpDX.Direct3D9.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SharpDX.Mathematics.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/SharpDX.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Sprache.Calc.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Sprache.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Collections.Immutable.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Data.OleDb.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Net.Http.Formatting.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Reflection.Metadata.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Reflection.MetadataLoadContext.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/XAMLMarkupExtensions.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/__init__.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/assimp.dll +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/componentmanager.user +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/defaultsettings.xml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/setup.bat +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/simultan_object.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/taxonomy_maps.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/type_setter_lookup.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/__init__.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/__init__.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/create_component.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/create_component_with_taxonomy_slot.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/create_referenced_component.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/create_taxonomies.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/__init__.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/change_references_example.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/empty_project.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/empty_test_excel.xlsx +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/example1.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/example2.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/example3.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/example4_reference_list.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/example_extend_1.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/list_test.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_example3.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_example4.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_example_create_typed_component.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_example_create_typed_component_with_slots.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_example_extend.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_example_update_references.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_reference_list.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/U5.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/U5_1.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/U5_orig.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/__init__.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/new_geometry_test.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/new_test_file.txt +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/new_test_file2.txt +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_file.yml +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_file_load.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_file_project.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_multi_value_big_table_load.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_parameter_reference_project.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_set_dictionary.simultan +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_calc_static_zone_temperature.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_calculate_steady_state_temperature.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_circular_references.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_create_geometry.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_files.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_files_load.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_load_geometry.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_load_multi_values.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_new_dll.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_new_project_creation.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_numeric_map.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_parameter_reference.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_pythonnet.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_register_class.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_set_attr_property.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_set_dictionary.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_set_properties.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_taxonomie_maps.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_taxonomies.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/test_ui.py +0 -0
- {pysimultan-0.5.0 → pysimultan-0.5.3}/tests/ui_minimal_example.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: PySimultan
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
version = '0.5.3'
|
|
@@ -23,7 +23,7 @@ from SIMULTAN.Serializer.SimGeo import *
|
|
|
23
23
|
from SIMULTAN.Serializer.Projects import *
|
|
24
24
|
from SIMULTAN.Data.Components import SimComponent, SimComponentCollection
|
|
25
25
|
from SIMULTAN.Data.MultiValues import SimMultiValueBigTable, SimMultiValueField3D
|
|
26
|
-
from SIMULTAN.Data.Assets import ResourceEntry
|
|
26
|
+
from SIMULTAN.Data.Assets import ResourceEntry, ResourceDirectoryEntry, ResourceFileEntry, ContainedResourceFileEntry
|
|
27
27
|
from SIMULTAN.Data.Geometry import OffsetAlgorithm
|
|
28
28
|
# from GeometryViewer.Service import *
|
|
29
29
|
# from SIMULTAN.UI.Services import *
|
|
@@ -37,6 +37,7 @@ from SIMULTAN.Data.Geometry import Layer, Vertex, Edge, PEdge, Face, Volume, Edg
|
|
|
37
37
|
from System.Security import SecureString
|
|
38
38
|
from SIMULTAN.Data import SimId
|
|
39
39
|
from System import Guid
|
|
40
|
+
from System.IO import DirectoryInfo
|
|
40
41
|
from System.IO import *
|
|
41
42
|
from System.Security import *
|
|
42
43
|
from System.Security.Cryptography import *
|
|
@@ -500,19 +501,35 @@ class DataModel:
|
|
|
500
501
|
self.get_file_infos.cache_clear()
|
|
501
502
|
return new_resource
|
|
502
503
|
|
|
503
|
-
def add_empty_resource(self,
|
|
504
|
+
def add_empty_resource(self,
|
|
505
|
+
filename: str,
|
|
506
|
+
target_dir: Union[ResourceDirectoryEntry, DirectoryInfo, str] = None) -> ResourceEntry:
|
|
504
507
|
"""
|
|
505
508
|
Add an empty resource to the project
|
|
506
|
-
:param
|
|
509
|
+
:param filename: name of the new resource
|
|
510
|
+
:param target_dir: directory to add the resource
|
|
507
511
|
:return:
|
|
508
512
|
"""
|
|
509
513
|
# return self.project.AddResourceFile(FileInfo(str(filename)))
|
|
510
514
|
|
|
511
515
|
self.get_file_infos.cache_clear()
|
|
512
|
-
|
|
516
|
+
if target_dir is None:
|
|
517
|
+
return self.project.AddEmptyResource(FileInfo(str(filename)))
|
|
518
|
+
else:
|
|
519
|
+
|
|
520
|
+
if isinstance(target_dir, ResourceDirectoryEntry):
|
|
521
|
+
target_dir = target_dir.CurrentFullPath
|
|
522
|
+
if isinstance(target_dir, DirectoryInfo):
|
|
523
|
+
target_dir = target_dir.FullPath
|
|
524
|
+
|
|
525
|
+
return self.project.AddEmptyResource(FileInfo(
|
|
526
|
+
os.path.join(target_dir, str(filename))
|
|
527
|
+
)
|
|
528
|
+
)
|
|
513
529
|
|
|
514
530
|
def add_resource(self,
|
|
515
531
|
filename: Union[str, FileInfo],
|
|
532
|
+
target_dir: Optional[Union[DirectoryInfo, ResourceDirectoryEntry, str]] = None,
|
|
516
533
|
tag: Union[SimTaxonomyEntry, SimTaxonomyEntryReference] = None) -> ResourceEntry:
|
|
517
534
|
"""
|
|
518
535
|
Add a new resource to the project. The resource will be copied to the project folder and added to the project
|
|
@@ -545,9 +562,21 @@ class DataModel:
|
|
|
545
562
|
if isinstance(filename, (str, PosixPath, WindowsPath)):
|
|
546
563
|
filename = FileInfo(str(filename))
|
|
547
564
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
565
|
+
if target_dir is None:
|
|
566
|
+
resource = self.project.CopyResourceAsContainedFileEntry(filename,
|
|
567
|
+
self.project.ProjectUnpackFolder,
|
|
568
|
+
'1')
|
|
569
|
+
else:
|
|
570
|
+
if isinstance(target_dir, str):
|
|
571
|
+
target_dir = DirectoryInfo(target_dir)
|
|
572
|
+
elif isinstance(target_dir, ResourceDirectoryEntry):
|
|
573
|
+
target_dir = DirectoryInfo(target_dir.CurrentFullPath)
|
|
574
|
+
elif isinstance(target_dir, DirectoryInfo):
|
|
575
|
+
pass
|
|
576
|
+
|
|
577
|
+
resource = self.project.CopyResourceAsContainedFileEntry(filename,
|
|
578
|
+
target_dir,
|
|
579
|
+
'1')
|
|
551
580
|
|
|
552
581
|
if del_copy:
|
|
553
582
|
os.remove(str(filename))
|
|
@@ -583,6 +612,19 @@ class DataModel:
|
|
|
583
612
|
self.get_file_infos.cache_clear()
|
|
584
613
|
return success
|
|
585
614
|
|
|
615
|
+
def create_resource_directory(self,
|
|
616
|
+
name: str,
|
|
617
|
+
parent_directory: DirectoryInfo=None,
|
|
618
|
+
collision_name_format: str = '{0} ({1})') -> ResourceEntry:
|
|
619
|
+
|
|
620
|
+
if parent_directory is None:
|
|
621
|
+
new_directory = self.project.CreateResourceDirIn(name, None, collision_name_format)
|
|
622
|
+
else:
|
|
623
|
+
new_directory = self.project.CreateResourceDirIn(name, parent_directory, collision_name_format)
|
|
624
|
+
|
|
625
|
+
return new_directory
|
|
626
|
+
|
|
627
|
+
|
|
586
628
|
def add_table(self, table: SimMultiValueBigTable):
|
|
587
629
|
self.project_data_manager.ValueManager.Add(table)
|
|
588
630
|
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import xxsubtype
|
|
4
3
|
from collections.abc import Iterable
|
|
5
4
|
import numpy as np
|
|
6
|
-
import pandas as pd
|
|
7
5
|
import colorlog
|
|
8
6
|
from typing import Union, List, Type, Set, Tuple, Any, Optional
|
|
9
7
|
|
|
10
|
-
from reactivex import return_value
|
|
11
|
-
|
|
12
8
|
from .utils import (sort_slots, create_simultan_component_for_taxonomy, create_mapped_python_object,
|
|
13
9
|
set_property_to_sim_component, set_property_to_parameter, set_property_to_file_info,
|
|
14
10
|
set_property_to_list, set_property_to_value_field, set_property_to_unknown_type,
|
|
@@ -14,10 +14,12 @@ import shutil
|
|
|
14
14
|
import zipfile
|
|
15
15
|
# from System.IO import FileInfo # public FileInfo (string fileName);
|
|
16
16
|
|
|
17
|
-
from SIMULTAN.Data.Assets import ResourceEntry, ResourceFileEntry, ContainedResourceFileEntry, Asset
|
|
17
|
+
from SIMULTAN.Data.Assets import ResourceEntry, ResourceFileEntry, ContainedResourceFileEntry, Asset, ResourceDirectoryEntry
|
|
18
18
|
from SIMULTAN.Data.Taxonomy import SimTaxonomyEntry, SimTaxonomyEntryReference, SimTaxonomy
|
|
19
19
|
from SIMULTAN.Data.Components import SimComponent, ComponentMapping
|
|
20
20
|
|
|
21
|
+
from System.IO import DirectoryInfo
|
|
22
|
+
|
|
21
23
|
# from .config import default_data_model
|
|
22
24
|
|
|
23
25
|
from . import config, logger
|
|
@@ -50,7 +52,7 @@ def tempdir():
|
|
|
50
52
|
yield dir_path
|
|
51
53
|
|
|
52
54
|
|
|
53
|
-
def add_tag_to_resource(resource: Union[ResourceFileEntry, ContainedResourceFileEntry],
|
|
55
|
+
def add_tag_to_resource(resource: Union[ResourceFileEntry, ContainedResourceFileEntry, ResourceDirectoryEntry],
|
|
54
56
|
tag: Union[SimTaxonomyEntry, SimTaxonomyEntryReference]):
|
|
55
57
|
"""
|
|
56
58
|
Add a tag to an asset.
|
|
@@ -109,12 +111,14 @@ def remove_asset_from_component(comp: Union[SimComponent, SimultanObject],
|
|
|
109
111
|
def create_asset_from_string(filename: str,
|
|
110
112
|
content: str,
|
|
111
113
|
data_model: DataModel,
|
|
114
|
+
target_dir: Optional[Union[DirectoryInfo, ResourceDirectoryEntry, str]] = None,
|
|
112
115
|
tag: Optional[Union[SimTaxonomyEntry, SimTaxonomyEntryReference]] = None) -> ResourceFileEntry:
|
|
113
116
|
"""
|
|
114
117
|
Create a new asset from a string. The asset is added to the data model.
|
|
115
118
|
:param filename: Name of the file to be created. E.g. 'new_file.txt'
|
|
116
119
|
:param content: Content of the file. E.g. 'This is the content of the file.'
|
|
117
120
|
:param data_model: Data model to add the asset to.
|
|
121
|
+
:param target_dir: Target directory to add the asset to.
|
|
118
122
|
:param tag: Tag to be added to the asset.
|
|
119
123
|
:return: ResourceFileEntry
|
|
120
124
|
"""
|
|
@@ -123,10 +127,12 @@ def create_asset_from_string(filename: str,
|
|
|
123
127
|
with open(filepath, 'w') as f:
|
|
124
128
|
f.write(content)
|
|
125
129
|
|
|
126
|
-
resource = data_model.add_resource(filepath
|
|
130
|
+
resource = data_model.add_resource(filepath,
|
|
131
|
+
target_dir=target_dir)
|
|
127
132
|
|
|
128
133
|
if tag is not None:
|
|
129
|
-
add_tag_to_resource(resource,
|
|
134
|
+
add_tag_to_resource(resource,
|
|
135
|
+
tag)
|
|
130
136
|
|
|
131
137
|
return resource
|
|
132
138
|
|
|
@@ -134,12 +140,14 @@ def create_asset_from_string(filename: str,
|
|
|
134
140
|
def create_asset_from_str_io(filename: str,
|
|
135
141
|
content: io.StringIO,
|
|
136
142
|
data_model: DataModel,
|
|
143
|
+
target_dir: Optional[Union[DirectoryInfo, ResourceDirectoryEntry, str]] = None,
|
|
137
144
|
tag: Union[SimTaxonomyEntry, SimTaxonomyEntryReference] = None) -> ResourceFileEntry:
|
|
138
145
|
"""
|
|
139
146
|
Create a new asset from a string io. The asset is added to the data model.
|
|
140
147
|
:param filename: Name of the file to be created. E.g. 'new_file.txt'
|
|
141
148
|
:param content: Content of the file. E.g. 'This is the content of the file.'
|
|
142
149
|
:param data_model: Data model to add the asset to.
|
|
150
|
+
:param target_dir: Target directory to add the asset to.
|
|
143
151
|
:param tag: Tag to be added to the asset.
|
|
144
152
|
:return: ResourceFileEntry
|
|
145
153
|
"""
|
|
@@ -148,7 +156,8 @@ def create_asset_from_str_io(filename: str,
|
|
|
148
156
|
with open(filepath, 'w') as f:
|
|
149
157
|
f.write(content.getvalue())
|
|
150
158
|
|
|
151
|
-
resource = data_model.add_resource(filepath
|
|
159
|
+
resource = data_model.add_resource(filepath,
|
|
160
|
+
target_dir=target_dir)
|
|
152
161
|
|
|
153
162
|
if tag is not None:
|
|
154
163
|
add_tag_to_resource(resource, tag)
|
|
@@ -175,6 +184,32 @@ def create_asset_from_file(file_info: FileInfo,
|
|
|
175
184
|
return resource
|
|
176
185
|
|
|
177
186
|
|
|
187
|
+
def add_directory(data_model: DataModel,
|
|
188
|
+
directory: str,
|
|
189
|
+
parent_directory: Optional[Union[DirectoryInfo, ResourceDirectoryEntry, str]] = None,
|
|
190
|
+
tag: Union[SimTaxonomyEntry, SimTaxonomyEntryReference] = None) -> ResourceDirectoryEntry:
|
|
191
|
+
|
|
192
|
+
"""
|
|
193
|
+
Add a directory to the data model.
|
|
194
|
+
:param data_model:
|
|
195
|
+
:param target_dir:
|
|
196
|
+
:param tag:
|
|
197
|
+
:return:
|
|
198
|
+
"""
|
|
199
|
+
|
|
200
|
+
# create the directory
|
|
201
|
+
resource_directory_entry = data_model.create_resource_directory(parent_directory=parent_directory)
|
|
202
|
+
|
|
203
|
+
for filename in os.listdir(directory):
|
|
204
|
+
file_path = os.path.join(directory, filename)
|
|
205
|
+
resource = data_model.add_resource(file_path)
|
|
206
|
+
if tag is not None:
|
|
207
|
+
add_tag_to_resource(resource, tag)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
178
213
|
class MetaMock(type):
|
|
179
214
|
def __call__(cls, *args, **kwargs):
|
|
180
215
|
resource_entry = kwargs.get('resource_entry', None)
|
|
@@ -197,18 +232,27 @@ class FileInfo(object, metaclass=MetaMock):
|
|
|
197
232
|
@classmethod
|
|
198
233
|
def from_string(cls,
|
|
199
234
|
filename: str,
|
|
200
|
-
content: str,
|
|
235
|
+
content: str,
|
|
236
|
+
target_dir: Optional[Union[DirectoryInfo, ResourceDirectoryEntry, str]] = None,
|
|
237
|
+
*args,
|
|
238
|
+
**kwargs,
|
|
239
|
+
) -> FileInfo:
|
|
201
240
|
"""
|
|
202
241
|
Create a file info object from a string.
|
|
203
242
|
:param filename: Name of the file to be created. E.g. 'new_file.txt'
|
|
204
243
|
:param content: Content of the file. E.g. 'This is the content of the file.'
|
|
244
|
+
:param target_dir: Target directory to add the asset to.
|
|
205
245
|
:param args:
|
|
206
246
|
:param kwargs:
|
|
207
247
|
:return: FileInfo
|
|
208
248
|
"""
|
|
209
249
|
|
|
210
250
|
data_model = kwargs.get('data_model', config.get_default_data_model())
|
|
211
|
-
resource = create_asset_from_string(filename,
|
|
251
|
+
resource = create_asset_from_string(filename,
|
|
252
|
+
content,
|
|
253
|
+
target_dir=target_dir,
|
|
254
|
+
*args,
|
|
255
|
+
**kwargs)
|
|
212
256
|
|
|
213
257
|
file_info = cls(resource_entry=resource,
|
|
214
258
|
data_model=data_model)
|
|
@@ -247,6 +291,10 @@ class FileInfo(object, metaclass=MetaMock):
|
|
|
247
291
|
self.args = args
|
|
248
292
|
self.kwargs = kwargs
|
|
249
293
|
|
|
294
|
+
@property
|
|
295
|
+
def parent(self):
|
|
296
|
+
return self.resource_entry.Parent
|
|
297
|
+
|
|
250
298
|
@property
|
|
251
299
|
def key(self) -> int:
|
|
252
300
|
try:
|
|
@@ -32,9 +32,21 @@ default_taxonomy_maps = {'ComponentList': component_list_map,
|
|
|
32
32
|
|
|
33
33
|
class PythonMapper(object):
|
|
34
34
|
|
|
35
|
+
mappers = {}
|
|
36
|
+
|
|
35
37
|
def __new__(cls, *args, **kwargs):
|
|
36
38
|
instance = super(PythonMapper, cls).__new__(cls)
|
|
37
39
|
config.set_default_mapper(instance)
|
|
40
|
+
|
|
41
|
+
if kwargs.get('add_to_mappers', True):
|
|
42
|
+
initial_module_name = kwargs.get('module', 'unknown_module')
|
|
43
|
+
module_name = initial_module_name
|
|
44
|
+
i = 0
|
|
45
|
+
while module_name in cls.mappers.keys():
|
|
46
|
+
module_name = f'{initial_module_name}_{i}'
|
|
47
|
+
i+=1
|
|
48
|
+
cls.mappers[module_name] = instance
|
|
49
|
+
|
|
38
50
|
return instance
|
|
39
51
|
|
|
40
52
|
def __init__(self, *args, **kwargs):
|
|
@@ -42,6 +54,9 @@ class PythonMapper(object):
|
|
|
42
54
|
self._mapped_classes = {}
|
|
43
55
|
|
|
44
56
|
self.name = kwargs.get('name', 'PythonMapper')
|
|
57
|
+
self._module = kwargs.get('module', 'unknown_module')
|
|
58
|
+
self.submodules = kwargs.get('submodules', {})
|
|
59
|
+
|
|
45
60
|
self.registered_classes: dict[str: SimultanObject] = copy(default_registered_classes) # dict with all registered classes: {taxonomy: class}
|
|
46
61
|
|
|
47
62
|
self.undefined_registered_classes: dict[str: SimultanObject] = {} # dict with all registered classes: {taxonomy: class}
|
|
@@ -59,6 +74,18 @@ class PythonMapper(object):
|
|
|
59
74
|
self.re_register = False
|
|
60
75
|
self.load_undefined = False
|
|
61
76
|
|
|
77
|
+
@property
|
|
78
|
+
def module(self):
|
|
79
|
+
return self._module
|
|
80
|
+
|
|
81
|
+
@module.setter
|
|
82
|
+
def module(self, value):
|
|
83
|
+
if self._module != value:
|
|
84
|
+
del self.mappers[self._module]
|
|
85
|
+
|
|
86
|
+
self._module = value
|
|
87
|
+
self.mappers[value] = self
|
|
88
|
+
|
|
62
89
|
@property
|
|
63
90
|
def mapped_classes(self):
|
|
64
91
|
if len(self.registered_classes) > len(self._mapped_classes):
|
|
@@ -73,10 +100,14 @@ class PythonMapper(object):
|
|
|
73
100
|
self._mapped_classes = value
|
|
74
101
|
|
|
75
102
|
def register(self,
|
|
76
|
-
taxonomy,
|
|
77
|
-
cls,
|
|
78
|
-
re_register=
|
|
103
|
+
taxonomy: str,
|
|
104
|
+
cls: Type[Any],
|
|
105
|
+
re_register=True,
|
|
106
|
+
update_in_other_mappers=False,
|
|
79
107
|
taxonomy_map=None):
|
|
108
|
+
|
|
109
|
+
# print(f'Registering {taxonomy} with {cls} {hash(cls)}')
|
|
110
|
+
|
|
80
111
|
if not (self.re_register or re_register) and taxonomy in self.registered_classes.keys():
|
|
81
112
|
return
|
|
82
113
|
|
|
@@ -95,8 +126,27 @@ class PythonMapper(object):
|
|
|
95
126
|
self.registered_classes[taxonomy] = cls
|
|
96
127
|
self.taxonomy_maps[taxonomy] = taxonomy_map
|
|
97
128
|
|
|
129
|
+
if update_in_other_mappers:
|
|
130
|
+
self.update_from_other_mappers()
|
|
131
|
+
|
|
98
132
|
return self.get_mapped_class(taxonomy)
|
|
99
133
|
|
|
134
|
+
def update_from_other_mappers(self):
|
|
135
|
+
for mapper in self.mappers.values():
|
|
136
|
+
if mapper is not self:
|
|
137
|
+
for cls, taxonomy in mapper.registered_classes.items():
|
|
138
|
+
if cls in self.registered_classes.values():
|
|
139
|
+
key = list(filter(lambda x: mapper.registered_classes[x] == cls,
|
|
140
|
+
mapper.registered_classes)
|
|
141
|
+
)[0]
|
|
142
|
+
mapper.registered_classes[key] = cls
|
|
143
|
+
|
|
144
|
+
def update_from_submodules(self):
|
|
145
|
+
for submodule in self.submodules.values():
|
|
146
|
+
self.registered_classes.update(submodule.registered_classes)
|
|
147
|
+
self.taxonomy_maps.update(submodule.taxonomy_maps)
|
|
148
|
+
self.registered_geometry_classes.update(submodule.registered_geometry_classes)
|
|
149
|
+
|
|
100
150
|
def create_mapped_class(self, taxonomy, cls):
|
|
101
151
|
|
|
102
152
|
if any([issubclass(cls, x) for x in (SimultanObject, UserList)]):
|
|
@@ -342,19 +392,31 @@ class PythonMapper(object):
|
|
|
342
392
|
def copy(self,
|
|
343
393
|
*args,
|
|
344
394
|
**kwargs) -> 'PythonMapper':
|
|
345
|
-
|
|
395
|
+
|
|
396
|
+
orig_new_module_name = kwargs.get('module', self.module)
|
|
397
|
+
new_module_name = orig_new_module_name
|
|
398
|
+
i = 0
|
|
399
|
+
while new_module_name in self.mappers.keys():
|
|
400
|
+
new_module_name = f'copy_{i}_of_{new_module_name}'
|
|
401
|
+
i+=1
|
|
402
|
+
|
|
403
|
+
new_mapper = PythonMapper(add_to_mappers=kwargs.get('add_to_mappers', True),
|
|
404
|
+
module=new_module_name)
|
|
346
405
|
new_mapper.registered_classes = self.registered_classes
|
|
347
406
|
new_mapper.taxonomy_maps = self.taxonomy_maps
|
|
348
407
|
new_mapper.registered_geometry_classes = self.registered_geometry_classes
|
|
349
408
|
new_mapper.load_undefined = self.load_undefined
|
|
409
|
+
|
|
350
410
|
return new_mapper
|
|
351
411
|
|
|
352
412
|
def __add__(self, other: 'PythonMapper') -> 'PythonMapper':
|
|
353
|
-
new_mapper = self.copy()
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
413
|
+
# new_mapper = self.copy(add_to_mappers=True)
|
|
414
|
+
self.submodules[other.module] = other
|
|
415
|
+
self.submodules.update(other.submodules)
|
|
416
|
+
self.registered_classes.update(other.registered_classes)
|
|
417
|
+
self.taxonomy_maps.update(other.taxonomy_maps)
|
|
418
|
+
self.registered_geometry_classes.update(other.registered_geometry_classes)
|
|
419
|
+
return self
|
|
358
420
|
|
|
359
421
|
def get_mapped_class_for_python_type(self, python_type: type) -> Optional[Type[SimultanObject]]:
|
|
360
422
|
try:
|
|
@@ -366,6 +428,29 @@ class PythonMapper(object):
|
|
|
366
428
|
except IndexError:
|
|
367
429
|
return None
|
|
368
430
|
|
|
431
|
+
def __repr__(self):
|
|
432
|
+
return f'PythonMapper(module={self.module}, {len(self.registered_classes)} registered classes)'
|
|
433
|
+
|
|
369
434
|
|
|
370
435
|
if config.get_default_mapper() is None:
|
|
371
|
-
config.set_default_mapper(PythonMapper())
|
|
436
|
+
config.set_default_mapper(PythonMapper(module='default'))
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
def register(taxonomy: str,
|
|
440
|
+
taxonomy_map: TaxonomyMap,
|
|
441
|
+
re_register=True,
|
|
442
|
+
module: str = 'unknown_module') -> Any:
|
|
443
|
+
|
|
444
|
+
if module not in PythonMapper.mappers.keys():
|
|
445
|
+
PythonMapper(module=module)
|
|
446
|
+
|
|
447
|
+
mapper = PythonMapper.mappers[module]
|
|
448
|
+
|
|
449
|
+
def decorator(cls):
|
|
450
|
+
mapper.register(taxonomy,
|
|
451
|
+
cls,
|
|
452
|
+
re_register=re_register,
|
|
453
|
+
taxonomy_map=taxonomy_map)
|
|
454
|
+
return cls
|
|
455
|
+
|
|
456
|
+
return decorator
|
|
@@ -373,18 +373,27 @@ def create_parameter(value: Union[int, float, str, SimTaxonomyEntry] = 0,
|
|
|
373
373
|
raise ValueError(f'Parameter type {type(value)} not supported.')
|
|
374
374
|
|
|
375
375
|
if parameter_type == float:
|
|
376
|
+
if isinstance(value, (str, int)):
|
|
377
|
+
value = float(value)
|
|
378
|
+
|
|
376
379
|
return create_sim_double_parameter(name=name,
|
|
377
380
|
value=value,
|
|
378
381
|
slot=taxonomy_entry,
|
|
379
382
|
unit=kwargs.pop('unit', ''),
|
|
380
383
|
**kwargs)
|
|
381
384
|
elif parameter_type == int:
|
|
385
|
+
if isinstance(value, (str, float)):
|
|
386
|
+
value = int(value)
|
|
387
|
+
|
|
382
388
|
return create_sim_integer_parameter(name=name,
|
|
383
389
|
value=value,
|
|
384
390
|
slot=taxonomy_entry,
|
|
385
391
|
unit=kwargs.pop('unit', ''),
|
|
386
392
|
**kwargs)
|
|
387
393
|
elif parameter_type == str:
|
|
394
|
+
if isinstance(value, (int, float)):
|
|
395
|
+
value = str(value)
|
|
396
|
+
|
|
388
397
|
return create_sim_string_parameter(name=name,
|
|
389
398
|
value=value,
|
|
390
399
|
slot=taxonomy_entry,
|
|
@@ -1448,3 +1457,33 @@ def add_properties(prop_name: str,
|
|
|
1448
1457
|
delx.__taxonomy__ = taxonomy
|
|
1449
1458
|
|
|
1450
1459
|
return property(getx, setx, delx, "automatic created property")
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
def uncache(exclude):
|
|
1463
|
+
"""Remove package modules from cache except excluded ones.
|
|
1464
|
+
On next import they will be reloaded.
|
|
1465
|
+
|
|
1466
|
+
Args:
|
|
1467
|
+
exclude (iter<str>): Sequence of module paths.
|
|
1468
|
+
"""
|
|
1469
|
+
pkgs = []
|
|
1470
|
+
for mod in exclude:
|
|
1471
|
+
pkg = mod.split('.', 1)[0]
|
|
1472
|
+
pkgs.append(pkg)
|
|
1473
|
+
|
|
1474
|
+
to_uncache = []
|
|
1475
|
+
for mod in sys.modules:
|
|
1476
|
+
if mod in exclude:
|
|
1477
|
+
continue
|
|
1478
|
+
|
|
1479
|
+
if mod in pkgs:
|
|
1480
|
+
to_uncache.append(mod)
|
|
1481
|
+
continue
|
|
1482
|
+
|
|
1483
|
+
for pkg in pkgs:
|
|
1484
|
+
if mod.startswith(pkg + '.'):
|
|
1485
|
+
to_uncache.append(mod)
|
|
1486
|
+
break
|
|
1487
|
+
|
|
1488
|
+
for mod in to_uncache:
|
|
1489
|
+
del sys.modules[mod]
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from PySimultan2.src.PySimultan2 import DataModel
|
|
3
|
+
from PySimultan2.src.PySimultan2.files import FileInfo
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
project_dir = os.environ.get('PROJECT_DIR', '/simultan_projects')
|
|
7
|
+
if not os.path.exists(project_dir):
|
|
8
|
+
os.makedirs(project_dir)
|
|
9
|
+
|
|
10
|
+
new_data_model = DataModel.create_new_project(project_path=os.path.join(project_dir, 'test_dir_files.simultan'),
|
|
11
|
+
user_name='admin',
|
|
12
|
+
password='admin')
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
new_directory = new_data_model.create_resource_directory('test_dir')
|
|
16
|
+
new_directory2 = new_data_model.create_resource_directory('test_dir2')
|
|
17
|
+
new_directory4 = new_data_model.create_resource_directory('test_dir3')
|
|
18
|
+
|
|
19
|
+
new_data_model.add_empty_resource(filename=os.path.join(new_directory.CurrentFullPath, 'test_empty_file.txt'))
|
|
20
|
+
|
|
21
|
+
new_data_model.add_empty_resource(filename='test_empty_file2.txt',
|
|
22
|
+
target_dir=new_directory)
|
|
23
|
+
|
|
24
|
+
new_file_info0 = FileInfo.from_string(filename='test_file.txt',
|
|
25
|
+
content='This is a test file',
|
|
26
|
+
data_model=new_data_model)
|
|
27
|
+
|
|
28
|
+
new_file_info = FileInfo.from_string(filename='test_file.txt',
|
|
29
|
+
content='This is a test file',
|
|
30
|
+
target_dir=new_directory,
|
|
31
|
+
data_model=new_data_model)
|
|
32
|
+
|
|
33
|
+
new_file_info2 = FileInfo.from_string(filename='test_file2.txt',
|
|
34
|
+
content='This is a test file 2',
|
|
35
|
+
target_dir=new_directory2.current_full_path,
|
|
36
|
+
data_model=new_data_model)
|
|
37
|
+
|
|
38
|
+
# create just a file in the directory
|
|
39
|
+
with open(os.path.join(new_directory2.current_full_path, 'not_contained_test_file3.txt'), 'w') as f:
|
|
40
|
+
f.write('This is a test file 3')
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
new_data_model.save()
|
|
44
|
+
new_data_model.cleanup()
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from PySimultan2.taxonomy_maps import TaxonomyMap, Content
|
|
2
|
+
from PySimultan2.object_mapper import register
|
|
3
|
+
from PySimultan2 import PythonMapper
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
content_a = Content(text_or_key='a',
|
|
7
|
+
property_name='a',
|
|
8
|
+
type=None,
|
|
9
|
+
unit=None,
|
|
10
|
+
documentation='Property a',)
|
|
11
|
+
|
|
12
|
+
content_b = Content(text_or_key='b',
|
|
13
|
+
property_name='b',
|
|
14
|
+
type=None,
|
|
15
|
+
unit=None,
|
|
16
|
+
documentation='Property a',)
|
|
17
|
+
|
|
18
|
+
test_map = TaxonomyMap(taxonomy_name='Test',
|
|
19
|
+
taxonomy_key='Test',
|
|
20
|
+
taxonomy_entry_name='TestClass',
|
|
21
|
+
taxonomy_entry_key='TestClass',
|
|
22
|
+
content=[content_a, content_b],
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
@register(test_map.taxonomy_entry_key, taxonomy_map=test_map, re_register=True, module='test_mapper')
|
|
26
|
+
class TestClass(object):
|
|
27
|
+
|
|
28
|
+
def __init__(self, *args, **kwargs):
|
|
29
|
+
self.a = kwargs.get('a', 1)
|
|
30
|
+
self.b = kwargs.get('b', 2)
|
|
31
|
+
|
|
32
|
+
def add(self):
|
|
33
|
+
return self.a + self.b
|
|
34
|
+
|
|
35
|
+
def __repr__(self):
|
|
36
|
+
return f'TestClass(a={self.a}, b={self.b})'
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
mapped_test_cls = PythonMapper.mappers['test_mapper'].get_mapped_class('TestClass')
|
|
41
|
+
print(mapped_test_cls)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
version = '0.5.0'
|
|
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.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/ComponentBuilder.runtimeconfig.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/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
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll
RENAMED
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/HelixToolkit.SharpDX.Core.dll
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Extensions.Options.dll
RENAMED
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Extensions.Primitives.dll
RENAMED
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.WindowsAPICodePack.dll
RENAMED
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/Microsoft.Xaml.Behaviors.dll
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/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
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Collections.Immutable.dll
RENAMED
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Net.Http.Formatting.dll
RENAMED
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/src/PySimultan2/resources/System.Reflection.Metadata.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
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/create_component_with_taxonomy_slot.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/empty_project.simultan
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/example_extend_1.simultan
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_example_extend.yml
RENAMED
|
File without changes
|
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/tests/readme_examples/resources/template_reference_list.yml
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
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_multi_value_big_table_load.simultan
RENAMED
|
File without changes
|
{pysimultan-0.5.0 → pysimultan-0.5.3}/tests/resources/test_parameter_reference_project.simultan
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
|