Skip to content

Commit b17f4f8

Browse files
committed
Fix wrong path reference and too long line errors
1 parent dde891f commit b17f4f8

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

sdk/basyx/aas/adapter/aasx.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ def _parse_aas_part(self, part_name: str, **kwargs) -> model.DictObjectStore:
263263
raise ValueError(error_message)
264264
return model.DictObjectStore()
265265

266-
def _collect_supplementary_files(self, part_name: str, root_element: Union[model.AssetAdministrationShell, model.Submodel],
266+
def _collect_supplementary_files(self, part_name: str,
267+
root_element: Union[model.AssetAdministrationShell, model.Submodel],
267268
file_store: "AbstractSupplementaryFileContainer") -> None:
268269
"""
269270
Helper function to search File objects within a single parsed AssetAdministrationShell or Submodel.
@@ -277,7 +278,9 @@ def _collect_supplementary_files(self, part_name: str, root_element: Union[model
277278
if isinstance(root_element, model.AssetAdministrationShell):
278279
if (root_element.asset_information.default_thumbnail and
279280
root_element.asset_information.default_thumbnail.path):
280-
file_name = self._add_supplementary_file(part_name, root_element.asset_information.default_thumbnail.path, file_store)
281+
file_name = self._add_supplementary_file(part_name,
282+
root_element.asset_information.default_thumbnail.path,
283+
file_store)
281284
if file_name:
282285
root_element.asset_information.default_thumbnail.path = file_name
283286
if isinstance(root_element, model.Submodel):
@@ -292,7 +295,8 @@ def _collect_supplementary_files(self, part_name: str, root_element: Union[model
292295
def _add_supplementary_file(self, part_name: str, file_path: str,
293296
file_store: "AbstractSupplementaryFileContainer") -> Optional[str]:
294297
"""
295-
Helper function to extract a single referenced supplementary file and return the absolute path within the AASX package.
298+
Helper function to extract a single referenced supplementary file
299+
and return the absolute path within the AASX package.
296300
297301
:param part_name: The OPC part name of the part the root_element has been parsed from. This is used to resolve
298302
relative file paths.
@@ -304,13 +308,13 @@ def _add_supplementary_file(self, part_name: str, file_path: str,
304308
# to refer to files within the AASX package. Thus, we must skip all other types of URIs (esp. absolute
305309
# URIs and network-path references)
306310
if file_path.startswith('//') or ':' in file_path.split('/')[0]:
307-
logger.info(f"Skipping supplementary file {file_path}, since it seems to be an absolute URI or network-path URI reference")
311+
logger.info(f"Skipping supplementary file {file_path}, since it seems to be an absolute URI or "
312+
f"network-path URI reference")
308313
return None
309314
absolute_name = pyecma376_2.package_model.part_realpath(file_path, part_name)
310315
logger.debug(f"Reading supplementary file {absolute_name} from AASX package ...")
311316
with self.reader.open_part(absolute_name) as p:
312-
final_name = file_store.add_file(absolute_name, p,
313-
self.reader.get_content_type(absolute_name))
317+
final_name = file_store.add_file(absolute_name, p, self.reader.get_content_type(absolute_name))
314318
return final_name
315319

316320

@@ -566,7 +570,7 @@ def write_all_aas_objects(self,
566570
:class:`~basyx.aas.model.submodel.Submodel` objects, supplementary files which are referenced by
567571
:class:`~basyx.aas.model.submodel.File` objects within those Submodels, are fetched from the ``file_store``
568572
and added to the AASX package. If the ObjectStore contains a thumbnail referenced by
569-
:class:`~basyx.aas.model.aas.AssetInformation.default_thumbnail`, it is also added to the AASX package.
573+
:attr:`~basyx.aas.model.aas.AssetInformation.default_thumbnail`, it is also added to the AASX package.
570574
571575
.. attention::
572576

0 commit comments

Comments
 (0)