Skip to content

stuff

thkit.stuff

Functions:

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

Yield successive n-sized chunks from input_list.

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

Expand mixed index tokens into a list of integers. Accepts ints or strings in 'start-end[:step]' (inclusive).

Examples: [1, 2, "3-5:2", "6-10"] -> [1, 2, 3, 5, 6, 7, 8, 9, 10]

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

Create a line with centered text.

text_fill_left(input_text='example', margin=15, fill_left='-', fill_right=' ', length=60)

Create a line with left-aligned text.

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

Put the string at the center of | |.

text_repeat(input_str: str, length: int) -> str

Repeat the input string to a specified length.

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

ANSI escape codes for color the text. follow this link for more details.

time_uuid() -> str

simple_uuid()

Generate a simple random UUID of 4 digits.