summaryrefslogtreecommitdiff
path: root/libmat2/images.py
diff options
context:
space:
mode:
authorjvoisin2022-08-28 22:29:06 +0200
committerjvoisin2022-08-28 22:29:06 +0200
commitcc5be8608b49d74a633b80a95a49a018d4dcd477 (patch)
tree322c21ba2543831d5a1804ebce50a3f7c2391029 /libmat2/images.py
parent292f44c0861a57b54a289641ead7e59f158e307e (diff)
Simplify the typing annotations
Diffstat (limited to 'libmat2/images.py')
-rw-r--r--libmat2/images.py9
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 @@
1import imghdr 1import imghdr
2import os 2import os
3import re 3import re
4from typing import Set, Dict, Union, Any 4from typing import Union, Any
5 5
6import cairo 6import cairo
7 7
@@ -13,7 +13,6 @@ from gi.repository import GdkPixbuf, GLib, Rsvg
13from . import exiftool, abstract 13from . import exiftool, abstract
14 14
15# Make pyflakes happy 15# Make pyflakes happy
16assert Set
17assert Any 16assert Any
18 17
19class SVGParser(exiftool.ExiftoolParser): 18class 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):
165class PPMParser(abstract.AbstractParser): 164class 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('#'):