Skip to content

Commit

Permalink
improving typing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
leforestier committed Nov 2, 2024
1 parent ff7c472 commit 8d4999c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions yattag/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self, name, tpe, attrs):
self.attrs = attrs

def render(self, defaults, errors, error_wrapper, stag_end = ' />'):
# type: (Dict[str, str], Dict[str, str], Tuple[str, str], str) -> str
# type: (Dict[str, str | List[str] | bool], Dict[str, str], Tuple[str, str], str) -> str
lst = [] # List[str]
attrs = dict(self.attrs)
error = errors and self.name in errors
Expand Down Expand Up @@ -72,7 +72,7 @@ def match(cls, default, value):
return False

def checked(self, defaults):
# type: (Dict[str, Union[List[str], str]]) -> bool
# type: (Dict[str, Union[List[str], str, bool]]) -> bool
try:
default = defaults[self.name]
except KeyError:
Expand All @@ -85,7 +85,7 @@ def checked(self, defaults):


def render(self, defaults, errors, error_wrapper, stag_end = ' />'):
# type: (Dict[str, Union[List[str], str]], Any, Tuple[str, str], str) -> str
# type: (Dict[str, Union[List[str], str, bool]], Any, Tuple[str, str], str) -> str
lst = []
attrs = dict(self.attrs)
if self.rank == 0:
Expand Down Expand Up @@ -147,7 +147,7 @@ def __init__(self, name, attrs):
self.attrs = attrs

def render(self, defaults, errors, error_wrapper, inner_content = ''):
# type: (Dict[str, str], Dict[str, str], Tuple[str, str], str) -> str
# type: (Dict[str, str | List[str] | bool], Dict[str, str], Tuple[str, str], str) -> str
lst = []
attrs = dict(self.attrs)
if errors and self.name in errors:
Expand Down Expand Up @@ -183,7 +183,7 @@ def __init__(self, name, multiple, value, attrs):
self.attrs = attrs

def render(self, defaults, errors, inner_content):
# type: (Dict[str, str], Dict[str, str], str) -> str
# type: (Dict[str, str | List[str] | bool], Dict[str, str], str) -> str
selected = False
if self.name in defaults:
if self.multiple:
Expand Down Expand Up @@ -362,7 +362,7 @@ def __exit__(self, tpe, value, traceback):

def __init__(self, defaults = None, errors = None,
error_wrapper = ('<span class="error">', '</span>'), *args, **kwargs):
# type: (Optional[Dict[str, str]], Optional[Dict[str, str]], Tuple[str, str], Any, Any) -> None
# type: (Optional[Dict[str, str | List[str] | bool]], Optional[Dict[str, str]], Tuple[str, str], Any, Any) -> None
"""
creates a Doc instance
Expand Down

0 comments on commit 8d4999c

Please sign in to comment.