Skip to content

Commit

Permalink
Fix incompatibility of PathLike type signature between python interpr…
Browse files Browse the repository at this point in the history
…eter and mypy linter type checking.

Signed-off-by: Michael Hahn <[email protected]>
  • Loading branch information
hahm1c committed Sep 2, 2024
1 parent ce1fbe4 commit 3370a83
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions odxtools/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self) -> None:
self._comparam_subsets = NamedItemList[ComparamSubset]()
self._comparam_specs = NamedItemList[ComparamSpec]()

def add_pdx_file(self, pdx_file: Union[str, PathLike, IO[bytes], ZipFile]) -> None:
def add_pdx_file(self, pdx_file: Union[str, "PathLike[Any]", IO[bytes], ZipFile]) -> None:
"""Add PDX file to database.
Either pass the path to the file, an IO with the file content or a ZipFile object.
"""
Expand All @@ -57,11 +57,11 @@ def add_pdx_file(self, pdx_file: Union[str, PathLike, IO[bytes], ZipFile]) -> No
elif p.name.lower() != "index.xml":
self.add_auxiliary_file(zip_member, pdx_zip.open(zip_member))

def add_odx_file(self, odx_file_name: Union[str, PathLike]) -> None:
def add_odx_file(self, odx_file_name: Union[str, "PathLike[Any]"]) -> None:
self._process_xml_tree(ElementTree.parse(odx_file_name).getroot())

def add_auxiliary_file(self,
aux_file_name: Union[str, PathLike],
aux_file_name: Union[str, "PathLike[Any]"],
aux_file_obj: Optional[IO[bytes]] = None) -> None:
if aux_file_obj is None:
aux_file_obj = open(aux_file_name, "rb")
Expand Down

0 comments on commit 3370a83

Please sign in to comment.