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 inspect import signature, Parameter | |
| from typing import get_type_hints, Unpack, get_origin, get_args, TypedDict | |
| class _ExampleTypedDict(TypedDict): | |
| pass | |
| TypedDictMeta = type(_ExampleTypedDict) |
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 sys | |
| import types | |
| def module(cls): | |
| class tmp(cls, types.ModuleType): | |
| pass | |
| tmp.__name__ = cls.__name__ | |
| instance = tmp(f"{cls.__module__}.{cls.__name__}") |
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 dataclasses import field, dataclass | |
| class ID: | |
| def __init__(self, value: int | None = None): | |
| self.value = value | |
| def set(self, value: int): | |
| if self.value is not None: | |
| raise ValueError("Value already exists") |
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 dataclasses import dataclass | |
| from typing import Any, TypedDict | |
| from adaptix import Retort, CannotProvide, name_mapping, loader, Chain | |
| from adaptix._internal.provider.loc_stack_filtering import LocStack, P | |
| from adaptix._internal.provider.location import TypeHintLoc | |
| from adaptix._internal.provider.shape_provider import InputShapeRequest | |
| class ClassTOTD: |
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 dataclasses import dataclass | |
| from pathlib import Path | |
| import grpc | |
| from google._upb._message import FieldDescriptor | |
| from adaptix import TypeHint | |
| from adaptix._internal.conversion.facade.func import get_converter | |
| from adaptix._internal.model_tools.definitions import ( | |
| InputShape, InputField, NoDefault, Param, ParamKind, OutputShape, |
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 importlib | |
| import os | |
| from typing import Iterator | |
| import alembic.command | |
| import alembic.config | |
| import psycopg | |
| import pytest | |
| import pytest_asyncio | |
| from sqlalchemy import NullPool |
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
| class JwtIdProvider(IdentityProvider): | |
| def __init__(self, jwk_uri: str, aud: str, context: ServicerContext) -> None: | |
| self.jwks_client = PyJWKClient(jwk_uri) | |
| self.aud = aud | |
| self.context = context | |
| async def get_user(self) -> User | None: | |
| for header, value in self.context.invocation_metadata(): | |
| if header != "authorization": | |
| continue |
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
| class A: | |
| def foo(self): | |
| print("foo") |
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 collections.abc import AsyncIterator, Iterator | |
| from contextlib import contextmanager | |
| from typing import TypeVar | |
| from dishka import ( | |
| DEFAULT_COMPONENT, | |
| AsyncContainer, | |
| Container, | |
| make_async_container, | |
| make_container, |
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
| # logic | |
| MOD x = y | |
| x = MOD.__transform__(t"{y}") # lazy evaluation | |
| x = MOD(y) # general case | |
| # unpack | |
| MOD1 x, MOD2 y = z | |
| _x, _y = z | |
| x = MOD1(x), MOD2(y) |
NewerOlder