foundry_dev_tools.utils.misc module#

These are miscellaneous utility functions/classes.

foundry_dev_tools.utils.misc.decamelize(camel_case)[source]#

Convert CamelCase to snake_case.

Parameters:

camel_case (str)

Return type:

str

class foundry_dev_tools.utils.misc.TailHelper[source]#

Bases: object

Tails logs.

Parameters:
  • print_handler – the way it prints the lines e.g. :py:meth:print or a :py:class:logging.Logger

  • start_message – the start_message to print before the first line or if None it will print a horizontal line

  • previous_line_number – the previous line number that was printed, if not none the start_message will never be printed and the first line will be the line after :py:attr:previous_line_number

print_handler: Callable[[str], Any]#
start_message: str | None = None#
previous_line_number: int | None = None#
tail(log_lines)[source]#

Handles the logs.

If :py:attr:TailHelper.previous_line_number is None it will print the :py:attr:TailHelper.start_message and print everything contained int :py:attr:logs But if the :py:attr:TailHelper.previous_line_number is an integer it will print the logs from that given line number, this will only print new lines.

Parameters:

log_lines (Sequence[str] | None) – a list of lines, if None execution will be skipped

__init__(print_handler, start_message=None, previous_line_number=None)#
Parameters:
  • print_handler (Callable[[str], Any])

  • start_message (str | None)

  • previous_line_number (int | None)

Return type:

None

foundry_dev_tools.utils.misc.print_horizontal_line(c='-', print_handler=<built-in function print>)[source]#

Print a horizontal line with :py:attr:c.

It uses the amount of terminal columns to print a line of good length :param c: the char to print :param print_handler: the function to use for printing

Parameters:
  • c (str)

  • print_handler (Callable[[str], Any])

foundry_dev_tools.utils.misc.is_dataset_a_view(dataset_transaction)[source]#

Determines based on a transaction, if a dataset is a view.

Parameters:

dataset_transaction (dict) – a transaction on the dataset in question

Returns:

if dataset is a view

Return type:

bool

foundry_dev_tools.utils.misc.parse_iso(iso_str)[source]#

Parses iso string to datetime.

Parameters:

iso_str (str)

Return type:

datetime