yoda_powers.toolbox Package

Handy functions common for many scripts to easy check file/directory, load file info, …

Functions

compare_list(list1, list2)

Function to compare two list and return common, uniq1 and uniq2

existant_file(path)

‘Type’ for argparse - checks that file exists and return the absolute path as PosixPath() with pathlib

load_in_dict(filename[, sep])

Check file exist and return a dict with load rows first column is the key and value are other column.

load_in_dict_dict(filename[, sep])

Check file exist and return a dict with load rows first column is the key and value are other column.

load_in_dict_selected(filename[, …])

Check file exist and return a dict with load rows first column is the key and value are other column.

load_in_list(filename)

Check file exist and create generator with no line break file can be a gzip file with ‘.gz’ extension

load_in_list_col(filename[, col, sep])

Check file exist and create generator with only selected column with no line break file can be a gzip file with ‘.gz’ extension

max_key_dict(dico)

Function return the key of max value in dico values()

readable_dir(prospective_dir)

‘Type’ for argparse - checks that directory exists and if readable, then return the absolute path as PosixPath() with pathlib

replace_all(repls, str)

Function that take a dictionnary and text variable and return text variable with replace ‘Key’ from dictionnary with ‘Value’.

sort_human(in_list[, _nsre])

Sort a list with alpha/digit on the way that humans expect,

welcome_args(version_arg, parser_arg)

use this Decorator to add information to scripts with arguments

Classes

AutoVivification

Implementation of perl’s autovivification feature.

Directory(*args, **kwargs)

Class which derives from PosixPath.

Path(*args, **kwargs)

PurePath subclass that can make system calls.

PosixPath(*args, **kwargs)

Path subclass for non-Windows systems.

PrintCol()

Classe qui ajoute des méthodes à print pour afficher de la couleur

datetime(year, month, day[, hour[, minute[, …)

The year, month and day arguments are required.