From cc5be8608b49d74a633b80a95a49a018d4dcd477 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 28 Aug 2022 22:29:06 +0200 Subject: Simplify the typing annotations --- libmat2/images.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'libmat2/images.py') 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 @@ import imghdr import os import re -from typing import Set, Dict, Union, Any +from typing import Union, Any import cairo @@ -13,7 +13,6 @@ from gi.repository import GdkPixbuf, GLib, Rsvg from . import exiftool, abstract # Make pyflakes happy -assert Set assert Any class SVGParser(exiftool.ExiftoolParser): @@ -50,7 +49,7 @@ class SVGParser(exiftool.ExiftoolParser): surface.finish() return True - def get_meta(self) -> Dict[str, Union[str, dict]]: + def get_meta(self) -> dict[str, Union[str, dict]]: meta = super().get_meta() # The namespace is mandatory, but only the …/2000/svg is valid. @@ -165,8 +164,8 @@ class TiffParser(GdkPixbufAbstractParser): class PPMParser(abstract.AbstractParser): mimetypes = {'image/x-portable-pixmap'} - def get_meta(self) -> Dict[str, Union[str, dict]]: - meta = {} # type: Dict[str, Union[str, Dict[Any, Any]]] + def get_meta(self) -> dict[str, Union[str, dict]]: + meta = {} # type: dict[str, Union[str, dict[Any, Any]]] with open(self.filename) as f: for idx, line in enumerate(f): if line.lstrip().startswith('#'): -- cgit v1.3