diff options
author | 2021-08-03 09:02:20 -0400 | |
---|---|---|
committer | 2021-08-03 09:02:20 -0400 | |
commit | 501f0d5f8e0be6bf1836eccbc50ee6fe11fd927b (patch) | |
tree | b2ba31eab8a8a7604033032726095829124e81ec | |
parent | remove redundant variable declaration (diff) |
Create Resource type annotation.
-rw-r--r-- | pydis_site/apps/resources/utils.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pydis_site/apps/resources/utils.py b/pydis_site/apps/resources/utils.py index a8aabe01..1b307ae1 100644 --- a/pydis_site/apps/resources/utils.py +++ b/pydis_site/apps/resources/utils.py @@ -1,13 +1,13 @@ import typing as t - from itertools import chain from pathlib import Path import yaml from django.conf import settings -RESOURCES_PATH = Path(settings.BASE_DIR, "pydis_site", "apps", "resources", "resources") +Resource = dict[str, t.Union[str, list[dict[str, str]], dict[str, list[str]]]] +RESOURCES_PATH = Path(settings.BASE_DIR, "pydis_site", "apps", "resources", "resources") default_categories = [ "topics", @@ -24,7 +24,7 @@ def yaml_file_matches_search(yaml_data: dict, search_terms: list[str]) -> bool: return len(matching_tags) >= len(search_terms) -def get_resources_from_search(search_categories: list[str]) -> list[dict]: +def get_resources_from_search(search_categories: list[str]) -> list[Resource]: """Returns a list of all resources that match the given search terms.""" out = [] for item in RESOURCES_PATH.rglob("*.yaml"): |