PySimultan 0.5.9.1__py3-none-any.whl → 0.5.9.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
PySimultan2/__about__.py CHANGED
@@ -1 +1 @@
1
- version = '0.5.9.1'
1
+ version = '0.5.9.3'
PySimultan2/files.py CHANGED
@@ -666,14 +666,50 @@ class DirectoryInfo(object, metaclass=DirectoryInfoMetaMock):
666
666
  else:
667
667
  return None
668
668
 
669
- def add_sub_directory(self, name: str) -> DirectoryInfo:
670
- return DirectoryInfo(path=os.path.join(self.resource_entry.current_relative_path, name),
669
+ def add_sub_directory(self, dirname: str) -> DirectoryInfo:
670
+
671
+ existing = next((x for x in self.sub_directories if x.resource_entry.current_relative_path == dirname), None)
672
+ if existing is not None:
673
+ return existing
674
+
675
+ return DirectoryInfo(path=os.path.join(self.resource_entry.current_relative_path, dirname),
671
676
  data_model=self.data_model)
672
677
 
678
+ def get_sub_directory(self,
679
+ dirname: str,
680
+ create=False) -> Optional[DirectoryInfo]:
681
+ """
682
+ Get a sub directory by name.
683
+ :param dirname: directory name, relative to self.relative_path
684
+ :param create:
685
+ :return:
686
+ """
687
+
688
+ logger.debug(f'Getting sub directory in {self.relative_path}: {dirname}')
689
+ res = next((x for x in self.sub_directories if x.resource_entry.Name == dirname), None)
690
+ if not res and create:
691
+ logger.debug(f'Creating sub directory in {self.relative_path}: {dirname}')
692
+ res = self.add_sub_directory(dirname)
693
+
694
+ return res
695
+
696
+ def get_file(self, filename: str) -> Optional[FileInfo]:
697
+ resource = next((x for x in self.files if x.resource_entry.Name == filename), None)
698
+ if resource is not None:
699
+ return FileInfo(resource_entry=entry,
700
+ data_model=self.data_model)
701
+ else:
702
+ return None
703
+
673
704
  def add_file(self,
674
705
  filename: str,
675
706
  content: Optional[str] = None) -> FileInfo:
676
707
 
708
+ if self.resource_entry.Children:
709
+ file = self.get_file(filename)
710
+ if file is not None:
711
+ return file
712
+
677
713
  if content is not None:
678
714
  return FileInfo.from_string(filename=filename,
679
715
  content=content,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PySimultan
3
- Version: 0.5.9.1
3
+ Version: 0.5.9.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
@@ -1,9 +1,9 @@
1
1
  PySimultan2/CHANGELOG.md,sha256=BBfCqgFQeigrlRQdHAksDz70-0fLKjzWkHbfFjJ2eDg,361
2
- PySimultan2/__about__.py,sha256=PQD8y6NqxgcQTWZ0_8DSXDPWyJXVggB0QOB-reyq7bY,21
2
+ PySimultan2/__about__.py,sha256=07EsoeVghQ4VppBgKjlpoSsh-r0rQEwLSOZe57CHEdQ,21
3
3
  PySimultan2/__init__.py,sha256=42YM_zQUXdEjbjmgBI0nWJWsr_G6zNe7TxfFmS37mJk,3275
4
4
  PySimultan2/data_model.py,sha256=UcscVLbBaEu9UhV2iaGJnrqX51G5PyEQuoXrz41Hq9g,36126
5
5
  PySimultan2/default_types.py,sha256=K-Eka5BCKk8DT3HU5761Ym_-ZFmu1_Dro0zW0LVGoHA,27157
6
- PySimultan2/files.py,sha256=qx3I9WVW3se2qbWfN9QYQXL8kV2jZjd7HZpRGANm3-U,26040
6
+ PySimultan2/files.py,sha256=Cn8Oh9yM8q-0p-eNIUp_w53mqDCjxkUccfQQeN8DDqY,27420
7
7
  PySimultan2/multi_values.py,sha256=ZFXlTLuZo32x7_7diYAp2XEjp5uwgHLgNOzN7v74-5I,13650
8
8
  PySimultan2/object_mapper.py,sha256=_SQye38NmIr4m_-X9CuvUJnVDBmjmUDdPH2bnaxpzKY,18546
9
9
  PySimultan2/simultan_object.py,sha256=akaSUZZWIVfwx1wT5EdOgRR2UeShUthX-LE2Uk6w8CQ,19058
@@ -75,7 +75,7 @@ PySimultan2/resources/assimp.dll,sha256=HwfDwXqoPDTFRyoQpA3qmgZoUdFtziJkV5fNtktE
75
75
  PySimultan2/resources/componentmanager.user,sha256=hrzr1US4pqkFnLHXcvPkvrgGd7QvlxaV8mhS6fuikEs,760
76
76
  PySimultan2/resources/defaultsettings.xml,sha256=s6Tk1tubLz5UYqXZWpD42EDHzedemRY1nEneoIVcUfg,392
77
77
  PySimultan2/resources/setup.bat,sha256=fjvvYfVM6TalS-QTSiKAbAId5nTsk8kGGo06ba-wWaY,32
78
- pysimultan-0.5.9.1.dist-info/METADATA,sha256=r7-W3hsJ4lhzjWrkvdGUonwCEu7rXALauh6621n73uM,6138
79
- pysimultan-0.5.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
80
- pysimultan-0.5.9.1.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
- pysimultan-0.5.9.1.dist-info/RECORD,,
78
+ pysimultan-0.5.9.3.dist-info/METADATA,sha256=RIR6ykk8GjDPeTLnih0mvwWHP-pWHYR7XK55dakOJqY,6138
79
+ pysimultan-0.5.9.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
80
+ pysimultan-0.5.9.3.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
+ pysimultan-0.5.9.3.dist-info/RECORD,,