API Documentation

class PrintTags.Colors[source]

Contains all the base methods responsible for wrapping input strings in ANSI escape codes

static black(value: str) → str[source]

Colorizes a string to black

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
static blue(value: str) → str[source]

Colorizes a string to blue

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
static cyan(value: str) → str[source]

Colorizes a string to cyan

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
static green(value: str) → str[source]

Colorizes a string to green

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
static magenta(value: str) → str[source]

Colorizes a string to magenta

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
static red(value: str) → str[source]

Colorizes a string to red

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
static white(value: str) → str[source]

Colorizes a string to white

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
static yellow(value: str) → str[source]

Colorizes a string to yellow

Parameters:value (str) – The string to colorize
Returns:The colorized string
Return type:str
PrintTags.black(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in black.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.red(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in red.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.green(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in green.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.yellow(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in yellow.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.blue(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in blue.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.magenta(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in magenta.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.cyan(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in cyan.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.white(*args, add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Prints values in white.

Args:
add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (any, optional): A string interpolatable value that should be prepended to the print. Default None. sep (str, optional): String inserted between values, default is a space. Default ‘ ‘. end (str, optional): String appended after the last value, default is a newline. Default `
`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file: A file-like object (stream, optional): Defaults to the current sys.stdout. Default None. flush (bool, optional): Whether to forcibly flush the stream. Default False.

PrintTags.info(*args, tag_text: Optional[str] = 'info', add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Used for printing basic information.

Args:
tag_text (str, optional): The text content of the tag that will be prepended to the print.
None for no tag. Default ‘info’.

add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (str, optional): A string interpolatable value that will be prepended to the print. Default None. sep (str, optional): string inserted between values, default is a space. Default ‘ ‘. end (str, optional): string appended after the last value, default is a newline. Default `

`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file (TextIO, optional): defaults to the current sys.stdout. Default None. flush (bool, optional): whether to forcibly flush the stream. Default False.

PrintTags.success(*args, tag_text: Optional[str] = 'success', add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Used to indicate successful execution.

Args:
tag_text (str, optional): The text content of the tag that will be prepended to the print.
None for no tag. Default ‘success’.

add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (str, optional): A string interpolatable value that will be prepended to the print. Default None. sep (str, optional): string inserted between values, default is a space. Default ‘ ‘. end (str, optional): string appended after the last value, default is a newline. Default `

`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file (TextIO, optional): defaults to the current sys.stdout. Default None. flush (bool, optional): whether to forcibly flush the stream. Default False.

PrintTags.notice(*args, tag_text: Optional[str] = 'notice', add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Used to print important information.

Args:
tag_text (str, optional): The text content of the tag that will be prepended to the print.
None for no tag. Default ‘notice’.

add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (str, optional): A string interpolatable value that will be prepended to the print. Default None. sep (str, optional): string inserted between values, default is a space. Default ‘ ‘. end (str, optional): string appended after the last value, default is a newline. Default `

`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file (TextIO, optional): defaults to the current sys.stdout. Default None. flush (bool, optional): whether to forcibly flush the stream. Default False.

PrintTags.timeout(*args, tag_text: Optional[str] = 'timeout', add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Used to indicate a timeout.

Args:
tag_text (str, optional): The text content of the tag that will be prepended to the print.
None for no tag. Default ‘timeout’.

add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (str, optional): A string interpolatable value that will be prepended to the print. Default None. sep (str, optional): string inserted between values, default is a space. Default ‘ ‘. end (str, optional): string appended after the last value, default is a newline. Default `

`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file (TextIO, optional): defaults to the current sys.stdout. Default None. flush (bool, optional): whether to forcibly flush the stream. Default False.

PrintTags.warn(*args, tag_text: Optional[str] = 'warn', add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Used to highlight that there may be an issue, or that code has improperly executed.

Args:
tag_text (str, optional): The text content of the tag that will be prepended to the print.
None for no tag. Default ‘warn’.

add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (str, optional): A string interpolatable value that will be prepended to the print. Default None. sep (str, optional): string inserted between values, default is a space. Default ‘ ‘. end (str, optional): string appended after the last value, default is a newline. Default `

`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file (TextIO, optional): defaults to the current sys.stdout. Default None. flush (bool, optional): whether to forcibly flush the stream. Default False.

PrintTags.error(*args, tag_text: Optional[str] = 'error', add_datetime: bool = False, prefix: Optional[str] = None, sep: str = ' ', end: str = '\n', closed_ok: bool = False, file: Optional[TextIO] = None, flush: bool = False) → None[source]

Can be used to print the description or message associated with an exception.

Args:
tag_text (str, optional): The text content of the tag that will be prepended to the print.
None for no tag. Default ‘error’.

add_datetime (bool, optional): Whether or not a datetime timestamp should be printed. Default False. prefix (str, optional): A string interpolatable value that will be prepended to the print. Default None. sep (str, optional): string inserted between values, default is a space. Default ‘ ‘. end (str, optional): string appended after the last value, default is a newline. Default `

`.
closed_ok (bool, optional): Whether or not the ValueError raised by a closed stdout should be
suppressed. Default False.

file (TextIO, optional): defaults to the current sys.stdout. Default None. flush (bool, optional): whether to forcibly flush the stream. Default False.