From 39fb254e019c920516bb317d4b48a8de7cac850e Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 28 Jan 2023 15:57:20 +0000 Subject: Fix the type annotations --- libmat2/pdf.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libmat2/pdf.py') diff --git a/libmat2/pdf.py b/libmat2/pdf.py index 63ed9c1..8c3055f 100644 --- a/libmat2/pdf.py +++ b/libmat2/pdf.py @@ -7,7 +7,7 @@ import re import logging import tempfile import io -from typing import Union +from typing import Union, Dict import cairo import gi @@ -18,6 +18,7 @@ from . import abstract FIXED_PDF_VERSION = cairo.PDFVersion.VERSION_1_5 + class PDFParser(abstract.AbstractParser): mimetypes = {'application/pdf', } meta_list = {'author', 'creation-date', 'creator', 'format', 'keywords', @@ -140,13 +141,13 @@ class PDFParser(abstract.AbstractParser): return True @staticmethod - def __parse_metadata_field(data: str) -> dict[str, str]: + def __parse_metadata_field(data: str) -> Dict[str, str]: metadata = {} for (_, key, value) in re.findall(r"<(xmp|pdfx|pdf|xmpMM):(.+)>(.+)", data, re.I): metadata[key] = value return metadata - def get_meta(self) -> dict[str, Union[str, dict]]: + def get_meta(self) -> Dict[str, Union[str, Dict]]: """ Return a dict with all the meta of the file """ metadata = {} -- cgit v1.3