1
0
mirror of synced 2024-11-25 18:54:22 +01:00

Please mypy

Mypy doesn't like some annotation in web.py,
this commits aims at pleasing it.
This commit is contained in:
jvoisin 2019-12-29 14:45:20 +01:00
parent 0902e9e330
commit 693408f1a6

View File

@ -159,7 +159,8 @@ class _HTMLParser(parser.HTMLParser):
if data.strip(): if data.strip():
self.__textrepr += escape(data) self.__textrepr += escape(data)
def handle_startendtag(self, tag: str, attrs: List[Tuple[str, str]]): def handle_startendtag(self, tag: str,
attrs: List[Tuple[str, Optional[str]]]):
if tag in self.tag_required_blocklist | self.tag_blocklist: if tag in self.tag_required_blocklist | self.tag_blocklist:
meta = {k:v for k, v in attrs} meta = {k:v for k, v in attrs}
name = meta.get('name', 'harmful metadata') name = meta.get('name', 'harmful metadata')