Skip to content

Commit 88c0a73

Browse files
committed
Refactor type hints for older Python version
1 parent 9fa5ef2 commit 88c0a73

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

hooks/catalog/catalog.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import NamedTuple, Callable
1+
from typing import Optional, Callable
22

33
from .ordering import OrderedValue
44
from .apps import App, DocsApp, AppendixApp
@@ -65,7 +65,7 @@ def __get_sort_key(self, order_by: list[str]) -> Callable[[str], OrderedValue]:
6565
def __get_grouped_apps(self,
6666
groups: list[str],
6767
attr: str,
68-
callback: Callable[[App, str], bool] | None=None) -> dict:
68+
callback: Optional[Callable[[App, str], bool]]=None) -> dict:
6969
callback_fn = (callback if callback is not None
7070
else lambda app, attr, value: (value in getattr(app, attr)
7171
if hasattr(app, attr)

hooks/catalog/export.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
from pathlib import Path
3+
from typing import Union
34

45
import humps
56

@@ -177,7 +178,7 @@ def append_by_system(self, markdown):
177178

178179
# 'def export_by_license(self)' not needed.
179180

180-
def append_content(self, filepath: Path, markdown) -> str | None:
181+
def append_content(self, filepath: Path, markdown) -> Union[str, None]:
181182
attr_name = f"append_{filepath.stem}"
182183

183184
if hasattr(self, attr_name):

0 commit comments

Comments
 (0)