Commit d57fa80f authored by satan's avatar satan Committed by Jakob Lerch
Browse files

typing: fix or ignore typing errors

parent a1666a98
from .meeting import *
from .meeting import Attendee, Meeting, Topic
__all__ = ["Attendee", "Meeting", "Topic"]
\ No newline at end of file
......@@ -16,7 +16,7 @@ class TTPHistory:
self.crawl()
def crawl(self):
def crawl(self) -> None:
self._mapping.clear()
for page in self.wiki.pages.list("technik/techniktreffen"):
......
......@@ -61,10 +61,10 @@ class Attendee:
def __post_init__(self) -> None:
if m_extra := re.match(r".+\((?P<extra>.*)\).*", self.raw):
extra = m_extra.group("extra")
object.__setattr__(self, "extra", extra.strip()) # type: ignore
object.__setattr__(self, "name", self.raw.replace(f"({extra})", "").strip()) # type: ignore
object.__setattr__(self, "extra", extra.strip())
object.__setattr__(self, "name", self.raw.replace(f"({extra})", "").strip())
else:
object.__setattr__(self, "name", self.raw.strip()) # type: ignore
object.__setattr__(self, "name", self.raw.strip())
def __str__(self) -> str:
return self.name
......
......@@ -5,7 +5,7 @@ from typing import Any, Iterator
from mistletoe import BaseRenderer, block_token, span_token # type: ignore
class Fragment(block_token.BlockToken):
class Fragment(block_token.BlockToken): # type: ignore
def __init__(self, *children: block_token.BlockToken):
self.children = list(children)
......@@ -23,7 +23,7 @@ class Fragment(block_token.BlockToken):
return bool(self.children)
class DokuWikiHeading(block_token.BlockToken):
class DokuWikiHeading(block_token.BlockToken): # type: ignore
pattern = re.compile(r"^(=+) (.*) \1$")
level = 0
content = ""
......@@ -52,7 +52,7 @@ class DokuWikiHeading(block_token.BlockToken):
return cls.level, cls.content
class LinkReference(block_token.BlockToken):
class LinkReference(block_token.BlockToken): # type: ignore
pattern = re.compile(r"^\s{,3}\[(?P<label>.*)\]:\s*(?P<dest>.*)$")
label = ""
destination = ""
......@@ -76,7 +76,7 @@ class LinkReference(block_token.BlockToken):
return cls.label, cls.destination
class Renderer(BaseRenderer):
class Renderer(BaseRenderer): # type: ignore
def __init__(self, *extras: block_token.BlockToken):
super().__init__(*extras, DokuWikiHeading, LinkReference, Fragment)
self.list_depth = 0
......@@ -84,13 +84,13 @@ class Renderer(BaseRenderer):
def __enter__(self) -> "Renderer":
""" """
span_token.remove_token(span_token.CoreTokens)
return super().__enter__()
return super().__enter__() # type: ignore
def render_line_break(self, _: span_token.LineBreak) -> str:
return "\n"
def render_heading(self, token: block_token.Heading) -> str:
return "#" * token.level + " " + self.render_inner(token) + "\n"
return "#" * token.level + " " + self.render_inner(token) + "\n" # type: ignore
render_doku_wiki_heading = render_heading
......@@ -98,12 +98,12 @@ class Renderer(BaseRenderer):
return f"[{token.label}]: {token.destination}\n"
def render_paragraph(self, token: block_token.Paragraph) -> str:
return self.render_inner(token) + "\n"
return self.render_inner(token) + "\n" # type: ignore
def render_list(self, token: block_token.List) -> str:
self.list_depth += 1
try:
return self.render_inner(token)
return self.render_inner(token) # type: ignore
finally:
self.list_depth -= 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment