metawards.utils.Console¶
-
class
metawards.utils.
Console
[source]¶ This is a singleton class that provides access to printing and logging functions to the console. This uses ‘rich’ for rich console printing
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__delattr__
(name, /)Implement delattr(self, name).
__dir__
()Default dir() implementation.
__eq__
(value, /)Return self==value.
__format__
(format_spec, /)Default object formatter.
__ge__
(value, /)Return self>=value.
__getattribute__
(name, /)Return getattr(self, name).
__gt__
(value, /)Return self>value.
__hash__
()Return hash(self).
__init__
()Initialize self.
__init_subclass__
This method is called when a class is subclassed.
__le__
(value, /)Return self<=value.
__lt__
(value, /)Return self<value.
__ne__
(value, /)Return self!=value.
__new__
(**kwargs)Create and return a new object.
__reduce__
()Helper for pickle.
__reduce_ex__
(protocol, /)Helper for pickle.
__repr__
()Return repr(self).
__setattr__
(name, value, /)Implement setattr(self, name, value).
__sizeof__
()Size of object in memory, in bytes.
__str__
()Return str(self).
__subclasshook__
Abstract classes can override this to customize issubclass().
_get_console
()_get_theme
()_retrieve_name
(variable)center
(text, *args, **kwargs)command
(text, *args, **kwargs)debug
(text[, variables, level, markdown])Print a debug string to the console.
debugging_enabled
([level])Return whether debug output is enabled (optionally for the specified level) - if not, then anything sent to ‘debug’ (for that level) is not printed
error
(text, *args, **kwargs)Print an error to the console
info
(text, *args, **kwargs)Print an info section to the console
panel
(text[, markdown, width, padding, …])Print within a panel to the console
print
(text[, markdown, style, markup])Print to the console
Print the current-handled exception
print_population
(population[, demographics])print_profiler
(profiler, *args, **kwargs)progress
([visible, show_limit])redirect_output
(outdir[, auto_bzip])Redirect all output and error to the directory ‘outdir’
rule
([title, style])Write a rule across the screen with optional title
save
(file)Save the accumulated printing to the console to ‘file’.
set_debugging_enabled
(enabled[, level])Switch on or off debugging output
set_theme
(theme)Set the theme used for the console - this should be one of the themes in metawards.themes
set_use_progress
([use_progress])set_use_spinner
([use_spinner])spinner
([text])Return whether or not you can print emojis to this console
warning
(text, *args, **kwargs)Print a warning to the console
Attributes
__dict__
__doc__
__module__
__weakref__
list of weak references to the object (if defined)
-
static
debug
(text: str, variables: Optional[List[any]] = None, level: Optional[int] = None, markdown: bool = False, **kwargs)[source]¶ Print a debug string to the console. This will only be printed if debugging is enabled. You can also print the values of variables by passing them as a list to ‘variables’
-
static
debugging_enabled
(level: Optional[int] = None)[source]¶ Return whether debug output is enabled (optionally for the specified level) - if not, then anything sent to ‘debug’ (for that level) is not printed
-
static
panel
(text: str, markdown: bool = False, width=None, padding: bool = True, style: Optional[str] = None, expand=True, *args, **kwargs)[source]¶ Print within a panel to the console
-
static
print
(text: str, markdown: bool = False, style: Optional[str] = None, markup: Optional[bool] = None, *args, **kwargs)[source]¶ Print to the console
-
static
redirect_output
(outdir: str, auto_bzip: bool = True)[source]¶ Redirect all output and error to the directory ‘outdir’
-
static
rule
(title: Optional[str] = None, style=None, **kwargs)[source]¶ Write a rule across the screen with optional title
-
static
save
(file: Union[str, IO])[source]¶ Save the accumulated printing to the console to ‘file’. This can be a file or a filehandle. The buffer is cleared after saving
-