Skip to content

Instantly share code, notes, and snippets.

View thunderamur's full-sized avatar

thunderamur thunderamur

View GitHub Profile
@thunderamur
thunderamur / async.py
Created December 15, 2020 08:41 — forked from konpatp/async.py
Python turn sync functions to async (and async to sync)
import functools
def force_async(fn):
'''
turns a sync function to async function using threads
'''
from concurrent.futures import ThreadPoolExecutor
import asyncio
pool = ThreadPoolExecutor()