Skip to content

Commit

Permalink
fix mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wipascal committed Dec 21, 2021
1 parent 5f10984 commit ec65880
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion htmlgenerator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def treewalk(
typing.Callable[[BaseElement, typing.Tuple[BaseElement, ...]], bool]
],
apply: typing.Optional[
typing.Callable[[BaseElement, int, BaseElement], None]
typing.Callable[[typing.List, int, BaseElement], None]
] = None,
) -> typing.Generator[BaseElement, None, None]:
from .htmltags import HTMLElement
Expand Down
2 changes: 1 addition & 1 deletion htmlgenerator/contrib/convertfromhtml.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import codecs

import black
import black # type: ignore
from bs4 import BeautifulSoup, Comment, Doctype, NavigableString, Tag # type: ignore

# be aware: attributes with the empty string as value will be converted
Expand Down
12 changes: 9 additions & 3 deletions htmlgenerator/htmltags.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ def __init__(
super().__init__(*children)
self.lazy_attributes = lazy_attributes

def render(self, context: dict) -> typing.Generator[str, None, None]:
def render(
self, context: dict, stringify: bool = True
) -> typing.Generator[str, None, None]:
attr_str = flatattrs(
{
**self.attributes,
Expand Down Expand Up @@ -53,7 +55,9 @@ class VoidElement(HTMLElement):
def __init__(self, **kwargs):
super().__init__(**kwargs)

def render(self, context) -> typing.Generator[str, None, None]:
def render(
self, context, stringify: bool = True
) -> typing.Generator[str, None, None]:
attr_str = flatattrs(
{
**self.attributes,
Expand Down Expand Up @@ -338,7 +342,9 @@ def __init__(self, *args, doctype=False, **kwargs):
super().__init__(*args, **kwargs)
self.doctype = doctype

def render(self, context: dict) -> typing.Generator[str, None, None]:
def render(
self, context: dict, stringify: bool = True
) -> typing.Generator[str, None, None]:
if self.doctype:
yield "<!DOCTYPE html>"
yield from super().render(context)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import find_packages, setup
from setuptools import find_packages, setup # type: ignore

with open("README.md") as f:
long_description = f.read()
Expand Down

0 comments on commit ec65880

Please sign in to comment.