|
1 | 1 | from collections import UserDict |
2 | 2 | from collections.abc import Callable |
3 | | -from typing import Optional, Union |
| 3 | +from typing import Optional |
4 | 4 |
|
5 | 5 | from django.utils.module_loading import import_string |
6 | 6 |
|
|
10 | 10 | from dj_angles.modules import is_module_available |
11 | 11 | from dj_angles.settings import get_setting |
12 | 12 |
|
13 | | -TAG_NAME_TO_DJANGO_TEMPLATE_TAG_MAP: dict[Optional[str], Union[Callable, str]] = { |
| 13 | +TAG_NAME_TO_DJANGO_TEMPLATE_TAG_MAP: dict[str | None, Callable | str] = { |
14 | 14 | "extends": map_extends, |
15 | 15 | "block": map_block, |
16 | 16 | "verbatim": "verbatim", |
@@ -43,7 +43,7 @@ class TagMap(UserDict): |
43 | 43 | def __init__(self) -> None: |
44 | 44 | super().__init__() |
45 | 45 |
|
46 | | - self.data: dict[Optional[str], Union[Callable, str]] = TAG_NAME_TO_DJANGO_TEMPLATE_TAG_MAP.copy() |
| 46 | + self.data: dict[str | None, Callable | str] = TAG_NAME_TO_DJANGO_TEMPLATE_TAG_MAP.copy() |
47 | 47 |
|
48 | 48 | # Add bird if installed |
49 | 49 | self.add_module_mapper("django_bird", "bird", "dj_angles.mappers.map_bird") |
@@ -86,7 +86,7 @@ def import_strings(self): |
86 | 86 | except ImportError: |
87 | 87 | pass |
88 | 88 |
|
89 | | - def add_module_mapper(self, module: str, tag_name: str, mapper: Union[str, Callable]) -> None: |
| 89 | + def add_module_mapper(self, module: str, tag_name: str, mapper: str | Callable) -> None: |
90 | 90 | """Add module mappers depending on whether the module is installed or not.""" |
91 | 91 |
|
92 | 92 | if is_module_available(module): |
|
0 commit comments