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/images.py | |
| parent | 292f44c0861a57b54a289641ead7e59f158e307e (diff) | |
Simplify the typing annotations
Diffstat (limited to 'libmat2/images.py')
| -rw-r--r-- | libmat2/images.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libmat2/images.py b/libmat2/images.py index 9c24998..37ed36c 100644 --- a/libmat2/images.py +++ b/libmat2/images.py | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | import imghdr | 1 | import imghdr |
| 2 | import os | 2 | import os |
| 3 | import re | 3 | import re |
| 4 | from typing import Set, Dict, Union, Any | 4 | from typing import Union, Any |
| 5 | 5 | ||
| 6 | import cairo | 6 | import cairo |
| 7 | 7 | ||
| @@ -13,7 +13,6 @@ from gi.repository import GdkPixbuf, GLib, Rsvg | |||
| 13 | from . import exiftool, abstract | 13 | from . import exiftool, abstract |
| 14 | 14 | ||
| 15 | # Make pyflakes happy | 15 | # Make pyflakes happy |
| 16 | assert Set | ||
| 17 | assert Any | 16 | assert Any |
| 18 | 17 | ||
| 19 | class SVGParser(exiftool.ExiftoolParser): | 18 | class SVGParser(exiftool.ExiftoolParser): |
| @@ -50,7 +49,7 @@ class SVGParser(exiftool.ExiftoolParser): | |||
| 50 | surface.finish() | 49 | surface.finish() |
| 51 | return True | 50 | return True |
| 52 | 51 | ||
| 53 | def get_meta(self) -> Dict[str, Union[str, dict]]: | 52 | def get_meta(self) -> dict[str, Union[str, dict]]: |
| 54 | meta = super().get_meta() | 53 | meta = super().get_meta() |
| 55 | 54 | ||
| 56 | # The namespace is mandatory, but only the …/2000/svg is valid. | 55 | # The namespace is mandatory, but only the …/2000/svg is valid. |
| @@ -165,8 +164,8 @@ class TiffParser(GdkPixbufAbstractParser): | |||
| 165 | class PPMParser(abstract.AbstractParser): | 164 | class PPMParser(abstract.AbstractParser): |
| 166 | mimetypes = {'image/x-portable-pixmap'} | 165 | mimetypes = {'image/x-portable-pixmap'} |
| 167 | 166 | ||
| 168 | def get_meta(self) -> Dict[str, Union[str, dict]]: | 167 | def get_meta(self) -> dict[str, Union[str, dict]]: |
| 169 | meta = {} # type: Dict[str, Union[str, Dict[Any, Any]]] | 168 | meta = {} # type: dict[str, Union[str, dict[Any, Any]]] |
| 170 | with open(self.filename) as f: | 169 | with open(self.filename) as f: |
| 171 | for idx, line in enumerate(f): | 170 | for idx, line in enumerate(f): |
| 172 | if line.lstrip().startswith('#'): | 171 | if line.lstrip().startswith('#'): |
