phystool.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 |
|
Taken from slugify at https://github.com/django/django/blob/stable/5.2.x/ Convert to ASCII. Convert spaces or repeated dashes to single dashes. Remove characters that aren’t alphanumerics, underscores, or hyphens. Convert to lowercase. Strip leading and trailing whitespace, dashes, and underscores. |
|
Display a progress bar in the terminal |
|
Data
API
- phystool.helper.logger
“getLogger(…)”
- phystool.helper.should_compile(tex_file: pathlib.Path) bool
- phystool.helper.terminal_yes_no(prompt: str) bool
Ask for a confirmation in the terminal.
- Paramètres:
prompt – text displayed before the “[y/n]:” question
- phystool.helper.silent_keyboard_interrupt(func)
- phystool.helper.greptex(query: str, path: pathlib.Path, silent: bool) set[uuid.UUID]
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.
- Paramètres:
query – string that should be matched
path – directory where the search occurs
silent – if True, logs a warning when no match was found
- Renvoie:
a set of uuids corresponding to tex files that contains the query
- phystool.helper.as_valid_filename(value: str) str
Taken from slugify at https://github.com/django/django/blob/stable/5.2.x/ Convert to ASCII. Convert spaces or repeated dashes to single dashes. Remove characters that aren’t alphanumerics, underscores, or hyphens. Convert to lowercase. Strip leading and trailing whitespace, dashes, and underscores.
- class phystool.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]
- phystool.helper.progress_bar(max_step: int, step: int, length: int, msg: str) None
Display a progress bar in the terminal
- Paramètres:
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
- phystool.helper.texfile_to_symlink(tex_file: pathlib.Path) pathlib.Path