Utils¶
- class game_state.utils.StateArgs(*, state_name, **kwargs)¶
A dataclass to send data to states while loading them in the manager.
Added in version 2.1.
- Parameters:
- game_state.utils.MISSING = _MissingSentinel()¶
Used in areas where an attribute doesn’t have a value by default but gets defined during runtime. Lesser type checking would be required by using this, opposed to using some other default value such as
None.Added in version 2.0.1.
- game_state.utils.setup_logging(*, handler=None, formatter=None, level=None, root=True) = <function setup_logging>¶
A helper function to setup logging.
This is superficially similar to
logging.basicConfig()but uses different defaults and a colour formatter if the stream can display colour.Added in version 2.4.
- Parameters:
- The log handler to use for the library’s logger.The default log handler if not provided is
logging.StreamHandler. formatter (
Optional[Formatter]) –The formatter to use with the given log handler.If not provided then it defaults to a colour based logging formatter (if available).If colour is not available then a simple logging formatter is provided.- The default log level for the library’s logger. Defaults to
logging.DEBUG. root (
bool) –Whether to set up the root logger rather than the library logger.
- Return type: