mirror of
https://github.com/PaiGramTeam/GramCore.git
synced 2024-11-21 13:48:20 +00:00
💄 Format with black 24.x.x
This commit is contained in:
parent
968b3fd52d
commit
3057fba7a6
@ -1,4 +1,5 @@
|
||||
"""BOT"""
|
||||
|
||||
import asyncio
|
||||
import signal
|
||||
from functools import wraps
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""上下文管理"""
|
||||
|
||||
from contextlib import contextmanager
|
||||
from contextvars import ContextVar
|
||||
from typing import TYPE_CHECKING
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""参数分发器"""
|
||||
|
||||
import asyncio
|
||||
import inspect
|
||||
from abc import ABC, abstractmethod
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""执行器"""
|
||||
|
||||
import inspect
|
||||
from functools import cached_property
|
||||
from multiprocessing import RLock as Lock
|
||||
|
@ -44,7 +44,9 @@ class AioBrowser(BaseService.Dependence):
|
||||
"[blue bold]playwright install chromium[/]",
|
||||
extra={"markup": True},
|
||||
)
|
||||
raise RuntimeError("检查到 playwright 刚刚安装或者未升级\n请运行以下命令下载新浏览器\nplaywright install chromium")
|
||||
raise RuntimeError(
|
||||
"检查到 playwright 刚刚安装或者未升级\n请运行以下命令下载新浏览器\nplaywright install chromium"
|
||||
)
|
||||
raise err
|
||||
|
||||
return self._browser
|
||||
|
10
manager.py
10
manager.py
@ -37,7 +37,11 @@ def _load_module(path: Path) -> None:
|
||||
import_module(pkg)
|
||||
except Exception as e:
|
||||
logger.exception(
|
||||
'在导入 "%s" 的过程中遇到了错误 [red bold]%s[/]', pkg, type(e).__name__, exc_info=e, extra={"markup": True}
|
||||
'在导入 "%s" 的过程中遇到了错误 [red bold]%s[/]',
|
||||
pkg,
|
||||
type(e).__name__,
|
||||
exc_info=e,
|
||||
extra={"markup": True},
|
||||
)
|
||||
raise SystemExit from e
|
||||
|
||||
@ -205,7 +209,9 @@ class ServiceManager(Manager[BaseServiceType]):
|
||||
):
|
||||
_load_module(path)
|
||||
|
||||
for service in filter(lambda x: not x.is_component and not x.is_dependence, get_all_services()): # 遍历所有服务类
|
||||
for service in filter(
|
||||
lambda x: not x.is_component and not x.is_dependence, get_all_services()
|
||||
): # 遍历所有服务类
|
||||
instance = await self._initialize_service(service)
|
||||
|
||||
self._lib[service] = instance
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""重写 telegram.request.HTTPXRequest 使其使用 ujson 库进行 json 序列化"""
|
||||
|
||||
from typing import Any, AsyncIterable, Optional
|
||||
|
||||
import httpcore
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""插件"""
|
||||
|
||||
import datetime
|
||||
import re
|
||||
from dataclasses import dataclass, field
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""插件"""
|
||||
|
||||
import asyncio
|
||||
from abc import ABC
|
||||
from dataclasses import asdict
|
||||
@ -292,7 +293,9 @@ class _Conversation(_Plugin, ConversationFuncs, ABC):
|
||||
temp_dict = {"entry_points": entry_points, "states": states, "fallbacks": fallbacks}
|
||||
reason = map(lambda x: f"'{x[0]}'", filter(lambda x: not x[1], temp_dict.items()))
|
||||
logger.warning(
|
||||
"'%s' 因缺少 '%s' 而生成无法生成 ConversationHandler", self.__class__.__name__, ", ".join(reason)
|
||||
"'%s' 因缺少 '%s' 而生成无法生成 ConversationHandler",
|
||||
self.__class__.__name__,
|
||||
", ".join(reason),
|
||||
)
|
||||
return self._handlers
|
||||
|
||||
|
@ -107,7 +107,12 @@ class PublicCookiesService:
|
||||
continue
|
||||
try:
|
||||
await self.check_public_cookie(region, cookies, public_id)
|
||||
logger.info("用户 user_id[%s] 请求用户 user_id[%s] 的公共Cookies 该Cookies使用次数为%s次 ", user_id, public_id, count)
|
||||
logger.info(
|
||||
"用户 user_id[%s] 请求用户 user_id[%s] 的公共Cookies 该Cookies使用次数为%s次 ",
|
||||
user_id,
|
||||
public_id,
|
||||
count,
|
||||
)
|
||||
return cookies
|
||||
except NeedContinue:
|
||||
continue
|
||||
@ -118,7 +123,9 @@ class PublicCookiesService:
|
||||
cookies.status = status
|
||||
await self._repository.update(cookies)
|
||||
await self._cache.delete_public_cookies(cookies.user_id, cookies.region)
|
||||
logger.info("用户 user_id[%s] 反馈用户 user_id[%s] 的Cookies状态为 %s", user_id, cookies.user_id, status.name)
|
||||
logger.info(
|
||||
"用户 user_id[%s] 反馈用户 user_id[%s] 的Cookies状态为 %s", user_id, cookies.user_id, status.name
|
||||
)
|
||||
else:
|
||||
logger.info("用户 user_id[%s] 撤销一次公共Cookies计数", user_id)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user