bluemira.base.look_and_feel

Aesthetic and ambiance functions.

Attributes

LOGGER

LOCAL_LINES

BLUEMIRA_ASCII

Functions

get_git_version(→ str)

Get the version string of the current git branch, e.g.: '0.0.3-74-g70d48be'.

get_git_branch(→ str)

Get the name of the current git branch, e.g. 'develop'.

get_git_files(→ list[str])

Get the names of the files in the directory of the specified branch name.

get_platform(→ str)

Get the OS platform.

count_slocs(→ dict[str, int | list[int]])

Counts lines of code within a given directory for a given git branch

bluemira_critical(string, *[, stacklevel])

Standard template for bluemira critical errors.

bluemira_error(string, *[, stacklevel])

Standard template for bluemira errors.

bluemira_warn(string, *[, stacklevel])

Standard template for bluemira warnings.

bluemira_print(string, *[, stacklevel])

Standard template for bluemira information messages.

bluemira_debug(string, *[, stacklevel])

Standard template for bluemira debugging.

_bluemira_clean_flush(string, *[, stacklevel, ...])

Print and flush string. Useful for updating information.

bluemira_print_flush(string, *[, stacklevel, ...])

Print a coloured, boxed line to the console and flushes it. Useful for

bluemira_debug_flush(string, *[, stacklevel, ...])

Print a coloured, boxed line to the console and flushes it. Useful for

bluemira_print_clean(string, *[, stacklevel])

Print to the logging info console with no modification.

bluemira_error_clean(string, *[, stacklevel])

Print to the logging error console, colouring the output red.

print_banner()

Print the initial banner to the console upon running the bluemira code.

version_banner(→ list[str])

Get the string for the version banner.

user_banner(→ list[str])

Get user and platform info and create text to print to banner.

Module Contents

bluemira.base.look_and_feel.LOGGER
bluemira.base.look_and_feel.LOCAL_LINES
bluemira.base.look_and_feel.get_git_version(directory: str) str

Get the version string of the current git branch, e.g.: ‘0.0.3-74-g70d48be’.

Parameters:

directory (str) – The full path directory of the folder to get git information from

Returns:

The git version bytestring

Return type:

str

bluemira.base.look_and_feel.get_git_branch(directory: str) str

Get the name of the current git branch, e.g. ‘develop’.

Parameters:

directory (str) – The full path directory of the folder to get git information from

Returns:

The git branch string

Return type:

str

bluemira.base.look_and_feel.get_git_files(directory: str, branch: str) list[str]

Get the names of the files in the directory of the specified branch name.

Parameters:
  • directory (str) – The full path directory of the folder to get git information from

  • branch (str) – The name of the git branch to retrieve the filenames from

Returns:

The list of git-controlled path strings

Return type:

list[str]

bluemira.base.look_and_feel.get_platform() str

Get the OS platform.

Returns:

The generic name of the platform (e.g. Linux, Windows)

Return type:

str

bluemira.base.look_and_feel.count_slocs(directory: str, branch: str, exts: list[str] | None = None, ignore: list[str] | None = None) dict[str, int | list[int]]

Counts lines of code within a given directory for a given git branch

Parameters:
  • directory (str) – The full path directory of the folder to get git information from

  • branch (str) – The git branch string

  • exts (list[str] | None) – The list of file extensions to search the directory for

  • ignore (list[str] | None) – The list of extensions and filenames to ignore

Returns:

The dictionary of number of lines of code per file extension, and the total linecount

Return type:

dict[str, int | list[int]]

bluemira.base.look_and_feel.bluemira_critical(string: str, *, stacklevel: int = 4)

Standard template for bluemira critical errors.

Parameters:
  • string (str) – The string to log at critical level

  • stacklevel (int)

bluemira.base.look_and_feel.bluemira_error(string: str, *, stacklevel: int = 4)

Standard template for bluemira errors.

Parameters:
  • string (str) – The string to log at error level

  • stacklevel (int)

bluemira.base.look_and_feel.bluemira_warn(string: str, *, stacklevel: int = 4)

Standard template for bluemira warnings.

Parameters:
  • string (str) – The string to log at warning level

  • stacklevel (int)

bluemira.base.look_and_feel.bluemira_print(string: str, *, stacklevel: int = 4)

Standard template for bluemira information messages.

Parameters:
  • string (str) – The string to log at info level

  • stacklevel (int)

bluemira.base.look_and_feel.bluemira_debug(string: str, *, stacklevel: int = 4)

Standard template for bluemira debugging.

Parameters:
  • string (str) – The string to log at debug level

  • stacklevel (int)

bluemira.base.look_and_feel._bluemira_clean_flush(string: str, *, stacklevel: int = 4, progress_timeout: float = 4)

Print and flush string. Useful for updating information.

Parameters:
  • string (str) – The string to colour flush print

  • stacklevel (int)

  • progress_timeout (float)

bluemira.base.look_and_feel.bluemira_print_flush(string: str, *, stacklevel: int = 4, progress_timeout: float = 4)

Print a coloured, boxed line to the console and flushes it. Useful for updating information.

Parameters:
  • string (str) – The string to colour flush print

  • stacklevel (int)

  • progress_timeout (float)

bluemira.base.look_and_feel.bluemira_debug_flush(string: str, *, stacklevel: int = 4, progress_timeout: float = 4)

Print a coloured, boxed line to the console and flushes it. Useful for updating information when running at the debug logging level.

Parameters:
  • string (str) – The string to colour flush print for debug messages.

  • stacklevel (int)

  • progress_timeout (float)

bluemira.base.look_and_feel.bluemira_print_clean(string: str, *, stacklevel: int = 4)

Print to the logging info console with no modification. Useful for external programs

Parameters:
  • string (str) – The string to print

  • stacklevel (int)

bluemira.base.look_and_feel.bluemira_error_clean(string: str, *, stacklevel: int = 4)

Print to the logging error console, colouring the output red. No other modification is made. Useful for external programs

Parameters:
  • string (str) – The string to colour print

  • stacklevel (int)

bluemira.base.look_and_feel.BLUEMIRA_ASCII = Multiline-String
Show Value
""" _     _                      _
| |   | |                    (_)
| |__ | |_   _  ___ _ __ ___  _ _ __ __ _ __
| '_ \| | | | |/ _ \ '_ ` _ \| | '__/ _| |_ \
| |_) | | |_| |  __/ | | | | | | | | (_| |_) |
|_.__/|_|\__,_|\___|_| |_| |_|_|_|  \__|_|__/
"""
bluemira.base.look_and_feel.print_banner()

Print the initial banner to the console upon running the bluemira code.

bluemira.base.look_and_feel.version_banner() list[str]

Get the string for the version banner.

Returns:

The list of strings of text describing the version and code information

Return type:

list[str]

bluemira.base.look_and_feel.user_banner() list[str]

Get user and platform info and create text to print to banner.

Returns:

The text for the banner containing user and platform information

Return type:

list[str]