From e03269e37be59473823f87ae96432a75c68af184 Mon Sep 17 00:00:00 2001 From: Jack Morgan Date: Wed, 21 Jun 2017 12:31:57 +1200 Subject: [PATCH] Updates based off PR reviews --- csunplugged/general/urls.py | 4 ++-- .../management/commands/_ResourcesLoader.py | 4 ++-- csunplugged/resources/models.py | 2 +- csunplugged/resources/views/binary_cards.py | 12 ++++++------ csunplugged/resources/views/binary_cards_small.py | 12 ++++++------ csunplugged/resources/views/binary_to_alphabet.py | 10 +++++----- csunplugged/resources/views/binary_windows.py | 12 ++++++------ .../resources/views/generate_resource_pdf.py | 12 ++++++------ csunplugged/resources/views/modulo_clock.py | 6 +++--- csunplugged/resources/views/parity_cards.py | 12 ++++++------ csunplugged/resources/views/sorting_network.py | 14 +++++++------- .../resources/views/sorting_network_cards.py | 12 ++++++------ csunplugged/resources/views/treasure_hunt.py | 12 ++++++------ .../templates/resources/base-resource-pdf.html | 5 +++-- .../programming-challenge-language-solution.html | 2 +- .../templates/topics/topic-other-resources.html | 2 +- .../binary-numbers/unit-plan/lessons/lessons.yaml | 4 +--- .../curriculum-integrations.yaml | 2 +- .../unit-plan/lessons/lessons.yaml | 3 +-- .../topics/management/commands/_AgeGroupsLoader.py | 6 +++--- .../management/commands/_CurriculumAreasLoader.py | 4 ++-- .../commands/_CurriculumIntegrationsLoader.py | 6 +++--- .../management/commands/_GlossaryTermsLoader.py | 6 +++--- .../management/commands/_LearningOutcomesLoader.py | 4 ++-- .../topics/management/commands/_LessonsLoader.py | 7 ++++--- .../commands/_ProgrammingChallengesLoader.py | 9 +++++---- .../_ProgrammingChallengesStructureLoader.py | 4 ++-- .../topics/management/commands/_TopicLoader.py | 4 ++-- .../topics/management/commands/_UnitPlanLoader.py | 6 +++--- csunplugged/topics/models.py | 2 +- csunplugged/topics/urls.py | 12 ++++++------ csunplugged/topics/views.py | 3 +++ csunplugged/utils/BaseLoader.py | 2 ++ csunplugged/utils/check_required_files.py | 2 +- .../utils/resource_valid_test_configurations.py | 4 +++- setup.cfg | 2 +- 36 files changed, 116 insertions(+), 109 deletions(-) diff --git a/csunplugged/general/urls.py b/csunplugged/general/urls.py index d60e93b3d..49ab4a422 100644 --- a/csunplugged/general/urls.py +++ b/csunplugged/general/urls.py @@ -5,10 +5,10 @@ from . import views urlpatterns = [ + url(r"^$", views.GeneralIndexView.as_view(), name="home"), url(r"^about/$", views.GeneralAboutView.as_view(), name="about"), + url(r"^computational-thinking/$", views.ComputationalThinkingView.as_view(), name="computational_thinking"), url(r"^contact/$", views.GeneralContactView.as_view(), name="contact"), url(r"^people/$", views.GeneralPeopleView.as_view(), name="people"), url(r"^principles/$", views.GeneralPrinciplesView.as_view(), name="principles"), - url(r"^computational-thinking/$", views.ComputationalThinkingView.as_view(), name="computational_thinking"), - url(r"^$", views.GeneralIndexView.as_view(), name="home"), ] diff --git a/csunplugged/resources/management/commands/_ResourcesLoader.py b/csunplugged/resources/management/commands/_ResourcesLoader.py index 3520dc90e..c3876bdd4 100644 --- a/csunplugged/resources/management/commands/_ResourcesLoader.py +++ b/csunplugged/resources/management/commands/_ResourcesLoader.py @@ -16,8 +16,8 @@ def __init__(self, structure_file, BASE_PATH): """Create the loader for loading resources. Args: - structure_file: file path for structure YAML file (string) - BASE_PATH: base file path (string) + structure_file: file path for structure YAML file (str). + BASE_PATH: base file path (str). """ super().__init__(BASE_PATH) self.structure_file = structure_file diff --git a/csunplugged/resources/models.py b/csunplugged/resources/models.py index c4ca9d90e..cc3ec2681 100644 --- a/csunplugged/resources/models.py +++ b/csunplugged/resources/models.py @@ -18,6 +18,6 @@ def __str__(self): """Text representation of Resource object. Returns: - Name of resource (string). + Name of resource (str). """ return self.name diff --git a/csunplugged/resources/views/binary_cards.py b/csunplugged/resources/views/binary_cards.py index 25dc6c2d4..af24d2d43 100644 --- a/csunplugged/resources/views/binary_cards.py +++ b/csunplugged/resources/views/binary_cards.py @@ -9,11 +9,11 @@ def resource_image(request, resource): """Create a image for Binary Cards resource. Args: - request: HTTP request object. - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - A list of Pillow image objects. + A list of Pillow image objects (list). """ BASE_IMAGE_PATH = "static/img/resources/binary-cards/" IMAGE_SIZE_X = 2480 @@ -76,11 +76,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - text for subtitle (string) + text for subtitle (str). """ if retrieve_query_parameter(request, "display_numbers"): display_numbers_text = "with numbers" diff --git a/csunplugged/resources/views/binary_cards_small.py b/csunplugged/resources/views/binary_cards_small.py index ff1c9cbe4..cb8feb2d4 100644 --- a/csunplugged/resources/views/binary_cards_small.py +++ b/csunplugged/resources/views/binary_cards_small.py @@ -9,11 +9,11 @@ def resource_image(request, resource): """Create a image for Binary Cards (Small) resource. Args: - request: HTTP request object. - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - A list of Pillow image objects. + A list of Pillow image objects (list). """ BASE_IMAGE_PATH = "static/img/resources/binary-cards-small/" IMAGE_SIZE_X = 2480 @@ -75,11 +75,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - text for subtitle (string) + text for subtitle (str). """ if retrieve_query_parameter(request, "dot_counts"): display_numbers_text = "with dot counts" diff --git a/csunplugged/resources/views/binary_to_alphabet.py b/csunplugged/resources/views/binary_to_alphabet.py index 894c0fa22..e41fc2551 100644 --- a/csunplugged/resources/views/binary_to_alphabet.py +++ b/csunplugged/resources/views/binary_to_alphabet.py @@ -8,8 +8,8 @@ def resource_image(request, resource): """Create a image for Binary to Alphabet resource. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: A Pillow image object. @@ -89,11 +89,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - text for subtitle (string) + Text for subtitle (str). """ text = "{} - {}".format( retrieve_query_parameter(request, "worksheet_version"), diff --git a/csunplugged/resources/views/binary_windows.py b/csunplugged/resources/views/binary_windows.py index 1fcc49d31..5b33719ec 100644 --- a/csunplugged/resources/views/binary_windows.py +++ b/csunplugged/resources/views/binary_windows.py @@ -9,11 +9,11 @@ def resource_image(request, resource): """Create a image for Binary Windows resource. Args: - request: HTTP request object (Request). + request: HTTP request object (HttpRequest). resource: Object of resource data (Resource). Returns: - A list of Pillow image objects (list of Image objects). + A list of Pillow image objects (list). """ BASE_IMAGE_PATH = "static/img/resources/binary-windows/" FONT_PATH = "static/fonts/PatrickHand-Regular.ttf" @@ -69,7 +69,7 @@ def add_dot_counts(image, starting_value, font): font: Font used for adding text (Pillow Font). Returns: - Pillow Image with text added. + Pillow Image with text added (Pillow Image). """ value = starting_value draw = ImageDraw.Draw(image) @@ -106,7 +106,7 @@ def add_digit_values(image, value_type, on, x_coord_start, x_coord_increment, ba font: Font used for adding text (Pillow Font). Returns: - Pillow Image with binary values. + Pillow Image with binary values (Pillow Image). """ text_coord_x = x_coord_start @@ -157,11 +157,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object (Request). + request: HTTP request object (HttpRequest). resource: Object of resource data (Resource). Returns: - text for subtitle (str) + text for subtitle (str). """ number_of_bits = retrieve_query_parameter(request, "number_bits") value_type = retrieve_query_parameter(request, "value_type") diff --git a/csunplugged/resources/views/generate_resource_pdf.py b/csunplugged/resources/views/generate_resource_pdf.py index 341b20381..8fbaec093 100644 --- a/csunplugged/resources/views/generate_resource_pdf.py +++ b/csunplugged/resources/views/generate_resource_pdf.py @@ -16,9 +16,9 @@ def generate_resource_pdf(request, resource, module_path): """Return a response containing a generated PDF resource. Args: - request: HTTP request object - resource: Object of resource data. - module_path: Path to module for generating resource. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). + module_path: Path to module for generating resource (str). Returns: Tuple of PDF file of generated resource and filename. @@ -58,9 +58,9 @@ def generate_resource_image(get_request, resource, module_path): Images are resized to size. Args: - get_request: HTTP request object - resource: Object of resource data. - module_path: Path to module for generating resource. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). + module_path: Path to module for generating resource (str). Returns: List of Base64 strings of a generated resource images for one copy. diff --git a/csunplugged/resources/views/modulo_clock.py b/csunplugged/resources/views/modulo_clock.py index f55b4f9bb..b6ba7b3a9 100644 --- a/csunplugged/resources/views/modulo_clock.py +++ b/csunplugged/resources/views/modulo_clock.py @@ -9,11 +9,11 @@ def resource_image(request, resource): """Create a image for Binary Cards resource. Args: - request: HTTP request object (QueryDict). + request: HTTP request object (HttpRequest). resource: Object of resource data (Resource). Returns: - A list of Pillow image objects. + A list of Pillow image objects (list). """ parameter_options = valid_options() modulo_number = int(retrieve_query_parameter(request, "modulo_number", parameter_options["modulo_number"])) @@ -60,7 +60,7 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object (QueryDict). + request: HTTP request object (HttpRequest). resource: Object of resource data (Resource). Returns: diff --git a/csunplugged/resources/views/parity_cards.py b/csunplugged/resources/views/parity_cards.py index 24463d604..36cd43d0c 100644 --- a/csunplugged/resources/views/parity_cards.py +++ b/csunplugged/resources/views/parity_cards.py @@ -8,11 +8,11 @@ def resource_image(request, resource): """Create a image for Parity Cards resource. Args: - request: HTTP request object. - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - A list of Pillow image objects. + A list of Pillow image objects (list). """ CARDS_COLUMNS = 4 CARDS_ROWS = 5 @@ -58,11 +58,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - text for subtitle (string) + text for subtitle (str). """ text = "{} back - {}".format( retrieve_query_parameter(request, "back_colour"), diff --git a/csunplugged/resources/views/sorting_network.py b/csunplugged/resources/views/sorting_network.py index ebc1886a9..fe3a286aa 100644 --- a/csunplugged/resources/views/sorting_network.py +++ b/csunplugged/resources/views/sorting_network.py @@ -9,8 +9,8 @@ def resource_image(request, resource): """Create a image for Sorting Network resource. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: A Pillow image object. @@ -55,11 +55,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - text for subtitle (string) + text for subtitle (str). """ prefilled_values = retrieve_query_parameter(request, "prefilled_values") if prefilled_values == "blank": @@ -75,10 +75,10 @@ def number_range(request): """Return number range tuple for resource. Args: - request: HTTP request object + request: HTTP request object (HttpRequest). Returns: - Tuple of (range_min, range_max, font_size) + Tuple of (range_min, range_max, font_size). """ parameter_options = valid_options() prefilled_values = retrieve_query_parameter(request, "prefilled_values", parameter_options["prefilled_values"]) diff --git a/csunplugged/resources/views/sorting_network_cards.py b/csunplugged/resources/views/sorting_network_cards.py index 1857f56b3..911003712 100644 --- a/csunplugged/resources/views/sorting_network_cards.py +++ b/csunplugged/resources/views/sorting_network_cards.py @@ -9,11 +9,11 @@ def resource_image(request, resource): """Create a image for Sorting Network Cards resource. Args: - request: HTTP request object. - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - A list of Pillow image objects. + A list of Pillow image objects (list). """ IMAGE_SIZE_X = 2000 IMAGE_SIZE_Y = 3000 @@ -107,11 +107,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - text for subtitle (string) + text for subtitle (str). """ return "{} - {}".format( retrieve_query_parameter(request, "type").replace("_", " "), diff --git a/csunplugged/resources/views/treasure_hunt.py b/csunplugged/resources/views/treasure_hunt.py index 652ea6ad1..ccb221147 100644 --- a/csunplugged/resources/views/treasure_hunt.py +++ b/csunplugged/resources/views/treasure_hunt.py @@ -9,8 +9,8 @@ def resource_image(request, resource): """Create a image for Treasure Hunt resource. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: A Pillow image object. @@ -77,11 +77,11 @@ def subtitle(request, resource): also on the resource image. Args: - request: HTTP request object - resource: Object of resource data. + request: HTTP request object (HttpRequest). + resource: Object of resource data (Resource). Returns: - text for subtitle (string) + text for subtitle (str) """ prefilled_values = retrieve_query_parameter(request, "prefilled_values") if prefilled_values == "blank": @@ -98,7 +98,7 @@ def number_range(request): """Return number range tuple for resource. Args: - request: HTTP request object + request: HTTP request object (HttpRequest). Returns: Tuple of (range_min, range_max, font_size) diff --git a/csunplugged/templates/resources/base-resource-pdf.html b/csunplugged/templates/resources/base-resource-pdf.html index 5acc0549b..f4aa82043 100644 --- a/csunplugged/templates/resources/base-resource-pdf.html +++ b/csunplugged/templates/resources/base-resource-pdf.html @@ -1,3 +1,5 @@ +{% load static %} + {{ filename }} @@ -31,8 +33,7 @@ {% endfor %} {% endfor %} diff --git a/csunplugged/templates/topics/programming-challenge-language-solution.html b/csunplugged/templates/topics/programming-challenge-language-solution.html index 707bc227e..46cea6a59 100644 --- a/csunplugged/templates/topics/programming-challenge-language-solution.html +++ b/csunplugged/templates/topics/programming-challenge-language-solution.html @@ -24,7 +24,7 @@

- {{ implementation.language.name }} Solution + {{ implementation.language.name }} solution

{% endblock page_heading %} diff --git a/csunplugged/templates/topics/topic-other-resources.html b/csunplugged/templates/topics/topic-other-resources.html index 0ed549ec3..eacd5f77a 100644 --- a/csunplugged/templates/topics/topic-other-resources.html +++ b/csunplugged/templates/topics/topic-other-resources.html @@ -19,7 +19,7 @@

{{ topic.name }}

{% endblock page_heading %} {% block left_column_content %} -

Other Resources

+

Other resources

{% render_html_field topic.other_resources %} {% endblock left_column_content %} diff --git a/csunplugged/topics/content/en/binary-numbers/unit-plan/lessons/lessons.yaml b/csunplugged/topics/content/en/binary-numbers/unit-plan/lessons/lessons.yaml index 55e41de2f..3d834ef37 100644 --- a/csunplugged/topics/content/en/binary-numbers/unit-plan/lessons/lessons.yaml +++ b/csunplugged/topics/content/en/binary-numbers/unit-plan/lessons/lessons.yaml @@ -1,5 +1,4 @@ how-binary-digits-work-junior: - number: 1 duration: 45 computational-thinking-links: how-binary-digits-work-junior-ct-links.md learning-outcomes: @@ -16,7 +15,6 @@ how-binary-digits-work-junior: - Number line from 0 to 20 reinforcing-sequencing-in-binary-number-systems-junior: - number: 2 duration: 60 computational-thinking-links: reinforcing-sequencing-in-binary-number-systems-junior-ct-links.md learning-outcomes: @@ -30,7 +28,7 @@ reinforcing-sequencing-in-binary-number-systems-junior: description: One set of cards per student. classroom-resources: - Musical instruments - - Glue a stick onto paper plates and have one side on and the other side off + - Glue a stick onto paper plates and have one side on and the other side off - Hats on and off how-binary-digits-work: diff --git a/csunplugged/topics/content/en/error-detection-and-correction/curriculum-integrations/curriculum-integrations.yaml b/csunplugged/topics/content/en/error-detection-and-correction/curriculum-integrations/curriculum-integrations.yaml index a61833345..add56dbae 100644 --- a/csunplugged/topics/content/en/error-detection-and-correction/curriculum-integrations/curriculum-integrations.yaml +++ b/csunplugged/topics/content/en/error-detection-and-correction/curriculum-integrations/curriculum-integrations.yaml @@ -33,4 +33,4 @@ word-study-activity: - literacy prerequisite-lessons: unit-plan: - - parity-magic \ No newline at end of file + - parity-magic diff --git a/csunplugged/topics/content/en/sorting-networks/unit-plan/lessons/lessons.yaml b/csunplugged/topics/content/en/sorting-networks/unit-plan/lessons/lessons.yaml index 7bc6cf441..40015f7ae 100644 --- a/csunplugged/topics/content/en/sorting-networks/unit-plan/lessons/lessons.yaml +++ b/csunplugged/topics/content/en/sorting-networks/unit-plan/lessons/lessons.yaml @@ -16,7 +16,6 @@ reinforcing-numeracy-through-a-sorting-network: - Stopwatch (e.g. on smartphone) to time races between groups. investigating-variations-using-the-sorting-network: - number: 2 duration: 30 learning-outcomes: - sorting-recognise-sorting-method @@ -33,4 +32,4 @@ investigating-variations-using-the-sorting-network: classroom-resources: - A variety of sets of 6 number cards that each include one or more repeated numbers, or - Books with author names, or - - Sets of instruments with different pitches \ No newline at end of file + - Sets of instruments with different pitches diff --git a/csunplugged/topics/management/commands/_AgeGroupsLoader.py b/csunplugged/topics/management/commands/_AgeGroupsLoader.py index c5be84bc5..64ec9efec 100644 --- a/csunplugged/topics/management/commands/_AgeGroupsLoader.py +++ b/csunplugged/topics/management/commands/_AgeGroupsLoader.py @@ -17,8 +17,8 @@ def __init__(self, structure_file_path, BASE_PATH): """Create the loader for loading age groups. Args: - structure_file_path: File path to YAML file (string) - BASE_PATH: Base file path (string). + structure_file_path: File path to YAML file (str). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.structure_file_path = structure_file_path @@ -30,7 +30,7 @@ def load(self): Raise: MissingRequiredFieldError: when no object can be found with the - matching attribute. + matching attribute. """ age_groups_structure = self.load_yaml_file( os.path.join( diff --git a/csunplugged/topics/management/commands/_CurriculumAreasLoader.py b/csunplugged/topics/management/commands/_CurriculumAreasLoader.py index e41f74821..ebf641176 100644 --- a/csunplugged/topics/management/commands/_CurriculumAreasLoader.py +++ b/csunplugged/topics/management/commands/_CurriculumAreasLoader.py @@ -17,8 +17,8 @@ def __init__(self, structure_file_path, BASE_PATH): """Create the loader for loading curriculum areas. Args: - structure_file_path: File path to YAML file (string) - BASE_PATH: Base file path (string). + structure_file_path: File path to YAML file (str). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.structure_file_path = structure_file_path diff --git a/csunplugged/topics/management/commands/_CurriculumIntegrationsLoader.py b/csunplugged/topics/management/commands/_CurriculumIntegrationsLoader.py index 8b5c28c0f..0cd90d654 100644 --- a/csunplugged/topics/management/commands/_CurriculumIntegrationsLoader.py +++ b/csunplugged/topics/management/commands/_CurriculumIntegrationsLoader.py @@ -17,9 +17,9 @@ def __init__(self, structure_file_path, topic, BASE_PATH): """Create the loader for loading curriculum integrations. Args: - structure_file_path: File path for structure YAML file (string). - topic: Object of related topic model. - BASE_PATH: Base file path (string). + structure_file_path: File path for structure YAML file (str). + topic: Object of related topic model (Topic). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.structure_file_path = os.path.join(self.BASE_PATH, structure_file_path) diff --git a/csunplugged/topics/management/commands/_GlossaryTermsLoader.py b/csunplugged/topics/management/commands/_GlossaryTermsLoader.py index 3e93780b9..65ad6dcb5 100644 --- a/csunplugged/topics/management/commands/_GlossaryTermsLoader.py +++ b/csunplugged/topics/management/commands/_GlossaryTermsLoader.py @@ -15,9 +15,9 @@ def __init__(self, glossary_folder_path, structure_file_path, BASE_PATH): """Create the loader for loading glossary terms. Args: - glossary_folder_path: Folder path to definition files (string). - structure_file_path: Path to the config file, used for errors. - BASE_PATH: Base file path (string). + glossary_folder_path: Folder path to definition files (str). + structure_file_path: Path to the config file, used for errors (str). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.structure_file_path = structure_file_path diff --git a/csunplugged/topics/management/commands/_LearningOutcomesLoader.py b/csunplugged/topics/management/commands/_LearningOutcomesLoader.py index 109b40dfd..f8975bcd9 100644 --- a/csunplugged/topics/management/commands/_LearningOutcomesLoader.py +++ b/csunplugged/topics/management/commands/_LearningOutcomesLoader.py @@ -19,8 +19,8 @@ def __init__(self, structure_file_path, BASE_PATH): """Create the loader for loading learning outcomes. Args: - structure_file_path: File path to YAML file (string) - BASE_PATH: Base file path (string). + structure_file_path: File path to YAML file (str). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.structure_file_path = structure_file_path diff --git a/csunplugged/topics/management/commands/_LessonsLoader.py b/csunplugged/topics/management/commands/_LessonsLoader.py index ffd1631a4..5ef0c1514 100644 --- a/csunplugged/topics/management/commands/_LessonsLoader.py +++ b/csunplugged/topics/management/commands/_LessonsLoader.py @@ -24,9 +24,9 @@ def __init__(self, lessons_structure_file_path, topic, unit_plan, BASE_PATH): Args: lessons_structure_file_path: file path to lessons yaml file (str). - topic: Object of Topic model. - unit_plan: Object of UnitPlan model. - BASE_PATH: Base file path (string). + topic: Object of Topic model (Topic). + unit_plan: Object of UnitPlan model (UnitPlan). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.lessons_structure_file_path = lessons_structure_file_path @@ -38,6 +38,7 @@ def load(self): Raises: KeyNotFoundError: when no object can be found with the matching attribute. + InvalidConfigValueError: when provided value is not valid. MissingRequiredFieldError: when a value for a required model field cannot be found in the config file. """ diff --git a/csunplugged/topics/management/commands/_ProgrammingChallengesLoader.py b/csunplugged/topics/management/commands/_ProgrammingChallengesLoader.py index f9ae986d5..118c23b86 100644 --- a/csunplugged/topics/management/commands/_ProgrammingChallengesLoader.py +++ b/csunplugged/topics/management/commands/_ProgrammingChallengesLoader.py @@ -22,9 +22,9 @@ def __init__(self, structure_file_path, topic, BASE_PATH): """Create the loader for loading programming challenges. Args: - structure_file_path: File path for structure YAML file (string). - topic: Object of related topic model. - BASE_PATH: Base file path (string). + structure_file_path: File path for structure YAML file (str). + topic: Object of related topic model (Topic). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.structure_file_path = os.path.join(self.BASE_PATH, structure_file_path) @@ -34,7 +34,8 @@ def __init__(self, structure_file_path, topic, BASE_PATH): def load(self): """Load the content for programming challenges. - Raise: + Raises: + CouldNotFindMarkdownFileError: when no file can be found with the provided filename. KeyNotFoundError: when no object can be found with the matching attribute. MissingRequiredFieldError: when no object can be found with the matching attribute. diff --git a/csunplugged/topics/management/commands/_ProgrammingChallengesStructureLoader.py b/csunplugged/topics/management/commands/_ProgrammingChallengesStructureLoader.py index 285392dc9..1906b2bcf 100644 --- a/csunplugged/topics/management/commands/_ProgrammingChallengesStructureLoader.py +++ b/csunplugged/topics/management/commands/_ProgrammingChallengesStructureLoader.py @@ -17,8 +17,8 @@ def __init__(self, structure_file_path, BASE_PATH): """Create the loader for loading structure of programming challenges. Args: - structure_file_path: File path for structure YAML file (string). - BASE_PATH: Base file path (string). + structure_file_path: File path for structure YAML file (str). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.structure_file_path = structure_file_path diff --git a/csunplugged/topics/management/commands/_TopicLoader.py b/csunplugged/topics/management/commands/_TopicLoader.py index c78332576..16bbc3fe4 100644 --- a/csunplugged/topics/management/commands/_TopicLoader.py +++ b/csunplugged/topics/management/commands/_TopicLoader.py @@ -19,8 +19,8 @@ def __init__(self, factory, structure_file_path, BASE_PATH): Args: factory: LoaderFactory object for creating loaders (LoaderFactory). - structure_file_path: File path for structure YAML file (string). - BASE_PATH: Base file path (string). + structure_file_path: File path for structure YAML file (str). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.factory = factory diff --git a/csunplugged/topics/management/commands/_UnitPlanLoader.py b/csunplugged/topics/management/commands/_UnitPlanLoader.py index 49457e787..5d08cc340 100644 --- a/csunplugged/topics/management/commands/_UnitPlanLoader.py +++ b/csunplugged/topics/management/commands/_UnitPlanLoader.py @@ -21,9 +21,9 @@ def __init__(self, factory, structure_file_path, topic, BASE_PATH): Args: factory: LoaderFactory object for creating loaders (LoaderFactory). - structure_file_path: File path for structure YAML file (string). - topic: Object of related topic model. - BASE_PATH: Base file path (string). + structure_file_path: File path for structure YAML file (str). + topic: Object of related topic model (Topic). + BASE_PATH: Base file path (str). """ super().__init__(BASE_PATH) self.factory = factory diff --git a/csunplugged/topics/models.py b/csunplugged/topics/models.py index ea189e5ce..9a30e0eab 100644 --- a/csunplugged/topics/models.py +++ b/csunplugged/topics/models.py @@ -68,7 +68,7 @@ def __str__(self): """Text representation of LearningOutcome object. Returns: - Text of learning outcome (string). + Text of learning outcome (str). """ return self.text diff --git a/csunplugged/topics/urls.py b/csunplugged/topics/urls.py index d01dcfdea..8d82643f6 100644 --- a/csunplugged/topics/urls.py +++ b/csunplugged/topics/urls.py @@ -36,25 +36,25 @@ views.TopicView.as_view(), name="topic" ), - # eg: /topics/binary-numbers/integrations/binary-bracelets + # eg: /topics/binary-numbers/integrations/binary-bracelets/ url( r"^(?P[-\w]+)/integrations/(?P[-\w]+)/$", views.CurriculumIntegrationView.as_view(), name="integration" ), - # eg: /topics/binary-numbers/other-resources + # eg: /topics/binary-numbers/other-resources/ url( r"^(?P[-\w]+)/other-resources/$", views.OtherResourcesView.as_view(), name="other_resources" ), - # eg: /topics/binary-numbers/unit-plan + # eg: /topics/binary-numbers/unit-plan/ url( r"^(?P[-\w]+)/(?P[-\w]+)/$", views.UnitPlanView.as_view(), name="unit_plan" ), - # eg: /topics/binary-numbers/unit-plan/lesson-1 + # eg: /topics/binary-numbers/unit-plan/lesson-1/ url( r"^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/$", views.LessonView.as_view(), @@ -66,13 +66,13 @@ views.ProgrammingChallengeList.as_view(), name="programming_challenges_list" ), - # eg: /topics/binary-numbers/programming/challenge-1 + # eg: /topics/binary-numbers/programming/challenge-1/ url( r"^(?P[-\w]+)/programming/(?P[-\w]+)$", # noqa: E501 views.ProgrammingChallengeView.as_view(), name="programming_challenge" ), - # eg: /topics/binary-numbers/programming/challenge-1/python-solution + # eg: /topics/binary-numbers/programming/challenge-1/python-solution/ url( r"^(?P[-\w]+)/programming/(?P[-\w]+)/(?P[-\w]+)-solution$", # noqa: E501 views.ProgrammingChallengeLanguageSolutionView.as_view(), diff --git a/csunplugged/topics/views.py b/csunplugged/topics/views.py index fdf8fa334..1272507ea 100644 --- a/csunplugged/topics/views.py +++ b/csunplugged/topics/views.py @@ -353,6 +353,9 @@ def glossary_json(request, **kwargs): Returns: JSON response is sent containing data for the requested term. + + Raises: + 404 error if term not found. """ # If term parameter, then return JSON if "term" in request.GET: diff --git a/csunplugged/utils/BaseLoader.py b/csunplugged/utils/BaseLoader.py index a278c3b7c..8f7056d3e 100644 --- a/csunplugged/utils/BaseLoader.py +++ b/csunplugged/utils/BaseLoader.py @@ -53,6 +53,8 @@ def convert_md_file(self, md_file_path, config_file_path, heading_required=True, Args: md_file_path: Location of Markdown file to convert (str). config_file_path: Path to related the config file (str). + heading_required: Boolean if the file requires a heading (bool). + remove_title: Boolean if the file's first heading should be removed (bool). Returns: VertoResult object diff --git a/csunplugged/utils/check_required_files.py b/csunplugged/utils/check_required_files.py index f1111cb21..43ebd544d 100644 --- a/csunplugged/utils/check_required_files.py +++ b/csunplugged/utils/check_required_files.py @@ -38,7 +38,7 @@ def find_image_files(images, md_file_path): Args: images: image file names (set). - md_file_path: path to Markdown file (string). + md_file_path: path to Markdown file (str). Raises: CouldNotFindImageError: when image file cannot be found. diff --git a/csunplugged/utils/resource_valid_test_configurations.py b/csunplugged/utils/resource_valid_test_configurations.py index efec5b7b3..4a2febaee 100644 --- a/csunplugged/utils/resource_valid_test_configurations.py +++ b/csunplugged/utils/resource_valid_test_configurations.py @@ -15,4 +15,6 @@ def resource_valid_test_configurations(valid_options): """ valid_options["header_text"] = ["", "Example header"] valid_option_keys = sorted(valid_options) - return [dict(zip(valid_option_keys, product)) for product in itertools.product(*(valid_options[valid_option_key] for valid_option_key in valid_option_keys))] # noqa: E501 + return [dict(zip(valid_option_keys, product)) for product in itertools.product( + *(valid_options[valid_option_key] for valid_option_key in valid_option_keys) + )] diff --git a/setup.cfg b/setup.cfg index 1910e495a..aa9a672ef 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,7 +22,7 @@ exclude = show-source = True statistics = True count = True -max-line-length=119 +max-line-length = 119 [pydocstyle] # Ignore following rules to allow Google Python Style docstrings