fmu-manipulation-toolbox 1.9rc0__py3-none-any.whl → 1.9rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. fmu_manipulation_toolbox/__init__.py +0 -1
  2. fmu_manipulation_toolbox/__main__.py +1 -1
  3. fmu_manipulation_toolbox/__version__.py +1 -1
  4. fmu_manipulation_toolbox/assembly.py +8 -6
  5. fmu_manipulation_toolbox/checker.py +11 -8
  6. fmu_manipulation_toolbox/container.py +492 -206
  7. fmu_manipulation_toolbox/gui.py +45 -55
  8. fmu_manipulation_toolbox/gui_style.py +8 -0
  9. fmu_manipulation_toolbox/operations.py +184 -120
  10. fmu_manipulation_toolbox/resources/darwin64/container.dylib +0 -0
  11. fmu_manipulation_toolbox/resources/linux64/container.so +0 -0
  12. fmu_manipulation_toolbox/resources/win32/client_sm.dll +0 -0
  13. fmu_manipulation_toolbox/resources/win32/server_sm.exe +0 -0
  14. fmu_manipulation_toolbox/resources/win64/client_sm.dll +0 -0
  15. fmu_manipulation_toolbox/resources/win64/container.dll +0 -0
  16. fmu_manipulation_toolbox/resources/win64/server_sm.exe +0 -0
  17. fmu_manipulation_toolbox/split.py +8 -0
  18. {fmu_manipulation_toolbox-1.9rc0.dist-info → fmu_manipulation_toolbox-1.9rc2.dist-info}/METADATA +1 -1
  19. {fmu_manipulation_toolbox-1.9rc0.dist-info → fmu_manipulation_toolbox-1.9rc2.dist-info}/RECORD +23 -22
  20. {fmu_manipulation_toolbox-1.9rc0.dist-info → fmu_manipulation_toolbox-1.9rc2.dist-info}/WHEEL +0 -0
  21. {fmu_manipulation_toolbox-1.9rc0.dist-info → fmu_manipulation_toolbox-1.9rc2.dist-info}/entry_points.txt +0 -0
  22. {fmu_manipulation_toolbox-1.9rc0.dist-info → fmu_manipulation_toolbox-1.9rc2.dist-info}/licenses/LICENSE.txt +0 -0
  23. {fmu_manipulation_toolbox-1.9rc0.dist-info → fmu_manipulation_toolbox-1.9rc2.dist-info}/top_level.txt +0 -0
@@ -1 +0,0 @@
1
-
@@ -10,7 +10,7 @@ def gui():
10
10
 
11
11
 
12
12
  def cli():
13
- from .cli import fmutool
13
+ from .cli.fmutool import fmutool
14
14
  fmutool()
15
15
 
16
16
 
@@ -1 +1 @@
1
- 'V1.9-pre0'
1
+ 'V1.9-rc2'
@@ -101,12 +101,13 @@ class AssemblyNode:
101
101
  def add_start_value(self, fmu_filename: str, port_name: str, value: str):
102
102
  self.start_values[Port(fmu_filename, port_name)] = value
103
103
 
104
- def make_fmu(self, fmu_directory: Path, debug=False, description_pathname=None):
104
+ def make_fmu(self, fmu_directory: Path, debug=False, description_pathname=None, fmi_version=2):
105
105
  for node in self.children.values():
106
- node.make_fmu(fmu_directory, debug=debug)
106
+ node.make_fmu(fmu_directory, debug=debug, fmi_version=fmi_version)
107
107
 
108
108
  identifier = str(Path(self.name).stem)
109
- container = FMUContainer(identifier, fmu_directory, description_pathname=description_pathname)
109
+ container = FMUContainer(identifier, fmu_directory, description_pathname=description_pathname,
110
+ fmi_version=fmi_version)
110
111
 
111
112
  for fmu_name in self.fmu_names_list:
112
113
  container.get_fmu(fmu_name)
@@ -241,7 +242,7 @@ class Assembly:
241
242
 
242
243
  self.input_pathname = fmu_directory / self.filename
243
244
  self.description_pathname = self.input_pathname # For inclusion in FMU
244
- self.root = None
245
+ self.root: Optional[AssemblyNode] = None
245
246
  self.read()
246
247
 
247
248
  def add_transient_file(self, filename: str):
@@ -517,8 +518,9 @@ class Assembly:
517
518
  self.root = sdd.parse(self.description_pathname)
