musif.common package¶
Submodules¶
musif.common.constants module¶
- musif.common.constants.BLACK = 0¶
Dictionary to access different color indexes for logging
- musif.common.constants.BLUE = 4¶
Dictionary to access different color indexes for logging
- musif.common.constants.BOLD_SEQ = '\x1b[1m'¶
Logging constants to introduce in the logger
- musif.common.constants.CYAN = 6¶
Dictionary to access different color indexes for logging
- musif.common.constants.GREEN = 2¶
Dictionary to access different color indexes for logging
- musif.common.constants.LEVEL_CRITICAL = 'CRITICAL'¶
Indexes for each color
- musif.common.constants.MAGENTA = 5¶
Dictionary to access different color indexes for logging
- musif.common.constants.RED = 1¶
Dictionary to access different color indexes for logging
- musif.common.constants.WHITE = 7¶
Dictionary to access different color indexes for logging
- musif.common.constants.YELLOW = 3¶
Dictionary to access different color indexes for logging
musif.common.didone_utils module¶
musif.common.exceptions module¶
- exception musif.common.exceptions.CannotResurrectObject(obj)[source]¶
Bases:
Exception
Exception raised when a cached object is accessed on a non-cached attribute and the object doesn’t know how to resurrect the non-cached object
- exception musif.common.exceptions.FeatureError[source]¶
Bases:
RuntimeError
Exception raised when computing one of the features modules
- exception musif.common.exceptions.MissingFileError(file_path: str)[source]¶
Bases:
Exception
Exception informing that an expected file couldn’t be found.
musif.common.sort module¶
- musif.common.sort.sort_columns(data: pandas.DataFrame, sorting_list: list) pandas.DataFrame [source]¶
Reorders columns of a Dataframe according to a reference list. Uses sort_list.
- Parameters:
data (DataFrame) – DataFrame whose columns needs to be re-ordered according to some criteria
sorting_list (list) – List used as reference to sort columns.
- musif.common.sort.sort_dataframe(data: pandas.DataFrame, column: str, sorting_lists: Dict[list, str], key_to_sort: str) pandas.DataFrame [source]¶
Sorts Dataframe’s rows by a column using a list as a reference. :param data: DataFrame to be re-ordered according to some criteria. :type data: DataFrame :param column: Column of the Dataframe used as key. :type column: str :param sorting_lists: Dictionary containing lists used as reference to sort values. :type sorting_lists: Dict[list] :param key_to_sort: Key from sorting_lists that contains the desired list to be used as reference. :type key_to_sort: str
- musif.common.sort.sort_dict(dict_to_sort: dict, reference_list: list) dict [source]¶
Sorts dictionary keys according to a reference li()
- Parameters:
dict_to_sort (dict) – Dictionary that needs to be sorted according to some criteria
main_list (list) – List used as reference to sort the first one.
- musif.common.sort.sort_list(list_to_sort: List[str], reference_list: List[str]) List[str] [source]¶
Sorts first list based on the second one. Those elements that are not present in the reference list will be placed at the end. Returns the same list re-ordered.
- Parameters:
list_to_sort (list) – List that needs to be sorted according to some criteria
reference_list (str) – List used as reference to sort the first one.