unit_grader.utils package

Submodules

unit_grader.utils.common module

unit_grader.utils.common.is_valid_numeric_string(numeric_string: str) bool[source]

Check if a string is a valid numeric string.

Parameters:

s (str) – The string to check.

Returns:

True if the string is a valid numeric string, False otherwise.

Return type:

bool

unit_grader.utils.common.convert_units(input_value: str, from_unit: str, to_unit: str, category: str, conversion_data: dict) float | None[source]

Convert an input value from one unit to another.

Parameters:
  • input_value (float) – The input value to be converted.

  • from_unit (str) – The unit to convert from.

  • to_unit (str) – The unit to convert to.

  • category (str) – The unit category (‘temperature’ or ‘volume’).

  • conversion_data (dict) – The conversion data.

Returns:

The converted value. None: If the conversion cannot be performed.

Return type:

float

Module contents

This file is required for Python to recognize this directory as a package.


The utils package contains the following:

Modules:
  • common: Contains common functions used in the conversion calculator and grader.