518
519
  self.root.name = str(self.filename.with_suffix(".fmu"))
519
520
 
520
- def make_fmu(self, dump_json=False):
521
- self.root.make_fmu(self.fmu_directory, debug=self.debug, description_pathname=self.description_pathname)
521
+ def make_fmu(self, dump_json=False, fmi_version=2):
522
+ self.root.make_fmu(self.fmu_directory, debug=self.debug, description_pathname=self.description_pathname,
523
+ fmi_version=fmi_version)
522
524
  if dump_json:
523
525
  dump_file = Path(self.input_pathname.stem + "-dump").with_suffix(".json")
524
526
  logger.info(f"Dump Json '{dump_file}'")
@@ -1,10 +1,13 @@
1
1
  import importlib.util
2
2
  import inspect
3
+ import logging
3
4
  import os
4
5
  import xmlschema
5
6
  from xmlschema.validators.exceptions import XMLSchemaValidationError
6
7
  from .operations import OperationAbstract
7
8
 
9
+ logger = logging.getLogger("fmu_manipulation_toolbox")
10
+
8
11
 
9
12
  class OperationGenericCheck(OperationAbstract):
10
13
  SUPPORTED_FMI_VERSIONS = ('2.0', '3.0')
@@ -17,7 +20,7 @@ class OperationGenericCheck(OperationAbstract):
17
20
 
18
21
  def fmi_attrs(self, attrs):
19
22
  if attrs['fmiVersion'] not in self.SUPPORTED_FMI_VERSIONS:
20
- print(f"ERROR: Expected FMI {','.join(self.SUPPORTED_FMI_VERSIONS)} versions.")
23
+ logger.error(f"Expected FMI {','.join(self.SUPPORTED_FMI_VERSIONS)} versions.")
21
24
  return
22
25
 
23
26
  fmi_name = f"fmi{attrs['fmiVersion'][0]}"
@@ -27,15 +30,15 @@ class OperationGenericCheck(OperationAbstract):
27
30
  try:
28
31
  xmlschema.validate(self.fmu.descriptor_filename, schema=xsd_filename)
29
32
  except XMLSchemaValidationError as error:
30
- print(error.reason, error.msg)
33
+ logger.error(error.reason, error.msg)
31
34
  else:
32
35
  self.compliant_with_version = attrs['fmiVersion']
33
36
 
34
37
  def closure(self):
35
38
  if self.compliant_with_version:
36
- print(f"INFO: This FMU seems to be compliant with FMI-{self.compliant_with_version}.")
39
+ logger.info(f"This FMU seems to be compliant with FMI-{self.compliant_with_version}.")
37
40
  else:
38
- print(f"ERROR: This FMU does not validate with FMI standard.")
41
+ logger.error(f"This FMU does not validate with FMI standard.")
39
42
 
40
43
 
41
44
  checker_list = [OperationGenericCheck]
@@ -44,20 +47,20 @@ checker_list = [OperationGenericCheck]
44
47
  def add_from_file(checker_filename: str):
45
48
  spec = importlib.util.spec_from_file_location(checker_filename, checker_filename)
46
49
  if not spec:
47
- print(f"ERROR: Cannot load {checker_filename}. Is this a python file?")
50
+ logger.error(f"Cannot load '{checker_filename}'. Is this a python file?")
48
51
  return
49
52
  try:
50
53
  checker_module = importlib.util.module_from_spec(spec)
51
54
  try:
52
55
  spec.loader.exec_module(checker_module)
53
56
  except (ModuleNotFoundError, SyntaxError) as error:
54
- print(f"ERROR: Cannot load {checker_filename}: {error})")
57
+ logger.error(f"Cannot load '{checker_filename}': {error})")
55
58
  return
56
59
 
57
60
  for checker_name, checker_class in inspect.getmembers(checker_module, inspect.isclass):
58
61
  if OperationAbstract in checker_class.__bases__:
59
62
  checker_list.append(checker_class)
60
- print(f"Adding checker: {checker_filename}|{checker_name}")
63
+ logger.info(f"Adding checker: {checker_filename}|{checker_name}")
61
64
 
62
65
  except AttributeError:
63
- print(f"ERROR: {checker_filename} should implement class 'OperationCheck'")
66
+ logger.error(f"'{checker_filename}' should implement class 'OperationCheck'")