diff options
| author | jvoisin | 2023-01-28 17:22:26 +0100 |
|---|---|---|
| committer | jvoisin | 2023-01-28 17:22:26 +0100 |
| commit | 3cb3f58084043533a55c72c43453692ba972d864 (patch) | |
| tree | 473767b2bdbf6238a30356fb8aa3512669d681a8 /libmat2 | |
| parent | 39fb254e019c920516bb317d4b48a8de7cac850e (diff) | |
Another typing pass
Diffstat (limited to 'libmat2')
| -rw-r--r-- | libmat2/archive.py | 4 | ||||
| -rw-r--r-- | libmat2/bubblewrap.py | 2 | ||||
| -rw-r--r-- | libmat2/office.py | 6 | ||||
| -rw-r--r-- | libmat2/parser_factory.py | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/libmat2/archive.py b/libmat2/archive.py index cbedcd2..76679e6 100644 --- a/libmat2/archive.py +++ b/libmat2/archive.py | |||
| @@ -128,7 +128,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): | |||
| 128 | # pylint: disable=unused-argument | 128 | # pylint: disable=unused-argument |
| 129 | return member | 129 | return member |
| 130 | 130 | ||
| 131 | def get_meta(self) -> dict[str, Union[str, Dict]]: | 131 | def get_meta(self) -> Dict[str, Union[str, Dict]]: |
| 132 | meta = dict() # type: Dict[str, Union[str, Dict]] | 132 | meta = dict() # type: Dict[str, Union[str, Dict]] |
| 133 | 133 | ||
| 134 | with self.archive_class(self.filename) as zin: | 134 | with self.archive_class(self.filename) as zin: |
| @@ -170,7 +170,7 @@ class ArchiveBasedAbstractParser(abstract.AbstractParser): | |||
| 170 | 170 | ||
| 171 | # Sort the items to process, to reduce fingerprinting, | 171 | # Sort the items to process, to reduce fingerprinting, |
| 172 | # and keep them in the `items` variable. | 172 | # and keep them in the `items` variable. |
| 173 | items = list() # type: list[ArchiveMember] | 173 | items = list() # type: List[ArchiveMember] |
| 174 | for item in sorted(self._get_all_members(zin), key=self._get_member_name): | 174 | for item in sorted(self._get_all_members(zin), key=self._get_member_name): |
| 175 | # Some fileformats do require to have the `mimetype` file | 175 | # Some fileformats do require to have the `mimetype` file |
| 176 | # as the first file in the archive. | 176 | # as the first file in the archive. |
diff --git a/libmat2/bubblewrap.py b/libmat2/bubblewrap.py index e59f111..ab6867e 100644 --- a/libmat2/bubblewrap.py +++ b/libmat2/bubblewrap.py | |||
| @@ -78,7 +78,7 @@ def _get_bwrap_args(tempdir: str, | |||
| 78 | return args | 78 | return args |
| 79 | 79 | ||
| 80 | 80 | ||
| 81 | def run(args: list[str], | 81 | def run(args: List[str], |
| 82 | input_filename: str, | 82 | input_filename: str, |
| 83 | output_filename: Optional[str] = None, | 83 | output_filename: Optional[str] = None, |
| 84 | **kwargs) -> subprocess.CompletedProcess: | 84 | **kwargs) -> subprocess.CompletedProcess: |
diff --git a/libmat2/office.py b/libmat2/office.py index 87a0b7e..f0ab404 100644 --- a/libmat2/office.py +++ b/libmat2/office.py | |||
| @@ -148,7 +148,7 @@ class MSOfficeParser(ZipParser): | |||
| 148 | return False | 148 | return False |
| 149 | xml_data = zin.read('[Content_Types].xml') | 149 | xml_data = zin.read('[Content_Types].xml') |
| 150 | 150 | ||
| 151 | self.content_types = dict() # type: dict[str, str] | 151 | self.content_types = dict() # type: Dict[str, str] |
| 152 | try: | 152 | try: |
| 153 | tree = ET.fromstring(xml_data) | 153 | tree = ET.fromstring(xml_data) |
| 154 | except ET.ParseError: | 154 | except ET.ParseError: |
| @@ -429,7 +429,7 @@ class MSOfficeParser(ZipParser): | |||
| 429 | 429 | ||
| 430 | return True | 430 | return True |
| 431 | 431 | ||
| 432 | def _specific_get_meta(self, full_path: str, file_path: str) -> dict[str, Any]: | 432 | def _specific_get_meta(self, full_path: str, file_path: str) -> Dict[str, Any]: |
| 433 | """ | 433 | """ |
| 434 | Yes, I know that parsing xml with regexp ain't pretty, | 434 | Yes, I know that parsing xml with regexp ain't pretty, |
| 435 | be my guest and fix it if you want. | 435 | be my guest and fix it if you want. |
| @@ -509,7 +509,7 @@ class LibreOfficeParser(ZipParser): | |||
| 509 | return False | 509 | return False |
| 510 | return True | 510 | return True |
| 511 | 511 | ||
| 512 | def _specific_get_meta(self, full_path: str, file_path: str) -> dict[str, Any]: | 512 | def _specific_get_meta(self, full_path: str, file_path: str) -> Dict[str, Any]: |
| 513 | """ | 513 | """ |
| 514 | Yes, I know that parsing xml with regexp ain't pretty, | 514 | Yes, I know that parsing xml with regexp ain't pretty, |
| 515 | be my guest and fix it if you want. | 515 | be my guest and fix it if you want. |
diff --git a/libmat2/parser_factory.py b/libmat2/parser_factory.py index 4527b88..95066d6 100644 --- a/libmat2/parser_factory.py +++ b/libmat2/parser_factory.py | |||
| @@ -2,7 +2,7 @@ import glob | |||
| 2 | import os | 2 | import os |
| 3 | import mimetypes | 3 | import mimetypes |
| 4 | import importlib | 4 | import importlib |
| 5 | from typing import TypeVar, Optional | 5 | from typing import TypeVar, Optional, List |
| 6 | 6 | ||
| 7 | from . import abstract, UNSUPPORTED_EXTENSIONS | 7 | from . import abstract, UNSUPPORTED_EXTENSIONS |
| 8 | 8 | ||
| @@ -34,7 +34,7 @@ def __load_all_parsers(): | |||
| 34 | __load_all_parsers() | 34 | __load_all_parsers() |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | def _get_parsers() -> list[T]: | 37 | def _get_parsers() -> List[T]: |
| 38 | """ Get all our parsers!""" | 38 | """ Get all our parsers!""" |
| 39 | def __get_parsers(cls): | 39 | def __get_parsers(cls): |
| 40 | return cls.__subclasses__() + \ | 40 | return cls.__subclasses__() + \ |
