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/pdf.py | |
| parent | 292f44c0861a57b54a289641ead7e59f158e307e (diff) | |
Simplify the typing annotations
Diffstat (limited to 'libmat2/pdf.py')
| -rw-r--r-- | libmat2/pdf.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libmat2/pdf.py b/libmat2/pdf.py index b79c7c7..24c280c 100644 --- a/libmat2/pdf.py +++ b/libmat2/pdf.py | |||
| @@ -7,7 +7,7 @@ import re | |||
| 7 | import logging | 7 | import logging |
| 8 | import tempfile | 8 | import tempfile |
| 9 | import io | 9 | import io |
| 10 | from typing import Dict, Union | 10 | from typing import Union |
| 11 | from distutils.version import LooseVersion | 11 | from distutils.version import LooseVersion |
| 12 | 12 | ||
| 13 | import cairo | 13 | import cairo |
| @@ -146,13 +146,13 @@ class PDFParser(abstract.AbstractParser): | |||
| 146 | return True | 146 | return True |
| 147 | 147 | ||
| 148 | @staticmethod | 148 | @staticmethod |
| 149 | def __parse_metadata_field(data: str) -> Dict[str, str]: | 149 | def __parse_metadata_field(data: str) -> dict[str, str]: |
| 150 | metadata = {} | 150 | metadata = {} |
| 151 | for (_, key, value) in re.findall(r"<(xmp|pdfx|pdf|xmpMM):(.+)>(.+)</\1:\2>", data, re.I): | 151 | for (_, key, value) in re.findall(r"<(xmp|pdfx|pdf|xmpMM):(.+)>(.+)</\1:\2>", data, re.I): |
| 152 | metadata[key] = value | 152 | metadata[key] = value |
| 153 | return metadata | 153 | return metadata |
| 154 | 154 | ||
| 155 | def get_meta(self) -> Dict[str, Union[str, dict]]: | 155 | def get_meta(self) -> dict[str, Union[str, dict]]: |
| 156 | """ Return a dict with all the meta of the file | 156 | """ Return a dict with all the meta of the file |
| 157 | """ | 157 | """ |
| 158 | metadata = {} | 158 | metadata = {} |
