defined shorthands

This commit is contained in:
Hellow2 2023-03-29 15:22:18 +02:00
parent 3238f944b3
commit f4047b91c1

View File

@ -1,9 +1,13 @@
from typing import Tuple, Type
from typing import Tuple, Type, Dict
from ..abstract import Page
from ..encyclopaedia_metallum import EncyclopaediaMetallum
from ..musify import Musify
page_names: Dict[str, Type[Page]] = dict()
shorthand_of_page: Dict[Type[Page], str] = dict()
ALL_PAGES: Tuple[Type[Page]] = (
EncyclopaediaMetallum,
Musify
@ -17,3 +21,10 @@ SHADY_PAGES: Tuple[Type[Page]] = (
Musify,
)
SHORTHANDS = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z')
for i, page in enumerate(ALL_PAGES):
page_names[page.__name__] = page
page_names[SHORTHANDS[i]] = page
shorthand_of_page[page] = SHORTHANDS[i]