helper
Module Contents
Classes
Wrapper around an iterable that allows peeking ahead to get next elements without consuming the iterator. |
|
Functions
Ask for a confirmation in the terminal. |
|
Find query in tex files stored in the single directory path. |
|
Display file in terminal with bat. |
|
Display a progress bar in the terminal |
Data
API
- helper.logger = 'getLogger(...)'
- helper.terminal_yes_no(prompt: str) bool
Ask for a confirmation in the terminal.
- Parameters:
prompt – text displayed before the ‘[y/n]:’ question
- helper.silent_keyboard_interrupt(func)
- helper.greptex(query: str, path: pathlib.Path, silent: bool) set[str]
Find query in tex files stored in the single directory path.
Format query to match a newline followed by spaces and returns a set of uuids of tex files containing query.
- Parameters:
query – string that should be matched
path – directory where the search occurs
silent – if True, logs a warning when no match was found
- Returns:
a set of uuids corresponding to tex files that contains the query
- helper.lower_ascii(txt: str) str
- helper.bat(path: pathlib.Path, title: str) None
Display file in terminal with bat.
The extension is detected from the filename extension
- Parameters:
path – file to display
title – title displayed in the bat header
- helper.as_valid_filename(txt: str) str
- class helper.ContextIterator(iterable: Iterable[T], before: int, after: int)
Wrapper around an iterable that allows peeking ahead to get next elements without consuming the iterator.
Initialization
- get() list[T]
- class helper.Klass(uuid: str, name: str, year: int, extra: str, evaluations: list[str])
Initialization
- is_current() bool
- to_dict() dict[str, str | list[str] | int]
- class helper.Evaluation(uuid: str, klass_uuid: str, title: str = '', date: str = '2024-08-31', number: str = '', extra: list[str] = [], exercises: list[str] = [])
Initialization
- update(data: dict) tuple[set[str], set[str]]
- to_dict() dict[str, str | list[str]]
- helper.progress_bar(max_step: int, step: int, length: int, msg: str) None
Display a progress bar in the terminal
- Parameters:
max_step – process’ maximum number of steps
step – current process’ step
length – number of characters of the progress bar
msg – message displayed after the progress bar