Module psdi_data_conversion.utils

utils.py

Miscellaneous utility functions used by this project

Functions

def print_wrap(s: str, newline=False, err=False, **kwargs)
Expand source code
def print_wrap(s: str, newline=False, err=False, **kwargs):
    """Print a string wrapped to the terminal width
    """
    if err:
        file = sys.stderr
    else:
        file = sys.stdout
    for line in s.split("\n"):
        print(textwrap.fill(line, width=TERM_WIDTH, **kwargs), file=file)
    if newline:
        print("")

Print a string wrapped to the terminal width

def regularize_name(name: str)
Expand source code
def regularize_name(name: str):
    """Regularizes a name for comparisons, making it lowercase and stripping spaces

    Parameters
    ----------
    name : str
        The name, e.g. "Open Babel"

    Returns
    -------
    str
        The regularized name, e.g. "openbabel"
    """
    return name.lower().replace(" ", "")

Regularizes a name for comparisons, making it lowercase and stripping spaces

Parameters

name : str
The name, e.g. "Open Babel"

Returns

str
The regularized name, e.g. "openbabel"