diff options
| author | jvoisin | 2022-08-28 22:29:06 +0200 |
|---|---|---|
| committer | jvoisin | 2022-08-28 22:29:06 +0200 |
| commit | cc5be8608b49d74a633b80a95a49a018d4dcd477 (patch) | |
| tree | 322c21ba2543831d5a1804ebce50a3f7c2391029 /libmat2/abstract.py | |
| parent | 292f44c0861a57b54a289641ead7e59f158e307e (diff) | |
Simplify the typing annotations
Diffstat (limited to 'libmat2/abstract.py')
| -rw-r--r-- | libmat2/abstract.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libmat2/abstract.py b/libmat2/abstract.py index 5cfd0f2..426ccfc 100644 --- a/libmat2/abstract.py +++ b/libmat2/abstract.py | |||
| @@ -1,9 +1,7 @@ | |||
| 1 | import abc | 1 | import abc |
| 2 | import os | 2 | import os |
| 3 | import re | 3 | import re |
| 4 | from typing import Set, Dict, Union | 4 | from typing import Union |
| 5 | |||
| 6 | assert Set # make pyflakes happy | ||
| 7 | 5 | ||
| 8 | 6 | ||
| 9 | class AbstractParser(abc.ABC): | 7 | class AbstractParser(abc.ABC): |
| @@ -11,8 +9,8 @@ class AbstractParser(abc.ABC): | |||
| 11 | It might yield `ValueError` on instantiation on invalid files, | 9 | It might yield `ValueError` on instantiation on invalid files, |
| 12 | and `RuntimeError` when something went wrong in `remove_all`. | 10 | and `RuntimeError` when something went wrong in `remove_all`. |
| 13 | """ | 11 | """ |
| 14 | meta_list = set() # type: Set[str] | 12 | meta_list = set() # type: set[str] |
| 15 | mimetypes = set() # type: Set[str] | 13 | mimetypes = set() # type: set[str] |
| 16 | 14 | ||
| 17 | def __init__(self, filename: str) -> None: | 15 | def __init__(self, filename: str) -> None: |
| 18 | """ | 16 | """ |
| @@ -35,7 +33,7 @@ class AbstractParser(abc.ABC): | |||
| 35 | self.sandbox = True | 33 | self.sandbox = True |
| 36 | 34 | ||
| 37 | @abc.abstractmethod | 35 | @abc.abstractmethod |
| 38 | def get_meta(self) -> Dict[str, Union[str, dict]]: | 36 | def get_meta(self) -> dict[str, Union[str, dict]]: |
| 39 | """Return all the metadata of the current file""" | 37 | """Return all the metadata of the current file""" |
| 40 | 38 | ||
| 41 | @abc.abstractmethod | 39 | @abc.abstractmethod |
