Skip to content

Instantly share code, notes, and snippets.

View blackbalancef's full-sized avatar

Ivan Matveev blackbalancef

  • Constructor Tech
  • Belgrade
View GitHub Profile
@blackbalancef
blackbalancef / async.py
Created August 30, 2022 09:32 — 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()