chore: 添加虚拟环境到仓库

- 添加 backend_service/venv 虚拟环境
- 包含所有Python依赖包
- 注意:虚拟环境约393MB,包含12655个文件
This commit is contained in:
2025-12-03 10:19:25 +08:00
parent a6c2027caa
commit c4f851d387
12655 changed files with 3009376 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
import sys
from typing import Any, Awaitable, Callable, TypeVar
from frozenlist import FrozenList
if sys.version_info >= (3, 11):
from typing import Unpack
else:
from typing_extensions import Unpack
if sys.version_info >= (3, 13):
from typing import TypeVarTuple
else:
from typing_extensions import TypeVarTuple
_T = TypeVar("_T")
_Ts = TypeVarTuple("_Ts", default=Unpack[tuple[()]])
__version__ = "1.4.0"
__all__ = ("Signal",)
class Signal(FrozenList[Callable[[Unpack[_Ts]], Awaitable[object]]]):
"""Coroutine-based signal implementation.
To connect a callback to a signal, use any list method.
Signals are fired using the send() coroutine, which takes named
arguments.
"""
__slots__ = ("_owner",)
def __init__(self, owner: object):
super().__init__()
self._owner = owner
def __repr__(self) -> str:
return "<Signal owner={}, frozen={}, {!r}>".format(
self._owner, self.frozen, list(self)
)
async def send(self, *args: Unpack[_Ts], **kwargs: Any) -> None:
"""
Sends data to all registered receivers.
"""
if not self.frozen:
raise RuntimeError("Cannot send non-frozen signal.")
for receiver in self:
await receiver(*args, **kwargs)
def __call__(
self, func: Callable[[Unpack[_Ts]], Awaitable[_T]]
) -> Callable[[Unpack[_Ts]], Awaitable[_T]]:
"""Decorator to add a function to this Signal."""
self.append(func)
return func