icolos.utils.general package#

Submodules#

icolos.utils.general.arparse_bool_extension module#

icolos.utils.general.arparse_bool_extension.str2bool(inp)[source]#

icolos.utils.general.citation_generator module#

class icolos.utils.general.citation_generator.ConsoleColours[source]#

Bases: object

BLINKING = '\x1b[5m'#
BLUE = '\x1b[94m'#
BOLD = '\x1b[1m'#
CYAN = '\x1b[96m'#
ENDC = '\x1b[0m'#
FAIL = '\x1b[91m'#
GREEN = '\x1b[92m'#
HEADER = '\x1b[95m'#
ORANGE = '\x1b[0;33m'#
RED = '\x1b[93m'#
UNDERLINE = '\x1b[4m'#
icolos.utils.general.citation_generator.add_citation(step_type: str, workflow_step_types: List[str], citations: List[str], citation_string: str)[source]#
icolos.utils.general.citation_generator.print_citations(steps: List[StepBase], logger=None)[source]#

icolos.utils.general.convenience_functions module#

icolos.utils.general.convenience_functions.ensure_list(inp) list[source]#
icolos.utils.general.convenience_functions.in_keys(dictionary: dict, keys: list) bool[source]#
icolos.utils.general.convenience_functions.nested_get(dictionary: dict, keys: list, default=None)[source]#
icolos.utils.general.convenience_functions.parse_setuppy()[source]#

icolos.utils.general.files_paths module#

icolos.utils.general.files_paths.any_in_file(path, strings)[source]#
icolos.utils.general.files_paths.attach_root_path(path, n=4)[source]#

Function to attach the root path of the module for a given “path”.

icolos.utils.general.files_paths.check_file_availability(path: str, interval_sec: int = 1, maximum_sec: int = 10) str[source]#
icolos.utils.general.files_paths.dict_from_json_file(path)[source]#
icolos.utils.general.files_paths.empty_output_dir(path: str)[source]#
icolos.utils.general.files_paths.gen_tmp_file(suffix: Optional[str] = None, prefix: Optional[str] = None, dir: Optional[str] = None, text: bool = True) Tuple[str, str][source]#

Function wraps tempfile.mkstemp(), but closes the connection and returns the file name instead of the handler.

icolos.utils.general.files_paths.infer_input_type(path: str) str[source]#
icolos.utils.general.files_paths.lines_in_file(path)[source]#
icolos.utils.general.files_paths.move_up_directory(path, n=1)[source]#

Function, to move up ‘n’ directories for a given “path”.

icolos.utils.general.files_paths.remove_folder(folder_path: str)[source]#

icolos.utils.general.icolos_exceptions module#

exception icolos.utils.general.icolos_exceptions.ContainerCorrupted[source]#

Bases: Exception

exception icolos.utils.general.icolos_exceptions.ExecutionFailed[source]#

Bases: Exception

exception icolos.utils.general.icolos_exceptions.StepFailed[source]#

Bases: Exception

icolos.utils.general.icolos_exceptions.get_exception_message(e: Exception)[source]#
icolos.utils.general.icolos_exceptions.get_exception_type(e: Exception) str[source]#

icolos.utils.general.molecules module#

icolos.utils.general.molecules.get_charge_for_molecule(molecule: Mol, add_as_tag=False) int[source]#
icolos.utils.general.molecules.write_molecule_to_sdf(path: str, molecule: Mol)[source]#

icolos.utils.general.parallelization module#

class icolos.utils.general.parallelization.Parallelizer(*, func: Callable)[source]#

Bases: BaseModel

execute_parallel(**kwargs)[source]#
func: Callable#
rearrange_input(inp_dict: Dict[str, List]) List[Dict][source]#
class icolos.utils.general.parallelization.Subtask(*, status: ParallelizationEnum = ParallelizationEnum.STATUS_READY, times_tried: int = 0, data: Any = None, job_id: str = None)[source]#

Bases: BaseModel

data: Any#
increment_tries()[source]#
job_id: str#
set_job_id(job_id: str)[source]#
set_status(status: str)[source]#
set_status_failed()[source]#
set_status_success()[source]#
status: ParallelizationEnum#
times_tried: int#
class icolos.utils.general.parallelization.SubtaskContainer(*, max_tries: int, subtasks: List[Subtask] = [])[source]#

Bases: BaseModel

add_data(data: List[Any])[source]#
any_failed() bool[source]#
clear()[source]#
done() bool[source]#
get_done_tasks() List[Subtask][source]#
get_running_tasks() List[Subtask][source]#
get_sublists(partitions=None, slice_size=None, get_first_n_lists=None) List[List[Subtask]][source]#
get_todo_tasks() List[Subtask][source]#
load_data(data: List[Any])[source]#
max_tries: int#
set_max_tries(max_tries: int)[source]#
subtasks: List[Subtask]#

icolos.utils.general.print_log module#

icolos.utils.general.print_log.print_log_file(path: str, logger, level)[source]#

icolos.utils.general.progress_bar module#

icolos.utils.general.progress_bar.get_progress_bar_string(done, total, prefix='', suffix='', decimals=1, length=100, fill='█')[source]#

icolos.utils.general.strings module#

icolos.utils.general.strings.stringify(obj)[source]#

Converts all objects in a dict to str, recursively.

Module contents#