diff options
author | Federico Caselli <cfederico87@gmail.com> | 2021-11-21 21:17:27 +0100 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2021-11-24 22:51:27 -0500 |
commit | 31acba8ff7c123a20ae308b7f4ab6df3df264b48 (patch) | |
tree | a4c39a2123e1b95edf17995ba85bb69ee619f6e4 /lib/sqlalchemy/util/concurrency.py | |
parent | d3a4e96196cd47858de072ae589c6554088edc24 (diff) | |
download | sqlalchemy-31acba8ff7c123a20ae308b7f4ab6df3df264b48.tar.gz |
Clean up most py3k compat
Change-Id: I8172fdcc3103ff92aa049827728484c8779af6b7
Diffstat (limited to 'lib/sqlalchemy/util/concurrency.py')
-rw-r--r-- | lib/sqlalchemy/util/concurrency.py | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/lib/sqlalchemy/util/concurrency.py b/lib/sqlalchemy/util/concurrency.py index 37ecfdbc3..3518f874d 100644 --- a/lib/sqlalchemy/util/concurrency.py +++ b/lib/sqlalchemy/util/concurrency.py @@ -5,30 +5,25 @@ # This module is part of SQLAlchemy and is released under # the MIT License: https://www.opensource.org/licenses/mit-license.php -from . import compat have_greenlet = False -if compat.py3k: - try: - import greenlet # noqa F401 - except ImportError: - pass - else: - have_greenlet = True - from ._concurrency_py3k import await_only - from ._concurrency_py3k import await_fallback - from ._concurrency_py3k import greenlet_spawn - from ._concurrency_py3k import is_exit_exception - from ._concurrency_py3k import AsyncAdaptedLock - from ._concurrency_py3k import _util_async_run # noqa F401 - from ._concurrency_py3k import ( - _util_async_run_coroutine_function, - ) # noqa F401, E501 - from ._concurrency_py3k import asyncio # noqa F401 - - # does not need greennlet, just Python 3 - from ._compat_py3k import asynccontextmanager # noqa F401 +try: + import greenlet # noqa F401 +except ImportError: + pass +else: + have_greenlet = True + from ._concurrency_py3k import await_only + from ._concurrency_py3k import await_fallback + from ._concurrency_py3k import greenlet_spawn + from ._concurrency_py3k import is_exit_exception + from ._concurrency_py3k import AsyncAdaptedLock + from ._concurrency_py3k import _util_async_run # noqa F401 + from ._concurrency_py3k import ( + _util_async_run_coroutine_function, + ) # noqa F401, E501 + from ._concurrency_py3k import asyncio # noqa F401 if not have_greenlet: @@ -40,12 +35,9 @@ if not have_greenlet: if have_greenlet: return None - if not compat.py3k: - raise ValueError("Cannot use this function in py2.") - else: - raise ValueError( - "the greenlet library is required to use this function." - ) + raise ValueError( + "the greenlet library is required to use this function." + ) def is_exit_exception(e): # noqa F811 return not isinstance(e, Exception) |