utilities.FullUtilities

Usage

Source

utilities.FullUtilities()

Methods

Name Description
__init__() A class to help bring utility functions to other modules.
group_files_by_size() Create a list of dictionaries that contain the specified number of groups of files.
system_cmd() A function for making system calls, while preforming proper exception handling.

__init__()

A class to help bring utility functions to other modules.

Usage

Source

__init__()

group_files_by_size()

Create a list of dictionaries that contain the specified number of groups of files.

Usage

Source

group_files_by_size(file_dict, _path=None, groups=8)

Each group of files has a total size that are close to each other.

Parameters
file_dict: dict.

The file names are keys, and file sizes are the values.

_path: str. = None

If the file_dict isn’t given, then a path can be given for generating the file_dict.

groups: int. = 8
The number of groups to split the files into.
Returns
list.
A list with {groups} number of dictionaries.

system_cmd()

A function for making system calls, while preforming proper exception handling.

Usage

Source

system_cmd(
    cmd,
    timeout=None,
    print_flag=True,
    write_flag=False,
    file_name=None,
    **kwargs
)
Parameters
cmd

A list that contains the arguments for Popen.

timeout=None

A timeout variable.

write_flag=False

A flag used to write each line of output to a file.

file_name=None

The name of the to be written to.

kwargs={}
Any other keyword arguments for Popen.
Returns
Returns the stdout and stderr as a tuple.