mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 09:05:04 +08:00
🎨 fix linter error
This commit is contained in:
parent
da16bdbb96
commit
8e915f808b
@ -195,8 +195,9 @@ class Driver(ReverseDriver):
|
|||||||
self, http_request)
|
self, http_request)
|
||||||
|
|
||||||
if not x_self_id:
|
if not x_self_id:
|
||||||
raise HTTPException(response and response.status or 401,
|
raise HTTPException(
|
||||||
response.body)
|
response and response.status or 401, response and
|
||||||
|
response.body and response.body.decode("utf-8"))
|
||||||
|
|
||||||
if x_self_id in self._clients:
|
if x_self_id in self._clients:
|
||||||
logger.warning("There's already a reverse websocket connection,"
|
logger.warning("There's already a reverse websocket connection,"
|
||||||
|
@ -48,11 +48,11 @@ class Filter:
|
|||||||
self.level: Union[int, str] = "DEBUG"
|
self.level: Union[int, str] = "DEBUG"
|
||||||
|
|
||||||
def __call__(self, record):
|
def __call__(self, record):
|
||||||
module = sys.modules.get(record["name"])
|
module_name: str = record["name"]
|
||||||
|
module = sys.modules.get(module_name)
|
||||||
if module:
|
if module:
|
||||||
module_name = getattr(module, "__module_name__", record["name"])
|
module_name = getattr(module, "__module_name__", module_name)
|
||||||
record["name"] = module_name
|
record["name"] = module_name.split(".")[0]
|
||||||
record["name"] = record["name"].split(".")[0]
|
|
||||||
levelno = logger.level(self.level).no if isinstance(self.level,
|
levelno = logger.level(self.level).no if isinstance(self.level,
|
||||||
str) else self.level
|
str) else self.level
|
||||||
return record["level"].no >= levelno
|
return record["level"].no >= levelno
|
||||||
@ -67,7 +67,7 @@ class LoguruHandler(logging.Handler):
|
|||||||
level = record.levelno
|
level = record.levelno
|
||||||
|
|
||||||
frame, depth = logging.currentframe(), 2
|
frame, depth = logging.currentframe(), 2
|
||||||
while frame.f_code.co_filename == logging.__file__:
|
while frame and frame.f_code.co_filename == logging.__file__:
|
||||||
frame = frame.f_back
|
frame = frame.f_back
|
||||||
depth += 1
|
depth += 1
|
||||||
|
|
||||||
|
@ -141,8 +141,8 @@ def USER(*user: str, perm: Optional[Permission] = None):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
async def _user(bot: "Bot", event: "Event") -> bool:
|
async def _user(bot: "Bot", event: "Event") -> bool:
|
||||||
return event.get_session_id() in user and bool(perm) and await perm(
|
return bool(event.get_session_id() in user and perm and
|
||||||
bot, event)
|
await perm(bot, event))
|
||||||
|
|
||||||
return Permission(_user)
|
return Permission(_user)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user