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 trait import func, traited, Trait | |
class ListTrait(Trait, bound=list): | |
def do(self): | |
print("Another ListTrait", *self) | |
@traited | |
def another_func(data): |
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 logging import getLogger | |
from typing import ClassVar, TypeVar, Optional, Protocol, Dict, Type | |
logger = getLogger(__name__) | |
class Cachable(Protocol): | |
@classmethod | |
def get_model_name(self) -> str: |
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 | |
from threading import Thread | |
class Storage: | |
def __init__(self): | |
self.data = {} | |
def get(self, k): | |
res = self.data.get(k) |
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 | |
import logging | |
from typing import Dict | |
from aiogram import Bot, Dispatcher | |
from aiogram.contrib.fsm_storage.memory import MemoryStorage | |
from aiogram.dispatcher.filters.state import StatesGroup, State | |
from aiogram.types import Message | |
from aiogram_dialog import Dialog, DialogManager, DialogRegistry, Window |
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
Window( | |
Const( | |
"Greetings! SOme very very very very very very very very very very very very very very long descr" | |
), | |
ListGroup( | |
Checkbox( | |
Format("✓ {item}"), | |
Format(" {item}"), | |
id="check", | |
), |
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 uuid | |
from fastapi import FastAPI, Depends | |
app = FastAPI() | |
class Session: | |
pass |
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, field | |
# Tokens | |
from typing import List, Iterable | |
import yaml | |
@dataclass | |
class Token: | |
text: str |
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
def merge(rule): | |
def merge(a, b): | |
res = {} | |
for key in a.keys() | b.keys(): | |
res[key] = rule[key](a.get(key), b.get(key)) | |
return res | |
return merge | |
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 | |
import logging | |
import operator | |
from typing import Any | |
from aiogram import Bot, Dispatcher | |
from aiogram.contrib.fsm_storage.memory import MemoryStorage | |
from aiogram.dispatcher.filters.state import StatesGroup, State | |
from aiogram.types import CallbackQuery |
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 | |
import logging | |
from typing import Any | |
from aiogram import Bot, Dispatcher | |
from aiogram.contrib.fsm_storage.memory import MemoryStorage | |
from aiogram.dispatcher.filters.state import StatesGroup, State | |
from aiogram.types import CallbackQuery | |
from aiogram_dialog import Dialog, DialogManager, Window, DialogRegistry, Data |