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 Callable | |
| from sanic.blueprints import Blueprint | |
| from sanic.request import Request | |
| from sanic import Sanic, text | |
| from sanic.response import HTTPResponse | |
| from sanic.views import HTTPMethodView | |
| from sanic_ext.extensions.templating import render | |
| def template( |
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 enum import IntFlag, EnumMeta | |
| class BaseExt(IntFlag): | |
| __extending__ = None | |
| @classmethod | |
| def append(cls, members: list[tuple[str, int]]): | |
| _members = BaseExt(cls.__name__, members) | |
| for member in _members: |
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 queue import Queue | |
| from threading import Thread | |
| def threaded_task(fn): | |
| fn.queue = Queue() | |
| def worker(): | |
| while True: | |
| self, num = fn.queue.get() |