Skip to content

Instantly share code, notes, and snippets.

View jerryyin's full-sized avatar

Zhuoran Yin jerryyin

View GitHub Profile
@konpatp
konpatp / async.py
Last active September 13, 2025 19:34
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()