ugc package¶
Subpackages¶
Submodules¶
ugc.__main__ module¶
Allows calling python -m ugc from the root of the project.
ugc.cli module¶
Describes the commands available from the terminal when running this tool.
- ugc.cli.print_error(context)¶
- ugc.cli.print_version(context, param, value)¶
Print the program version and exit.
- ugc.cli.run_if_config_exists(f)¶
ugc.commands module¶
List the commands available from the CLI: one per function.
- ugc.commands.check_score_accuracy(grades) dict ¶
- ugc.commands.generate_sample(config) dict ¶
Generate a sample grades JSON config file.
- ugc.commands.generate_sample_overwrite(config) dict ¶
Generate a sample grades JSON config file: overwrite if it exists.
- ugc.commands.plot_modules(grades: Grades, api=False, options: dict = {}) dict ¶
Plot modules over time with additional information and save the generated plot to path. It might be a good idea to refactor this gigantic function some day.
- Parameters:
grades (Grades) – ugc grades object.
- ugc.commands.summarize_all(grades: Grades, symbol: str = '=', repeat: int = 80) dict ¶
Print a summary of modules done and in progress.
- ugc.commands.summarize_done(grades) dict ¶
Print a summary of the progress made so far for modules that are done and dusted.
- ugc.commands.summarize_progress(grades) dict ¶
Print a summary of only the modules that are currently in progress.
- ugc.commands.summarize_progress_avg_progress_only(grades) dict ¶
ugc.config module¶
Manage the configuration file.
- class ugc.config.Config(json_str=None, config_path=None)¶
Bases:
object
Loads the configuration where grades are stored.
If json_str is passed, load from a JSON string. Instead, if config_path is passed, load from a path. Else, try loading from a default configuration file.
- static _check_total_weight_sums_up_100_for_module(module, module_name) bool ¶
- all_modules_are_found_with_valid_names() bool ¶
- all_modules_are_set_to_correct_level()¶
- all_modules_have_valid_float_scores_and_weights() bool ¶
- check_config_is_not_empty() bool ¶
- check_score_accuracy_raises_error_on_RPLed_module_with_scores() bool ¶
- check_total_weight_sums_up_100_in_all_modules() bool ¶
- config_is_a_dict() bool ¶
- load() dict ¶
Load grades from JSON (string or file).
- verify() None ¶
Check that the config file contains valid data. One of the functions will throw an error if the config is not valid.
- exception ugc.config.ConfigValidationError(custom_msg)¶
Bases:
Exception
Raised when there is an error in the config file.
ugc.grades module¶
Command-line application to get information about progress made in a BSc Computer Science at the University of London (calculations are specific to this particular degree).
- class ugc.grades.Grades(json_str=None, config_path=None, verified=True, error=None)¶
Bases:
object
- _get_unweighted_data_of_modules_in_progress() tuple ¶
- _get_weighted_data_of_modules_in_progress() tuple ¶
- get_list_of_finished_modules() list ¶
Return a list of dicts containing information about all the modules that have a valid score (either -1 or 0 <= x <= 100).
- get_list_of_modules_in_progress() list ¶
Return a list of dict containing all the non-empty values of the modules in progress.
- get_module_scores_of_finished_modules() list ¶
Return a list of floats with the score obtained in each module.
- get_module_scores_of_finished_modules_for_system(system: str = 'US') dict ¶
Return a dictionary containing the converted ECTS score for each module.
- get_num_of_finished_modules() int ¶
Return the number of modules completed with a score greater than or equal to zero as an integer.
- static get_percentage_degree_done(num_credits: int) float ¶
From the total number of credits, return the percentage done out of 360 credits.
- get_scores_of_modules_in_progress() list ¶
Return a list of floats with the score obtained in each module in progress.
- get_scores_of_modules_in_progress_for_system(system: str = 'US') dict ¶
Return a dictionary containing the converted ECTS score for each module in progress.
- property total_credits: int¶
Get the total number of credits gotten so far as an integer.
- property unweighted_average: float¶
Return the unweighted average across all completed modules.
- property unweighted_average_in_progress_only: float¶
Return the unweighted average across modules in progress only.
- property unweighted_average_including_in_progress: float¶
Return the unweighted average across all completed modules and those in progress.
- property weighted_average: float¶
- property weighted_average_in_progress: float¶
- property weighted_average_in_progress_only: float¶