Skip to content

stuff

thutil.stuff

Functions:

chunk_list(input_list: list, n: int) -> Generator

Yield successive n-sized chunks from input_list.

unpack_indices(list_inputs: list[int | str]) -> list[int]

Expand the input list of indices to a list of integers. Eg: list_inputs = [1, 2, "3-5:2", "6-10"]

text_fill_center(input_text='example', fill='-', max_length=60)

Create a line with centered text.

text_fill_left(input_text='example', left_margin=15, fill='-', max_length=60)

Create a line with left-aligned text.

text_fill_box(input_text='', fill=' ', sp='|', max_length=60)

Put the string at the center of | |.

text_color(text: str, color: str = 'blue') -> str

ANSI escape codes for color the text.

time_uuid() -> str

simple_uuid()

Generate a simple random UUID of 4 digits.