fix some mypy lint
This commit is contained in:
parent
9d7d80d3a5
commit
7c7a1fcde2
6 changed files with 20 additions and 6 deletions
|
|
@ -46,7 +46,7 @@ class Bot:
|
|||
self.message_handlers.append(callback)
|
||||
|
||||
def on_command(self, command: Union[str, Container[str]], callback: MessageHandler):
|
||||
commands = command = {command} if type(command) is str else command
|
||||
commands = {command} if type(command) is str else command
|
||||
|
||||
async def guard(message):
|
||||
if message.command not in commands:
|
||||
|
|
@ -161,7 +161,7 @@ class Bot:
|
|||
for h, t in tasks.items():
|
||||
assert t.done()
|
||||
try:
|
||||
err = t.exception()
|
||||
err = t.exception() # type: ignore
|
||||
except asyncio.CancelledError:
|
||||
log.error("Message handler took too long to finished: %s", h)
|
||||
if err is not None:
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import unicodedata
|
||||
from collections import defaultdict
|
||||
from contextlib import contextmanager
|
||||
from dataclasses import dataclass, fields
|
||||
from dataclasses import fields
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from html import escape as html_escape
|
||||
from html.parser import HTMLParser
|
||||
|
|
@ -311,7 +311,7 @@ class ElementParser(HTMLParser):
|
|||
break
|
||||
|
||||
|
||||
def escape_all(dc: dataclass, escape: Callable[[str], str] = html_escape) -> None:
|
||||
def escape_all(dc, escape: Callable[[str], str] = html_escape) -> None:
|
||||
"""Patch a dataclass to escape all strings."""
|
||||
for f in fields(dc):
|
||||
if f.type is str:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue