From 73171d5a49c018e029f63ff6b5eb3736bbc709fd Mon Sep 17 00:00:00 2001 From: Joseph Banks Date: Sat, 6 Jul 2019 23:51:09 +0100 Subject: Docstrings & prefix category info files with underscore for prominence --- pydis_site/apps/home/resources/books/_category_info.yaml | 2 ++ pydis_site/apps/home/resources/books/category_info.yaml | 2 -- .../apps/home/resources/communities/_category_info.yaml | 2 ++ .../apps/home/resources/communities/category_info.yaml | 2 -- pydis_site/apps/home/resources/editors/_category_info.yaml | 2 ++ pydis_site/apps/home/resources/editors/category_info.yaml | 2 -- pydis_site/apps/home/resources/ides/_category_info.yaml | 2 ++ pydis_site/apps/home/resources/ides/category_info.yaml | 2 -- .../interactive_learning_tools/_category_info.yaml | 3 +++ .../interactive_learning_tools/category_info.yaml | 3 --- pydis_site/apps/home/resources/misc/_category_info.yaml | 2 ++ pydis_site/apps/home/resources/misc/category_info.yaml | 2 -- .../apps/home/resources/podcasts/_category_info.yaml | 2 ++ pydis_site/apps/home/resources/podcasts/category_info.yaml | 2 -- .../apps/home/resources/tutorials/_category_info.yaml | 3 +++ .../apps/home/resources/tutorials/category_info.yaml | 3 --- pydis_site/utils/resources.py | 14 ++++++++++++-- 17 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 pydis_site/apps/home/resources/books/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/books/category_info.yaml create mode 100644 pydis_site/apps/home/resources/communities/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/communities/category_info.yaml create mode 100644 pydis_site/apps/home/resources/editors/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/editors/category_info.yaml create mode 100644 pydis_site/apps/home/resources/ides/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/ides/category_info.yaml create mode 100644 pydis_site/apps/home/resources/interactive_learning_tools/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/interactive_learning_tools/category_info.yaml create mode 100644 pydis_site/apps/home/resources/misc/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/misc/category_info.yaml create mode 100644 pydis_site/apps/home/resources/podcasts/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/podcasts/category_info.yaml create mode 100644 pydis_site/apps/home/resources/tutorials/_category_info.yaml delete mode 100644 pydis_site/apps/home/resources/tutorials/category_info.yaml (limited to 'pydis_site') diff --git a/pydis_site/apps/home/resources/books/_category_info.yaml b/pydis_site/apps/home/resources/books/_category_info.yaml new file mode 100644 index 00000000..e3b89ad3 --- /dev/null +++ b/pydis_site/apps/home/resources/books/_category_info.yaml @@ -0,0 +1,2 @@ +description: The best books for learning Python or Python Frameworks +name: Books diff --git a/pydis_site/apps/home/resources/books/category_info.yaml b/pydis_site/apps/home/resources/books/category_info.yaml deleted file mode 100644 index e3b89ad3..00000000 --- a/pydis_site/apps/home/resources/books/category_info.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: The best books for learning Python or Python Frameworks -name: Books diff --git a/pydis_site/apps/home/resources/communities/_category_info.yaml b/pydis_site/apps/home/resources/communities/_category_info.yaml new file mode 100644 index 00000000..eccb8b80 --- /dev/null +++ b/pydis_site/apps/home/resources/communities/_category_info.yaml @@ -0,0 +1,2 @@ +description: Partnered communities that share part of our mission +name: Communities diff --git a/pydis_site/apps/home/resources/communities/category_info.yaml b/pydis_site/apps/home/resources/communities/category_info.yaml deleted file mode 100644 index eccb8b80..00000000 --- a/pydis_site/apps/home/resources/communities/category_info.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: Partnered communities that share part of our mission -name: Communities diff --git a/pydis_site/apps/home/resources/editors/_category_info.yaml b/pydis_site/apps/home/resources/editors/_category_info.yaml new file mode 100644 index 00000000..f8dc1413 --- /dev/null +++ b/pydis_site/apps/home/resources/editors/_category_info.yaml @@ -0,0 +1,2 @@ +description: Lightweight code editors supporting Python +name: Editors diff --git a/pydis_site/apps/home/resources/editors/category_info.yaml b/pydis_site/apps/home/resources/editors/category_info.yaml deleted file mode 100644 index f8dc1413..00000000 --- a/pydis_site/apps/home/resources/editors/category_info.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: Lightweight code editors supporting Python -name: Editors diff --git a/pydis_site/apps/home/resources/ides/_category_info.yaml b/pydis_site/apps/home/resources/ides/_category_info.yaml new file mode 100644 index 00000000..d331c95d --- /dev/null +++ b/pydis_site/apps/home/resources/ides/_category_info.yaml @@ -0,0 +1,2 @@ +description: Fully-integrated development environments for serious Python work +name: IDEs diff --git a/pydis_site/apps/home/resources/ides/category_info.yaml b/pydis_site/apps/home/resources/ides/category_info.yaml deleted file mode 100644 index d331c95d..00000000 --- a/pydis_site/apps/home/resources/ides/category_info.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: Fully-integrated development environments for serious Python work -name: IDEs diff --git a/pydis_site/apps/home/resources/interactive_learning_tools/_category_info.yaml b/pydis_site/apps/home/resources/interactive_learning_tools/_category_info.yaml new file mode 100644 index 00000000..08501627 --- /dev/null +++ b/pydis_site/apps/home/resources/interactive_learning_tools/_category_info.yaml @@ -0,0 +1,3 @@ +description: Learn Python with interactive content like courses, games and programming + challenges. +name: Interactive Learning Tools diff --git a/pydis_site/apps/home/resources/interactive_learning_tools/category_info.yaml b/pydis_site/apps/home/resources/interactive_learning_tools/category_info.yaml deleted file mode 100644 index 08501627..00000000 --- a/pydis_site/apps/home/resources/interactive_learning_tools/category_info.yaml +++ /dev/null @@ -1,3 +0,0 @@ -description: Learn Python with interactive content like courses, games and programming - challenges. -name: Interactive Learning Tools diff --git a/pydis_site/apps/home/resources/misc/_category_info.yaml b/pydis_site/apps/home/resources/misc/_category_info.yaml new file mode 100644 index 00000000..4fdc4bf7 --- /dev/null +++ b/pydis_site/apps/home/resources/misc/_category_info.yaml @@ -0,0 +1,2 @@ +description: Resources which do not fit into the other categories +name: Miscellaneous diff --git a/pydis_site/apps/home/resources/misc/category_info.yaml b/pydis_site/apps/home/resources/misc/category_info.yaml deleted file mode 100644 index 4fdc4bf7..00000000 --- a/pydis_site/apps/home/resources/misc/category_info.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: Resources which do not fit into the other categories -name: Miscellaneous diff --git a/pydis_site/apps/home/resources/podcasts/_category_info.yaml b/pydis_site/apps/home/resources/podcasts/_category_info.yaml new file mode 100644 index 00000000..a0f9025c --- /dev/null +++ b/pydis_site/apps/home/resources/podcasts/_category_info.yaml @@ -0,0 +1,2 @@ +description: Notable podcasts about the Python ecosystem +name: Podcasts diff --git a/pydis_site/apps/home/resources/podcasts/category_info.yaml b/pydis_site/apps/home/resources/podcasts/category_info.yaml deleted file mode 100644 index a0f9025c..00000000 --- a/pydis_site/apps/home/resources/podcasts/category_info.yaml +++ /dev/null @@ -1,2 +0,0 @@ -description: Notable podcasts about the Python ecosystem -name: Podcasts diff --git a/pydis_site/apps/home/resources/tutorials/_category_info.yaml b/pydis_site/apps/home/resources/tutorials/_category_info.yaml new file mode 100644 index 00000000..a9adc106 --- /dev/null +++ b/pydis_site/apps/home/resources/tutorials/_category_info.yaml @@ -0,0 +1,3 @@ +description: Tutorials and references for those that are just getting started with + python +name: Tutorials diff --git a/pydis_site/apps/home/resources/tutorials/category_info.yaml b/pydis_site/apps/home/resources/tutorials/category_info.yaml deleted file mode 100644 index a9adc106..00000000 --- a/pydis_site/apps/home/resources/tutorials/category_info.yaml +++ /dev/null @@ -1,3 +0,0 @@ -description: Tutorials and references for those that are just getting started with - python -name: Tutorials diff --git a/pydis_site/utils/resources.py b/pydis_site/utils/resources.py index 582df7f7..875c0dc9 100644 --- a/pydis_site/utils/resources.py +++ b/pydis_site/utils/resources.py @@ -14,6 +14,9 @@ class URL: class Resource: + """ + A class representing a resource on the resource page + """ description: str name: str payment: str @@ -40,6 +43,9 @@ class Resource: class Category: + """ + A class representing a resource on the resources page + """ resources: typing.List[Resource] name: str description: str @@ -51,7 +57,7 @@ class Category: def construct_from_directory(cls, directory: str) -> Category: # noqa category = cls() - with open(f"{directory}/category_info.yaml") as category_info: + with open(f"{directory}/_category_info.yaml") as category_info: category_data = yaml.safe_load(category_info) category.__dict__.update(category_data) @@ -59,7 +65,7 @@ class Category: category.resources = [] for resource in glob.glob(f"{directory}/*.yaml"): - if resource == f"{directory}/category_info.yaml": + if resource == f"{directory}/_category_info.yaml": continue with open(resource) as res_file: @@ -71,6 +77,10 @@ class Category: def load_categories(order: typing.List[str]) -> typing.List[Category]: + """ + Load the categories specified in the order list and return them + as a list. + """ categories = [] for cat in order: direc = "pydis_site/apps/home/resources/" + cat -- cgit v1.2.3