pash.misc¶
Miscellaneous functions for using pash
-
class
pash.misc.
ProgressBar
(max: int, title: str = '', val: float = 0.0)¶ Represents a cli progress bar.
…
-
max
¶ Maximum value.
Type: int
-
title
¶ The progress bar’s title.
Type: str
-
val
¶ The bar’s current value.
Type: float
-
w
¶ The bar’s width in the console [characters].
Type: int
-
done
¶ Whether or not, the process has finished.
Type: bool
-
update
(val)¶ Make some progress!
-
inc
(by)¶ Increment the value by [by].
-
end
()¶ End the process.
-
ensure_end
()¶ Calls end, if the process hasn’t ended according to the progress bar. Should always be called to make sure the progress bar finishes.
-
__refresh
()¶ Refresh/redraw the progress bar.
-
end
() → None Ends the progress bar.
-
ensure_end
() → None Ensures the progress bar has ended/ends. (always call when finished!)
-
inc
(by: float) → None Increments the current value by the given value.
-
update
(val: float) → None Sets the current value to the given value
-
-
class
pash.misc.
TALIGN
¶ An enumeration.
-
pash.misc.
center
(txt: str) → str¶ Centers text appropriate for the current terminal width.
-
pash.misc.
clear
() → None¶ Clears the console appropriate to the OS in use.
-
pash.misc.
fancy_print
(txt: str) → None¶ Prints the given text in a “fancy” way; it centers it, and gives it random splashes of colour.
-
pash.misc.
fprint
(txt: str) → None¶ Alias for fancy_print(txt)
-
pash.misc.
print_center
(txt: str) → None¶ Prints the centered text obtained from center()
-
pash.misc.
print_table
(tab: List[List[str]], align: pash.misc.TALIGN = <TALIGN.RIGHT: 2>) → None¶ Prints the given 2d-string list in a table fashion; evenly spaced columns, etc.
-
pash.misc.
printc
(txt: str) → None¶ Alias for print_center(txt)