API Documentation¶
-
class
PrintTags.Colors[source]¶ Contains all the base methods responsible for wrapping input strings in the correct ANSI escape codes
-
static
black(string) → str[source]¶ Colorizes a string to black
Parameters: string (str) – The string to colorize Returns: The colorized string Return type: str
-
static
blue(string) → str[source]¶ Colorizes a string to blue
Parameters: string (str) – The string to colorize Returns: The colorized string Return type: str
-
static
cyan(string) → str[source]¶ Colorizes a string to cyan
Parameters: string (str) – The string to colorize Returns: The colorized string Return type: str
-
static
green(string) → str[source]¶ Colorizes a string to green
Parameters: string (str) – The string to colorize Returns: The colorized string Return type: str
-
static
magenta(string) → str[source]¶ Colorizes a string to magenta
Parameters: string (str) – The string to colorize Returns: The colorized string Return type: str
-
static
red(string) → str[source]¶ Colorizes a string to red
Parameters: string (str) – The string to colorize Returns: The colorized string Return type: str
-
static
-
PrintTags.black(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in black
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.red(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in red
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.green(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in green
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.yellow(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in yellow
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.blue(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in blue
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.magenta(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in magenta
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.cyan(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in cyan
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.white(*args, add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Prints values in white
Parameters: - add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.info(*args, tag='[info] ', add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Used for printing basic information.
Parameters: - tag (any, optional) – The tag that will be prepended to the print. None or False for no tag
- add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that will be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.success(*args, tag='[success] ', add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Used to indicate the successful execution of a process.
Parameters: - tag (any, optional) – The tag that will be prepended to the print. None or False for no tag
- add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.notice(*args, tag='[notice] ', add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Used to print important information.
Parameters: - tag (any, optional) – The tag that will be prepended to the print. None or False for no tag
- add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.timeout(*args, tag='[timeout] ', add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Used to indicate the timeout of a process.
Parameters: - tag (any, optional) – The tag that will be prepended to the print. None or False for no tag
- add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.warn(*args, tag='[warn] ', add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Used to highlight that there may be an issue, or that code has improperly executed.
Parameters: - tag (any, optional) – The tag that will be prepended to the print. None or False for no tag
- add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.
-
PrintTags.error(*args, tag='[error] ', add_datetime=False, prefix=None, sep=' ', end='\n', closed_ok=False, file=None, **kwargs)[source]¶ Can be used to print the description or message associated with an exception.
Parameters: - tag (any, optional) – The tag that will be prepended to the print. None or False for no tag
- add_datetime (bool, optional) – Whether or not a datetime timestamp should be printed
- prefix (any, optional) – A string interpolatable value that should be prepended to the print
- sep (str, optional) – string inserted between values, default is a space.
- end (str, optional) – string appended after the last value, default is a newline.
- closed_ok (bool, optional) – Whether or not to catch the ValueError raised by a closed stdout
- file – A file-like object (stream); defaults to the current sys.stdout.
- flush (bool, optional) – whether to forcibly flush the stream.