Compatibility utilities.


Return the currently running task in an event loop or None.

By default the current task for the current event loop is returned.

None is returned when called not in the context of a Task.

class mode.utils.compat.AsyncContextManager
class mode.utils.compat.ChainMap(*maps)
class mode.utils.compat.Counter(**kwds)
class mode.utils.compat.Deque

alias of builtins.dict

mode.utils.compat.want_bytes(s: AnyStr) → bytes

Convert string to bytes.

mode.utils.compat.want_str(s: AnyStr) → str

Convert bytes to string.

mode.utils.compat.isatty(fh: IO) → bool

Return True if fh has a controlling terminal.


Use with e.g. sys.stdin.

class mode.utils.compat.DummyContext(enter_result: Any = None)

Context for with-statement doing nothing.

enter_result = None