Skip to content

Commit f418e38

Browse files
committed
delete Failsafeconfigurable
1 parent c592926 commit f418e38

1 file changed

Lines changed: 5 additions & 37 deletions

File tree

sdk/basyx/aas/adapter/aasx.py

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,39 +45,7 @@
4545
RELATIONSHIP_TYPE_AAS_SUPL = "http://admin-shell.io/aasx/relationships/aas-suppl"
4646

4747

48-
class FailsafeConfigurable:
49-
"""
50-
A base class for enabling or disabling failsafe behavior in readers, writers,
51-
or other components that perform parsing or serialization.
52-
53-
This class provides a standard mechanism to configure and access a `failsafe` flag
54-
that can be used to control whether errors should raise exceptions or be handled
55-
more leniently (e.g., logged and skipped).
56-
57-
Subclasses can use the `failsafe` attribute directly or call `set_failsafe()` to update it.
58-
59-
:param failsafe: If ``True``, operate in failsafe mode by suppressing exceptions and logging errors instead.
60-
If ``False``, raise exceptions on critical issues.
61-
"""
62-
63-
def __init__(self, failsafe: bool = True):
64-
"""
65-
Initialize the failsafe configuration.
66-
67-
:param failsafe: Initial value for the failsafe behavior.
68-
"""
69-
self.failsafe = failsafe
70-
71-
def set_failsafe(self, enabled: bool):
72-
"""
73-
Enable or disable failsafe behavior.
74-
75-
:param enabled: If ``True``, enables failsafe mode. If ``False``, disables it.
76-
"""
77-
self.failsafe = enabled
78-
79-
80-
class AASXReader(FailsafeConfigurable):
48+
class AASXReader():
8149
"""
8250
An AASXReader wraps an existing AASX package file to allow reading its contents and metadata.
8351
@@ -106,7 +74,7 @@ def __init__(self, file: Union[os.PathLike, str, IO], failsafe: bool = True):
10674
:raises FileNotFoundError: If the file does not exist
10775
:raises ValueError: If the file is not a valid OPC zip package
10876
"""
109-
super().__init__(failsafe)
77+
self.failsafe = failsafe
11078
try:
11179
logger.debug("Opening {} as AASX pacakge for reading ...".format(file))
11280
self.reader = pyecma376_2.ZipPackageReader(file)
@@ -310,7 +278,7 @@ def _collect_supplementary_files(self, part_name: str, submodel: model.Submodel,
310278
element.value = final_name
311279

312280

313-
class AASXWriter(FailsafeConfigurable):
281+
class AASXWriter():
314282
"""
315283
An AASXWriter wraps a new AASX package file to write its contents to it piece by piece.
316284
@@ -352,7 +320,7 @@ def __init__(self, file: Union[os.PathLike, str, IO], failsafe: bool = True):
352320
logged instead of causing exceptions. Defect objects are skipped.
353321
:param file: filename, path, or binary file handle opened for writing
354322
"""
355-
super().__init__(failsafe)
323+
self.failsafe = failsafe
356324
# names of aas-spec parts, used by `_write_aasx_origin_relationships()`
357325
self._aas_part_names: List[str] = []
358326
# name of the thumbnail part (if any)
@@ -431,7 +399,7 @@ def write_aas(self,
431399
f"{aas!r}")
432400
except (KeyError, TypeError) as e:
433401
if self.failsafe:
434-
logger.warning(f"Skipping AAS {aas_id}: {e}")
402+
logger.error(f"Skipping AAS {aas_id}: {e}")
435403
continue
436404
else:
437405
raise

0 commit comments

Comments
 (0)