asyncutils.config¶
Set up some module-global state and sentinels, and expose some user-specified flags.
Attributes¶
Whether the user specified not to use the functions from |
|
A global instance of the |
|
Whether all submodules of this module have been loaded. |
|
The name (path; possibly relative) of the log file currently used by this library as a string, with four exceptions: |
|
Maximum number of memory errors that can occur before the console automatically exits. Negative if and only if there is no maximum. |
|
Whether the user specified to drop into the debugger on an unhandled exception in the REPL console. |
|
Whether the user requested to run the program with no banner and exit message in the REPL. |
Classes¶
A class that implements the PEP 3148 executor interface. |
|
A context manager used to enter and exit debug mode, ensuring restoration of the original level if the level has not been modified externally within the context using |
Functions¶
|
Return all stored logs as a string. Logs are only stored if asyncutils was started with |
|
Set the level of the module-global logger to |
Module Contents¶
- class asyncutils.config.Executor¶
Bases:
concurrent.futures._base.Executor,asyncutils._internal.types.PartialInterfaceA class that implements the PEP 3148 executor interface.
Note
The exact class is determined at runtime by command-line arguments.
Tip
Since instances of this class are only ever passed into
run_in_executor(), nothing stops you from monkey-patching the event loop itself or policy thereof, and using a custom class that does not follow the interface, but that may be too hacky and fragile.Tip
If you know your application only uses a specific executor, import this symbol at runtime and import the actual class in the stub or in an
if TYPE_CHECKING:block where applicable to help type checkers.
- class asyncutils.config.debugging[source]¶
A context manager used to enter and exit debug mode, ensuring restoration of the original level if the level has not been modified externally within the context using
set_logger_level().- __enter__() Self[source]¶
Start debugging. More output is produced; where to depends on the user’s own configuration, accessible via
logging_toanddebug.level.
- __exit__(exc_typ: asyncutils._internal.types.ExcType, exc_val: BaseException, exc_tb: types.TracebackType, /) None[source]¶
- __exit__(exc_typ: None, exc_val: None, exc_tb: None, /) None
Stop debugging, restoring the output to its previous level if appropriate.
- property level: int¶
The current level of the
asyncutilslogger, as an integer.
- asyncutils.config.get_past_logs() str¶
Return all stored logs as a string. Logs are only stored if asyncutils was started with
-l MEMORY, otherwise an empty string is returned.
- asyncutils.config.set_logger_level(level: int) None¶
Set the level of the module-global logger to
level.
- asyncutils.config.basic_repl: Final[bool]¶
Whether the user specified not to use the functions from
_pyreplto run the console.
- asyncutils.config.debug: Final[debugging]¶
A global instance of the
debuggingcontext manager. Initially entered if and only if the user specified-dor--debugwhen starting the program.
- asyncutils.config.logging_to: Final[str]¶
The name (path; possibly relative) of the log file currently used by this library as a string, with four exceptions:
'NULL': no logging is taking place'MEMORY': the logs are not going to a physical file but can be retrieved byget_past_logs()'STDOUT': logging is going tosys.stdout'STDERR': logging is going tosys.stderr(following the default and fallback behaviour oflogging)
- asyncutils.config.max_memerrs: Final[int]¶
Maximum number of memory errors that can occur before the console automatically exits. Negative if and only if there is no maximum.