trololio
Trololio allows your program to have a soft dependency on trollius
in Python versions where py3:asyncio
(aka Tulip) is part of the standard library.
Trololio provides a compatibility layer for Trollius and asyncio, it addresses the differences listed in Trollius and Tulip:
- Allows the use of Trollius' syntax with
py3:asyncio
. - Provides missing objects and aliases for the others.
- Synchronizes debug environment variables.
Documentation for Trollius and py3:asyncio
.
genindex
search
- If your code was written for asyncio, convert it to use Trollius.
Change your
trollius
imports:- from trollius import coroutine, From, Return + from trololio import coroutine, From, Return - import trollius + from trololio import asyncio
If you used the second import style:
- trollius.* + [trololio.]asyncio.*
- note
Make sure you use
coroutine
,From
andReturn
fromtrololio
and notasyncio
. Otherwise anImportError
will be raised when running withpy3:asyncio
(Tulip).
ASYNCIO
A boolean indicating if asyncio
(trololio
's submodule) is py3:asyncio
(Tulip).
TROLLIUS
A boolean indicating if asyncio
(trololio
's submodule) is trollius:trollius
.
ASYNCIO
and TROLLIUS
are always of opposite value.
The following objects are aliases for the trollius:trollius
ones, or defined by trololio
.
coroutine
trollius:trollius.coroutine
or equivalent allowing yield From(x)
.
From
trollius:trollius.From
or equivalent.
Return
trollius:trollius.Return
or equivalent.
BACKPORT_SSL_ERRORS
trollius:trollius.BACKPORT_SSL_ERRORS
or False
.
BACKPORT_SSL_CONTEXT
trollius:trollius.BACKPORT_SSL_CONTEXT
or False
.
The following objects are aliases for the trollius:trollius
ones, or aliases for the standard library ones.
BlockingIOError
trollius:trollius.BlockingIOError
or py3:BlockingIOError
.
BrokenPipeError
trollius:trollius.BrokenPipeError
or py3:BrokenPipeError
.
ChildProcessError
trollius:trollius.ChildProcessError
or py3:ChildProcessError
.
ConnectionAbortedError
trollius:trollius.ConnectionAbortedError
or py3:ConnectionAbortedError
.
ConnectionRefusedError
trollius:trollius.ConnectionRefusedError
or py3:ConnectionRefusedError
.
ConnectionResetError
trollius:trollius.ConnectionResetError
or py3:ConnectionResetError
.
FileNotFoundError
trollius:trollius.FileNotFoundError
or py3:FileNotFoundError
.
InterruptedError
trollius:trollius.InterruptedError
or py3:InterruptedError
.
PermissionError
trollius:trollius.PermissionError
or py3:PermissionError
.
SSLEOFError
trollius:trollius.SSLEOFError
or py3:ssl.SSLEOFError
.
SSLWantReadError
trollius:trollius.SSLWantReadError
or py3:ssl.SSLWantReadError
.
SSLWantWriteError
trollius:trollius.SSLWantWriteError
or py3:ssl.SSLWantWriteError
.
trollius.SSLContext
or py3:ssl.SSLContext
.
asyncio
Trololio provides the asyncio
submodule. It is either trollius:trollius
, the first choice, or py3:asyncio
(Tulip), the fallback.
- note
If neither module was found, an
ImportError
is raised.