Skip to content

Instantly share code, notes, and snippets.

import trio
import sys
import time
import httpx
from outcome import Error
import traceback
# Can't use PySide2 currently because of
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1313
from PyQt5 import QtCore, QtWidgets
@stereobutter
stereobutter / example.py
Created November 17, 2021 18:21
TrioLoop
import trio
from .trio_loop import TrioLoop
async def foo(data):
await trio.sleep(1)
return data
with TrioLoop() as loop:
data = loop.wait(foo('hello world'))
print(data)
@agronholm
agronholm / sqlite.py
Last active September 29, 2023 13:05
My version of anysqlite
from __future__ import annotations
__all__ = ["connect", "Connection", "Cursor"]
import sqlite3
from collections.abc import Callable, Sequence
from functools import partial, wraps
from typing import Any
from anyio import CapacityLimiter, to_thread
"""
Testing on CPython3.13a1+
Requires some recent patches from main.
pip install hypercorn
Have successfully run the following apps:
- fastapi==0.99.0
- Flask
"""