1515
1616
1717def main ():
18+ """
19+ The main drop in script for the README generation.
20+ """
1821 ssl ._create_default_https_context = ssl ._create_unverified_context
1922 args = _get_args ()
2023 numeric_level = getattr (logging , args [1 ].upper (), None )
@@ -31,6 +34,7 @@ def _get_args() -> tuple:
3134 """
3235 A helper function which gets the log level from
3336 the command line. Set as warning from default.
37+
3438 :return: the log level provided by the user
3539 """
3640 parser = argparse .ArgumentParser ()
@@ -49,6 +53,12 @@ def _get_args() -> tuple:
4953
5054
5155def _get_intro_text (language : LanguageCollection ) -> Paragraph :
56+ """
57+ Generates the test for the introduction of the README.
58+
59+ :param language: the language to generate from the LanguageCollection
60+ :return: the introduction paragraph in the README
61+ """
5262 paragraph = Paragraph ([f"Welcome to Sample Programs in { language } ! " ])
5363 text = Inline ("here." , link = language .lang_docs_url ())
5464 if language .has_docs :
@@ -60,6 +70,7 @@ def _get_intro_text(language: LanguageCollection) -> Paragraph:
6070def _generate_program_list (language : LanguageCollection ) -> list :
6171 """
6272 A helper function which generates a list of programs for the README.
73+
6374 :param language: a language collection
6475 :return: a list of sample programs list items
6576 """
@@ -76,8 +87,15 @@ def _generate_program_list(language: LanguageCollection) -> list:
7687 return list_items
7788
7889
79- def _generate_missing_program_list (language : LanguageCollection , missing_programs : list [str ]):
80- list_items = list ()
90+ def _generate_missing_program_list (language : LanguageCollection , missing_programs : list [str ]) -> list [Paragraph ]:
91+ """
92+ Generates the list of programs that are missing in Markdown.
93+
94+ :param language: the language with missing programs
95+ :param missing_programs: the list of programs missing from the language collection
96+ :return: the missing programs lines as Markdown strings
97+ """
98+ list_items : list [Paragraph ] = list ()
8199 missing_programs .sort (key = lambda x : x .name ())
82100 for program in missing_programs :
83101 program : Project
@@ -106,15 +124,22 @@ def _generate_credit() -> Paragraph:
106124 return p
107125
108126
109- def _generate_program_list_header (program_count : int , total_program_count : int ):
127+ def _generate_program_list_header (program_count : int , total_program_count : int ) -> str :
128+ """
129+ Creates the heading test for the programs list.
130+
131+ :param program_count: the number of programs completed in the language
132+ :param total_program_count: the total number of possible programs
133+ :return: the heading about the program list
134+ """
110135 i = int (((program_count / total_program_count ) * 4 ))
111136 emojis = [":disappointed:" , ":thinking:" , ":relaxed:" , ":smile:" , ":partying_face:" ]
112137 return f"Sample Programs List - { program_count } /{ total_program_count } { emojis [i ]} "
113138
114139
115140class ReadMeCatalog :
116141 """
117- An representation of the collection of READMEs in the Sample Programs repo.
142+ A representation of the collection of READMEs in the Sample Programs repo.
118143 """
119144
120145 def __init__ (self , repo : Repo ):
0 commit comments