Skip to content
Permalink
Browse files
fix: update for minimum of Python 3.7 (#1509)
  • Loading branch information
jdblischak committed Mar 23, 2022
1 parent 5f7170e commit 62024e2bfd6d5735763f37a0f4bf43a16f229443
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 30 deletions.
@@ -106,7 +106,7 @@
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
)
@@ -21,7 +21,7 @@
del get_versions


MIN_PY_VERSION = (3, 5)
MIN_PY_VERSION = (3, 7)
DYNAMIC_FILL = "__snakemake_dynamic__"
SNAKEMAKE_SEARCHPATH = str(Path(__file__).parent.parent.parent)
UUID_NAMESPACE = uuid.uuid5(uuid.NAMESPACE_URL, "https://snakemake.readthedocs.io")
@@ -32,30 +32,19 @@
ON_WINDOWS = platform.system() == "Windows"


if sys.version_info < (3, 7):

def async_run(coroutine):
loop = asyncio.get_event_loop()
return loop.run_until_complete(coroutine)

else:

def async_run(coroutine):
"""Attaches to running event loop or creates a new one to execute a
coroutine.
.. seealso::
https://github.com/snakemake/snakemake/issues/1105
https://stackoverflow.com/a/65696398
"""
try:
_ = asyncio.get_running_loop()
except RuntimeError:
asyncio.run(coroutine)
else:
asyncio.create_task(coroutine)
def async_run(coroutine):
"""Attaches to running event loop or creates a new one to execute a
coroutine.
.. seealso::
https://github.com/snakemake/snakemake/issues/1105
https://stackoverflow.com/a/65696398
"""
try:
_ = asyncio.get_running_loop()
except RuntimeError:
asyncio.run(coroutine)
else:
asyncio.create_task(coroutine)


# A string that prints as TBD
@@ -53,10 +53,7 @@ async def main():
async_run(dummy_task())
test_run_script_directive()

if sys.version_info < (3, 7):
async_run(main())
else:
asyncio.run(main())
asyncio.run(main())


def test_dicts_in_config():

0 comments on commit 62024e2

Please sign in to comment.