This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio as aio | |
| import itertools | |
| import logging | |
| import typing as t | |
| import dataclasses | |
| import contextvars | |
| from uuid import uuid4 | |
| from enum import IntEnum | |
| from contextvars import ContextVar | |
| from dataclasses import dataclass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import typing as t | |
| import asyncio as aio | |
| class Producer[T](t.Protocol): | |
| async def put(self, item: T) -> None: ... | |
| def put_nowait(self, item: T) -> None: ... | |
| def multi_put_nowait[T](queues: t.Iterable[Producer[T]], item: T) -> None: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import contextlib | |
| import functools | |
| import json | |
| import typing as t | |
| import hashlib | |
| from types import MethodType | |
| import pydantic | |
| import pydantic_core | |
| from temporalio import workflow as wf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| This module provides a declarative way to describe delay strategies for controlling the interval between repeated actions, such as retrying a network request. | |
| There are two categories of strategies: | |
| 1. Root Strategies: These provide the base logic for calculating delay time. | |
| - Linear: Increases delay time linearly. | |
| - Exponential: Increases delay time exponentially. | |
| 2. Modifier Strategies: These adjust the delay time calculated by a root strategy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # NOTE(zeronineseven): Heavily based on https://gist.github.com/denBot/4136279812f87819f86d99eba77c1ee0 | |
| import asyncio | |
| import contextlib | |
| import json | |
| from contextlib import AsyncExitStack | |
| from pathlib import Path | |
| from typing import AsyncContextManager, Protocol, AsyncIterator, Never | |
| import win32event | |
| import win32pipe |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from ctypes import windll, Structure, c_char, c_ushort, c_char_p, POINTER, c_int, WinError | |
| from ctypes.wintypes import WORD | |
| from typing import Literal, TypeAlias | |
| __all__ = "test", | |
| _ExtraInfo: TypeAlias = Literal["peername", "socket", "sockname"] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from types import SimpleNamespace | |
| from typing import Any | |
| __all__ = "NamespaceMeta", "Namespace" | |
| class NamespaceMeta(type): | |
| """Provides namespacing infrastructure. | |
| This metaclass provides an alternative (and hopefully more convenient) syntax for creating 'types.SimpleNamespace' | |
| instances using 'class' syntax. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import weakref | |
| import inspect | |
| from asyncio import Future | |
| from typing import Any, Callable, TypeVar, Protocol, Awaitable, Generator | |
| __all__ = "Listenable", "Signal", | |
| _T = TypeVar("_T", covariant=True) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import operator as op | |
| import sqlalchemy as sa | |
| __all__ = "anyof_constraint", | |
| def anyof_constraint(*cols, at_least_one: bool = False) -> sa.CheckConstraint: | |
| if len(cols) < 2: | |
| raise ValueError("At least 2 columns MUST be provided to create any-of constraint!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import TypeAlias, Type | |
| from frozendict import frozendict | |
| import sqlalchemy as sa | |
| import sqlalchemy.types | |
| import sqlalchemy.event | |
| import sqlalchemy.schema | |
| import sqlalchemy.sql.sqltypes | |
| __all__ = "define_composite", "CreateComposite", "DropComposite" |
NewerOlder