Skip to content

Commit

Permalink
fix/ignore remaining mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Aug 28, 2023
1 parent ee917e2 commit cf7a966
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions nicegui/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import re
from copy import copy, deepcopy
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Union
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Optional, Sequence, Union

from typing_extensions import Self

from nicegui import json

from . import binding, events, globals, outbox, storage # pylint: disable=redefined-builtin
from .dependencies import JsComponent, Library, register_library, register_vue_component
from .dependencies import Component, Library, register_library, register_vue_component
from .elements.mixins.visibility import Visibility
from .event_listener import EventListener
from .slot import Slot
Expand All @@ -24,7 +24,7 @@


class Element(Visibility):
component: Optional[JsComponent] = None
component: Optional[Component] = None
libraries: List[Library] = []
extra_libraries: List[Library] = []
exposed_libraries: List[Library] = []
Expand Down Expand Up @@ -252,7 +252,7 @@ def tooltip(self, text: str) -> Self:
def on(self,
type: str, # pylint: disable=redefined-builtin
handler: Optional[Callable[..., Any]] = None,
args: Optional[List[str]] = None, *,
args: Union[None, Sequence[str], Sequence[Optional[Sequence[str]]]] = None, *,
throttle: float = 0.0,
leading_events: bool = True,
trailing_events: bool = True,
Expand All @@ -270,7 +270,7 @@ def on(self,
listener = EventListener(
element_id=self.id,
type=type,
args=[args] if args and isinstance(args[0], str) else args,
args=[args] if args and isinstance(args[0], str) else args, # type: ignore
handler=handler,
throttle=throttle,
leading_events=leading_events,
Expand Down
4 changes: 2 additions & 2 deletions nicegui/event_listener.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import uuid
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Optional
from typing import Any, Callable, Dict, Optional, Sequence

from fastapi import Request

Expand All @@ -12,7 +12,7 @@ class EventListener:
id: str = field(init=False)
element_id: int
type: str
args: List[Optional[List[str]]]
args: Sequence[Optional[Sequence[str]]]
handler: Callable
throttle: float
leading_events: bool
Expand Down
2 changes: 1 addition & 1 deletion nicegui/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async def wait_for_result() -> None:
if 'request' not in {p.name for p in parameters}:
request = inspect.Parameter('request', inspect.Parameter.POSITIONAL_OR_KEYWORD, annotation=Request)
parameters.insert(0, request)
decorated.__signature__ = inspect.Signature(parameters)
decorated.__signature__ = inspect.Signature(parameters) # type: ignore

if 'include_in_schema' not in self.kwargs:
self.kwargs['include_in_schema'] = globals.endpoint_documentation in {'page', 'all'}
Expand Down

0 comments on commit cf7a966

Please sign in to comment.