Bladeren bron

fix more linting issues

Falko Schindler 1 jaar geleden
bovenliggende
commit
64c5152c70

+ 5 - 1
.vscode/settings.json

@@ -8,8 +8,12 @@
     "--disable=C0103", // Invalid name (e.g., variable/function/class naming conventions)
     "--disable=C0111", // Missing docstring (in function/class/method)
     "--disable=C0301", // Line too long (exceeds character limit)
-    "--disable=R0902", // Too many public methods
+    "--disable=R0902", // Too many instance attributes
+    "--disable=R0903", // Too few public methods
     "--disable=R0904", // Too many public methods
+    "--disable=R0911", // Too many return statements
+    "--disable=R0912", // Too many branches
+    "--disable=R0913", // Too many arguments
     "--disable=W0102", // Dangerous default value as argument
     "--disable=W0718", // Catching too general exception
     "--disable=W1203", // Use % formatting in logging functions

+ 2 - 2
fetch_google_fonts.py

@@ -7,9 +7,9 @@ import requests
 AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
 
 url = 'https://fonts.googleapis.com/css2?family=Material+Icons&family=Roboto:wght@100;300;400;500;700;900'
-css = requests.get(url, headers={'User-Agent': AGENT}).content.decode()
+css = requests.get(url, headers={'User-Agent': AGENT}, timeout=5).content.decode()
 for font_url in re.findall(r'url\((.*?)\)', css):
-    font = requests.get(font_url).content
+    font = requests.get(font_url, timeout=5).content
     (Path('nicegui/static/fonts') / font_url.split('/')[-1]).write_bytes(font)
 css = css.replace('https://fonts.gstatic.com/s/materialicons/v140', 'fonts')
 css = css.replace('https://fonts.gstatic.com/s/roboto/v30', 'fonts')

+ 21 - 21
fetch_tailwind.py

@@ -57,7 +57,7 @@ def get_soup(url: str) -> BeautifulSoup:
     if path.exists():
         html = path.read_text()
     else:
-        req = requests.get(url)
+        req = requests.get(url, timeout=5)
         html = req.text
         path.write_text(html)
     return BeautifulSoup(html, 'html.parser')
@@ -80,14 +80,14 @@ for li in soup.select('li[class="mt-12 lg:mt-8"]'):
 
 for file in (Path(__file__).parent / 'nicegui' / 'tailwind_types').glob('*.py'):
     file.unlink()
-for property in properties:
-    if not property.members:
+for property_ in properties:
+    if not property_.members:
         continue
-    with (Path(__file__).parent / 'nicegui' / 'tailwind_types' / f'{property.snake_title}.py').open('w') as f:
+    with (Path(__file__).parent / 'nicegui' / 'tailwind_types' / f'{property_.snake_title}.py').open('w') as f:
         f.write('from typing import Literal\n')
         f.write('\n')
-        f.write(f'{property.pascal_title} = Literal[\n')
-        for short_member in property.short_members:
+        f.write(f'{property_.pascal_title} = Literal[\n')
+        for short_member in property_.short_members:
             f.write(f"    '{short_member}',\n")
         f.write(']\n')
 
@@ -98,10 +98,10 @@ with (Path(__file__).parent / 'nicegui' / 'tailwind.py').open('w') as f:
     f.write('\n')
     f.write('if TYPE_CHECKING:\n')
     f.write('    from .element import Element\n')
-    for property in sorted(properties, key=lambda p: p.title):
-        if not property.members:
+    for property_ in sorted(properties, key=lambda p: p.title):
+        if not property_.members:
             continue
-        f.write(f'    from .tailwind_types.{property.snake_title} import {property.pascal_title}\n')
+        f.write(f'    from .tailwind_types.{property_.snake_title} import {property_.pascal_title}\n')
     f.write('\n')
     f.write('\n')
     f.write('class PseudoElement:\n')
@@ -115,7 +115,7 @@ with (Path(__file__).parent / 'nicegui' / 'tailwind.py').open('w') as f:
     f.write('\n')
     f.write('class Tailwind:\n')
     f.write('\n')
-    f.write("    def __init__(self, _element: Optional['Element'] = None) -> None:\n")
+    f.write("    def __init__(self, _element: Optional[Element] = None) -> None:\n")
     f.write('        self.element: Union[PseudoElement, Element] = PseudoElement() if _element is None else _element\n')
     f.write('\n')
     f.write('    @overload\n')
@@ -135,18 +135,18 @@ with (Path(__file__).parent / 'nicegui' / 'tailwind.py').open('w') as f:
     f.write("            self.element.classes(' '.join(args))\n")
     f.write('        return self\n')
     f.write('\n')
-    f.write("    def apply(self, element: 'Element') -> None:\n")
+    f.write("    def apply(self, element: Element) -> None:\n")
     f.write('        element._classes.extend(self.element._classes)\n')
     f.write('        element.update()\n')
-    for property in properties:
+    for property_ in properties:
         f.write('\n')
-        if property.members:
-            f.write(f"    def {property.snake_title}(self, value: {property.pascal_title}) -> 'Tailwind':\n")
-            f.write(f'        """{property.description}"""\n')
-            f.write(f"        self.element.classes('{property.common_prefix}' + value)\n")
-            f.write(f'        return self\n')
+        if property_.members:
+            f.write(f"    def {property_.snake_title}(self, value: {property_.pascal_title}) -> Tailwind:\n")
+            f.write(f'        """{property_.description}"""\n')
+            f.write(f"        self.element.classes('{property_.common_prefix}' + value)\n")
+            f.write(r'        return self\n')
         else:
-            f.write(f"    def {property.snake_title}(self) -> 'Tailwind':\n")
-            f.write(f'        """{property.description}"""\n')
-            f.write(f"        self.element.classes('{property.common_prefix}')\n")
-            f.write(f'        return self\n')
+            f.write(f"    def {property_.snake_title}(self) -> Tailwind:\n")
+            f.write(f'        """{property_.description}"""\n')
+            f.write(f"        self.element.classes('{property_.common_prefix}')\n")
+            f.write(r'        return self\n')

+ 2 - 1
nicegui/__init__.py

@@ -2,13 +2,14 @@ import importlib.metadata
 
 __version__: str = importlib.metadata.version('nicegui')
 
-from . import elements, globals, ui
+from . import elements, globals, ui  # pylint: disable=redefined-builtin
 from .api_router import APIRouter
 from .client import Client
 from .nicegui import app
 from .tailwind import Tailwind
 
 __all__ = [
+    'APIRouter',
     'app',
     'Client',
     'elements',

+ 14 - 16
nicegui/binding.py

@@ -5,7 +5,7 @@ from collections import defaultdict
 from collections.abc import Mapping
 from typing import Any, Callable, DefaultDict, Dict, List, Optional, Set, Tuple, Type, Union
 
-from . import globals
+from . import globals  # pylint: disable=redefined-builtin
 
 MAX_PROPAGATION_TIME = 0.01
 
@@ -17,15 +17,13 @@ active_links: List[Tuple[Any, str, Any, str, Callable[[Any], Any]]] = []
 def has_attribute(obj: Union[object, Mapping], name: str) -> Any:
     if isinstance(obj, Mapping):
         return name in obj
-    else:
-        return hasattr(obj, name)
+    return hasattr(obj, name)
 
 
 def get_attribute(obj: Union[object, Mapping], name: str) -> Any:
     if isinstance(obj, Mapping):
         return obj[name]
-    else:
-        return getattr(obj, name)
+    return getattr(obj, name)
 
 
 def set_attribute(obj: Union[object, Mapping], name: str, value: Any) -> None:
@@ -46,7 +44,7 @@ async def loop() -> None:
                 if not has_attribute(target_obj, target_name) or get_attribute(target_obj, target_name) != value:
                     set_attribute(target_obj, target_name, value)
                     propagate(target_obj, target_name, visited)
-            del link, source_obj, target_obj
+            del link, source_obj, target_obj  # pylint: disable=modified-iterating-list
         if time.time() - t > MAX_PROPAGATION_TIME:
             logging.warning(f'binding propagation for {len(active_links)} active links took {time.time() - t:.3f} s')
         await asyncio.sleep(globals.binding_refresh_interval)
@@ -92,15 +90,15 @@ class BindableProperty:
         self.on_change = on_change
 
     def __set_name__(self, _, name: str) -> None:
-        self.name = name
+        self.name = name  # pylint: disable=attribute-defined-outside-init
 
     def __get__(self, owner: Any, _=None) -> Any:
         return getattr(owner, '___' + self.name)
 
     def __set__(self, owner: Any, value: Any) -> None:
-        has_attribute = hasattr(owner, '___' + self.name)
-        value_changed = has_attribute and getattr(owner, '___' + self.name) != value
-        if has_attribute and not value_changed:
+        has_attr = hasattr(owner, '___' + self.name)
+        value_changed = has_attr and getattr(owner, '___' + self.name) != value
+        if has_attr and not value_changed:
             return
         setattr(owner, '___' + self.name, value)
         bindable_properties[(id(owner), self.name)] = owner
@@ -109,22 +107,22 @@ class BindableProperty:
             self.on_change(owner, value)
 
 
-def remove(objects: List[Any], type: Type) -> None:
+def remove(objects: List[Any], type_: Type) -> None:
     active_links[:] = [
         (source_obj, source_name, target_obj, target_name, transform)
         for source_obj, source_name, target_obj, target_name, transform in active_links
-        if not (isinstance(source_obj, type) and source_obj in objects or
-                isinstance(target_obj, type) and target_obj in objects)
+        if not (isinstance(source_obj, type_) and source_obj in objects or
+                isinstance(target_obj, type_) and target_obj in objects)
     ]
     for key, binding_list in list(bindings.items()):
         binding_list[:] = [
             (source_obj, target_obj, target_name, transform)
             for source_obj, target_obj, target_name, transform in binding_list
-            if not (isinstance(source_obj, type) and source_obj in objects or
-                    isinstance(target_obj, type) and target_obj in objects)
+            if not (isinstance(source_obj, type_) and source_obj in objects or
+                    isinstance(target_obj, type_) and target_obj in objects)
         ]
         if not binding_list:
             del bindings[key]
     for (obj_id, name), obj in list(bindable_properties.items()):
-        if isinstance(obj, type) and obj in objects:
+        if isinstance(obj, type_) and obj in objects:
             del bindable_properties[(obj_id, name)]

+ 5 - 3
nicegui/client.py

@@ -10,7 +10,7 @@ from fastapi.templating import Jinja2Templates
 
 from nicegui import json
 
-from . import __version__, globals, outbox
+from . import __version__, globals, outbox  # pylint: disable=redefined-builtin
 from .dependencies import generate_resources
 from .element import Element
 from .favicon import get_favicon_url
@@ -54,7 +54,7 @@ class Client:
     @property
     def ip(self) -> Optional[str]:
         """Return the IP address of the client, or None if the client is not connected."""
-        return self.environ['asgi.scope']['client'][0] if self.has_socket_connection else None
+        return self.environ['asgi.scope']['client'][0] if self.has_socket_connection else None  # pylint: disable=unsubscriptable-object
 
     @property
     def has_socket_connection(self) -> bool:
@@ -70,7 +70,9 @@ class Client:
 
     def build_response(self, request: Request, status_code: int = 200) -> Response:
         prefix = request.headers.get('X-Forwarded-Prefix', request.scope.get('root_path', ''))
-        elements = json.dumps({id: element._to_dict() for id, element in self.elements.items()})
+        elements = json.dumps({
+            id: element._to_dict() for id, element in self.elements.items()  # pylint: disable=protected-access
+        })
         socket_io_js_query_params = {**globals.socket_io_js_query_params, 'client_id': self.id}
         vue_html, vue_styles, vue_scripts, imports, js_imports = generate_resources(prefix, self.elements.values())
         return templates.TemplateResponse('index.html', {

+ 6 - 5
nicegui/element.py

@@ -10,7 +10,7 @@ from typing_extensions import Self
 
 from nicegui import json
 
-from . import binding, events, globals, outbox, storage
+from . import binding, events, globals, outbox, storage  # pylint: disable=redefined-builtin
 from .dependencies import JsComponent, Library, register_library, register_vue_component
 from .elements.mixins.visibility import Visibility
 from .event_listener import EventListener
@@ -246,11 +246,11 @@ class Element(Visibility):
         """
         with self:
             tooltip = Element('q-tooltip')
-            tooltip._text = text
+            tooltip._text = text  # pylint: disable=protected-access
         return self
 
     def on(self,
-           type: str,
+           type: str,  # pylint: disable=redefined-builtin
            handler: Optional[Callable[..., Any]] = None,
            args: Optional[List[str]] = None, *,
            throttle: float = 0.0,
@@ -300,12 +300,13 @@ class Element(Visibility):
         if not globals.loop:
             return
         data = {'id': self.id, 'name': name, 'args': args}
-        outbox.enqueue_message('run_method', data, globals._socket_id or self.client.id)
+        target_id = globals._socket_id or self.client.id  # pylint: disable=protected-access
+        outbox.enqueue_message('run_method', data, target_id)
 
     def _collect_descendant_ids(self) -> List[int]:
         ids: List[int] = [self.id]
         for child in self:
-            ids.extend(child._collect_descendant_ids())
+            ids.extend(child._collect_descendant_ids())  # pylint: disable=protected-access
         return ids
 
     def clear(self) -> None:

+ 0 - 0
nicegui/elements/mixins/__init__.py


+ 14 - 9
nicegui/elements/mixins/visibility.py

@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 from typing import TYPE_CHECKING, Any, Callable, cast
 
 from typing_extensions import Self
@@ -52,7 +54,8 @@ class Visibility:
         :param value: If specified, the element will be visible only when the target value is equal to this value.
         """
         if value is not None:
-            def backward(x): return x == value
+            def backward(x):  # pylint: disable=function-redefined
+                return x == value
         bind_from(self, 'visible', target_object, target_name, backward)
         return self
 
@@ -74,7 +77,8 @@ class Visibility:
         :param value: If specified, the element will be visible only when the target value is equal to this value.
         """
         if value is not None:
-            def backward(x): return x == value
+            def backward(x):  # pylint: disable=function-redefined
+                return x == value
         bind(self, 'visible', target_object, target_name, forward=forward, backward=backward)
         return self
 
@@ -90,10 +94,11 @@ class Visibility:
 
         :param visible: Whether the element should be visible.
         """
-        self = cast('Element', self)
-        if visible and 'hidden' in self._classes:
-            self._classes.remove('hidden')
-            self.update()
-        if not visible and 'hidden' not in self._classes:
-            self._classes.append('hidden')
-            self.update()
+        element: Element = cast(Element, self)
+        classes = element._classes  # pylint: disable=protected-access, no-member
+        if visible and 'hidden' in classes:
+            classes.remove('hidden')
+            element.update()  # pylint: disable=no-member
+        if not visible and 'hidden' not in classes:
+            classes.append('hidden')
+            element.update()  # pylint: disable=no-member

+ 2 - 2
nicegui/event_listener.py

@@ -24,13 +24,13 @@ class EventListener:
 
     def to_dict(self) -> Dict[str, Any]:
         words = self.type.split('.')
-        type = words.pop(0)
+        type_ = words.pop(0)
         specials = [w for w in words if w in {'capture', 'once', 'passive'}]
         modifiers = [w for w in words if w in {'stop', 'prevent', 'self', 'ctrl', 'shift', 'alt', 'meta'}]
         keys = [w for w in words if w not in specials + modifiers]
         return {
             'listener_id': self.id,
-            'type': type,
+            'type': type_,
             'specials': specials,
             'modifiers': modifiers,
             'keys': keys,

+ 1 - 1
nicegui/events.py

@@ -5,7 +5,7 @@ from dataclasses import dataclass
 from inspect import Parameter, signature
 from typing import TYPE_CHECKING, Any, Awaitable, BinaryIO, Callable, Dict, List, Literal, Optional, Union
 
-from . import background_tasks, globals
+from . import background_tasks, globals  # pylint: disable=redefined-builtin
 from .helpers import KWONLY_SLOTS
 from .slot import Slot
 

+ 18 - 14
nicegui/favicon.py

@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 import base64
 import io
 import urllib.parse
@@ -6,7 +8,7 @@ from typing import TYPE_CHECKING, Optional, Tuple, Union
 
 from fastapi.responses import FileResponse, Response, StreamingResponse
 
-from . import __version__, globals
+from . import __version__, globals  # pylint: disable=redefined-builtin
 from .helpers import is_file
 
 if TYPE_CHECKING:
@@ -18,38 +20,40 @@ def create_favicon_route(path: str, favicon: Optional[Union[str, Path]]) -> None
         globals.app.add_route('/favicon.ico' if path == '/' else f'{path}/favicon.ico', lambda _: FileResponse(favicon))
 
 
-def get_favicon_url(page: 'page', prefix: str) -> str:
+def get_favicon_url(page: page, prefix: str) -> str:
     favicon = page.favicon or globals.favicon
     if not favicon:
         return f'{prefix}/_nicegui/{__version__}/static/favicon.ico'
+
     favicon = str(favicon).strip()
     if is_remote_url(favicon):
         return favicon
-    elif is_data_url(favicon):
+    if is_data_url(favicon):
         return favicon
-    elif is_svg(favicon):
+    if is_svg(favicon):
         return svg_to_data_url(favicon)
-    elif is_char(favicon):
+    if is_char(favicon):
         return svg_to_data_url(char_to_svg(favicon))
-    elif page.path == '/' or page.favicon is None:
+    if page.path == '/' or page.favicon is None:
         return f'{prefix}/favicon.ico'
-    else:
-        return f'{prefix}{page.path}/favicon.ico'
+
+    return f'{prefix}{page.path}/favicon.ico'
 
 
 def get_favicon_response() -> Response:
     if not globals.favicon:
         raise ValueError(f'invalid favicon: {globals.favicon}')
     favicon = str(globals.favicon).strip()
+
     if is_svg(favicon):
         return Response(favicon, media_type='image/svg+xml')
-    elif is_data_url(favicon):
-        media_type, bytes = data_url_to_bytes(favicon)
-        return StreamingResponse(io.BytesIO(bytes), media_type=media_type)
-    elif is_char(favicon):
+    if is_data_url(favicon):
+        media_type, bytes_ = data_url_to_bytes(favicon)
+        return StreamingResponse(io.BytesIO(bytes_), media_type=media_type)
+    if is_char(favicon):
         return Response(char_to_svg(favicon), media_type='image/svg+xml')
-    else:
-        raise ValueError(f'invalid favicon: {favicon}')
+
+    raise ValueError(f'invalid favicon: {favicon}')
 
 
 def is_remote_url(favicon: str) -> bool:

+ 4 - 5
nicegui/globals.py

@@ -52,8 +52,7 @@ air: Optional[Air] = None
 storage_path: Path = Path(os.environ.get('NICEGUI_STORAGE_PATH', '.nicegui')).resolve()
 socket_io_js_query_params: Dict = {}
 socket_io_js_extra_headers: Dict = {}
-# NOTE we favor websocket over polling
-socket_io_js_transports: List[Literal['websocket', 'polling']] = ['websocket', 'polling']
+socket_io_js_transports: List[Literal['websocket', 'polling']] = ['websocket', 'polling']  # NOTE: we favor websocket
 _socket_id: Optional[str] = None
 slot_stacks: Dict[int, List[Slot]] = {}
 clients: Dict[str, Client] = {}
@@ -106,9 +105,9 @@ def get_client() -> Client:
 
 
 @contextmanager
-def socket_id(id: str) -> Iterator[None]:
-    global _socket_id
-    _socket_id = id
+def socket_id(id_: str) -> Iterator[None]:
+    global _socket_id  # pylint: disable=global-statement
+    _socket_id = id_
     yield
     _socket_id = None
 

+ 6 - 6
nicegui/helpers.py

@@ -17,7 +17,7 @@ from fastapi.responses import StreamingResponse
 from starlette.middleware import Middleware
 from starlette.middleware.sessions import SessionMiddleware
 
-from . import background_tasks, globals
+from . import background_tasks, globals  # pylint: disable=redefined-builtin
 from .storage import RequestTrackingMiddleware
 
 if TYPE_CHECKING:
@@ -33,22 +33,22 @@ def is_pytest() -> bool:
     return 'pytest' in sys.modules
 
 
-def is_coroutine_function(object: Any) -> bool:
+def is_coroutine_function(obj: Any) -> bool:
     """Check if the object is a coroutine function.
 
     This function is needed because functools.partial is not a coroutine function, but its func attribute is.
     Note: It will return false for coroutine objects.
     """
-    while isinstance(object, functools.partial):
-        object = object.func
-    return asyncio.iscoroutinefunction(object)
+    while isinstance(obj, functools.partial):
+        obj = obj.func
+    return asyncio.iscoroutinefunction(obj)
 
 
 def is_file(path: Optional[Union[str, Path]]) -> bool:
     """Check if the path is a file that exists."""
     if not path:
         return False
-    elif isinstance(path, str) and path.strip().startswith('data:'):
+    if isinstance(path, str) and path.strip().startswith('data:'):
         return False  # NOTE: avoid passing data URLs to Path
     try:
         return Path(path).is_file()

+ 0 - 15
nicegui/ids.py

@@ -1,15 +0,0 @@
-from typing import Dict
-
-
-class IncrementingStringIds:
-    '''Maps incrementing IDs to given strings'''
-
-    def __init__(self) -> None:
-        self.current_id = -1
-        self.dict: Dict[str, int] = {}
-
-    def get(self, name: str) -> int:
-        if name not in self.dict:
-            self.current_id += 1
-            self.dict[name] = self.current_id
-        return self.dict[name]

+ 6 - 6
nicegui/native.py

@@ -21,7 +21,7 @@ try:
 
     class WindowProxy(webview.Window):
 
-        def __init__(self) -> None:
+        def __init__(self) -> None:  # pylint: disable=super-init-not-called
             pass  # NOTE we don't call super().__init__ here because this is just a proxy to the actual window
 
         async def get_always_on_top(self) -> bool:
@@ -52,10 +52,10 @@ try:
         def set_title(self, title: str) -> None:
             self._send(title)
 
-        async def get_cookies(self) -> Any:
+        async def get_cookies(self) -> Any:  # pylint: disable=invalid-overridden-method
             return await self._request()
 
-        async def get_current_url(self) -> str:
+        async def get_current_url(self) -> str:  # pylint: disable=invalid-overridden-method
             return await self._request()
 
         def destroy(self) -> None:
@@ -88,10 +88,10 @@ try:
         async def evaluate_js(self, script: str) -> str:
             return await self._request(script)
 
-        async def create_confirmation_dialog(self, title: str, message: str) -> bool:
+        async def create_confirmation_dialog(self, title: str, message: str) -> bool:  # pylint: disable=invalid-overridden-method
             return await self._request(title, message)
 
-        async def create_file_dialog(
+        async def create_file_dialog(  # pylint: disable=invalid-overridden-method
             self,
             dialog_type: int = webview.OPEN_DIALOG,
             directory: str = '',
@@ -128,7 +128,7 @@ try:
             self._send()
 
 except ModuleNotFoundError:
-    class WindowProxy():
+    class WindowProxy:
         pass  # just a dummy if webview is not installed
 
 

+ 1 - 1
nicegui/native_mode.py

@@ -12,7 +12,7 @@ import warnings
 from threading import Event, Thread
 from typing import Any, Callable, Dict, List, Tuple
 
-from . import globals, helpers, native
+from . import globals, helpers, native  # pylint: disable=redefined-builtin
 
 try:
     with warnings.catch_warnings():

+ 2 - 2
nicegui/observables.py

@@ -67,8 +67,8 @@ class ObservableList(list):
         super().extend(make_observable(list(iterable), self.on_change))
         self.on_change()
 
-    def insert(self, index: SupportsIndex, object: Any) -> None:
-        super().insert(index, make_observable(object, self.on_change))
+    def insert(self, index: SupportsIndex, obj: Any) -> None:
+        super().insert(index, make_observable(obj, self.on_change))
         self.on_change()
 
     def remove(self, value: Any) -> None:

+ 4 - 4
nicegui/outbox.py

@@ -4,7 +4,7 @@ import asyncio
 from collections import defaultdict, deque
 from typing import TYPE_CHECKING, Any, DefaultDict, Deque, Dict, Tuple
 
-from . import globals
+from . import globals  # pylint: disable=redefined-builtin
 
 if TYPE_CHECKING:
     from .element import Element
@@ -47,7 +47,7 @@ async def loop() -> None:
         try:
             for client_id, elements in update_queue.items():
                 data = {
-                    element_id: None if element is None else element._to_dict()
+                    element_id: None if element is None else element._to_dict()  # pylint: disable=protected-access
                     for element_id, element in elements.items()
                 }
                 coros.append(_emit('update', data, client_id))
@@ -70,5 +70,5 @@ async def loop() -> None:
 def is_target_on_air(target_id: str) -> bool:
     if target_id in globals.clients:
         return globals.clients[target_id].on_air
-    else:
-        return target_id in globals.sio.manager.rooms
+
+    return target_id in globals.sio.manager.rooms

+ 1 - 1
nicegui/page.py

@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING, Any, Callable, Optional, Union
 
 from fastapi import Request, Response
 
-from . import background_tasks, globals
+from . import background_tasks, globals  # pylint: disable=redefined-builtin
 from .client import Client
 from .favicon import create_favicon_route
 from .language import Language

+ 1 - 1
nicegui/page_layout.py

@@ -1,6 +1,6 @@
 from typing import Literal, Optional
 
-from . import globals
+from . import globals  # pylint: disable=redefined-builtin
 from .element import Element
 from .elements.mixins.value_element import ValueElement
 from .functions.html import add_body_html

+ 2 - 2
nicegui/run_with.py

@@ -3,7 +3,7 @@ from typing import Optional, Union
 
 from fastapi import FastAPI
 
-from nicegui import globals
+from nicegui import globals  # pylint: disable=redefined-builtin
 from nicegui.helpers import set_storage_secret
 from nicegui.language import Language
 from nicegui.nicegui import handle_shutdown, handle_startup
@@ -34,6 +34,6 @@ def run_with(
 
     set_storage_secret(storage_secret)
     app.on_event('startup')(lambda: handle_startup(with_welcome_message=False))
-    app.on_event('shutdown')(lambda: handle_shutdown())
+    app.on_event('shutdown')(handle_shutdown)
 
     app.mount(mount_path, globals.app)

+ 6 - 4
nicegui/slot.py

@@ -1,8 +1,10 @@
+from __future__ import annotations
+
 from typing import TYPE_CHECKING, Iterator, List, Optional
 
 from typing_extensions import Self
 
-from . import globals
+from . import globals  # pylint: disable=redefined-builtin
 
 if TYPE_CHECKING:
     from .element import Element
@@ -10,11 +12,11 @@ if TYPE_CHECKING:
 
 class Slot:
 
-    def __init__(self, parent: 'Element', name: str, template: Optional[str] = None) -> None:
+    def __init__(self, parent: Element, name: str, template: Optional[str] = None) -> None:
         self.name = name
         self.parent = parent
         self.template = template
-        self.children: List['Element'] = []
+        self.children: List[Element] = []
 
     def __enter__(self) -> Self:
         globals.get_slot_stack().append(self)
@@ -24,5 +26,5 @@ class Slot:
         globals.get_slot_stack().pop()
         globals.prune_slot_stack()
 
-    def __iter__(self) -> Iterator['Element']:
+    def __iter__(self) -> Iterator[Element]:
         return iter(self.children)

+ 5 - 5
nicegui/storage.py

@@ -10,7 +10,7 @@ from fastapi import Request
 from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint
 from starlette.responses import Response
 
-from . import background_tasks, globals, observables
+from . import background_tasks, globals, observables  # pylint: disable=redefined-builtin
 
 request_contextvar: contextvars.ContextVar[Optional[Request]] = contextvars.ContextVar('request_var', default=None)
 
@@ -113,10 +113,10 @@ class Storage:
                                    '(https://nicegui.io/documentation/page)')
             else:
                 raise RuntimeError('app.storage.user needs a storage_secret passed in ui.run()')
-        id = request.session['id']
-        if id not in self._users:
-            self._users[id] = PersistentDict(globals.storage_path / f'storage_user_{id}.json')
-        return self._users[id]
+        session_id = request.session['id']
+        if session_id not in self._users:
+            self._users[session_id] = PersistentDict(globals.storage_path / f'storage_user_{session_id}.json')
+        return self._users[session_id]
 
     @property
     def general(self) -> Dict:

+ 162 - 162
nicegui/tailwind.py

@@ -176,7 +176,7 @@ class PseudoElement:
 
 class Tailwind:
 
-    def __init__(self, _element: Optional['Element'] = None) -> None:
+    def __init__(self, _element: Optional[Element] = None) -> None:
         self.element: Union[PseudoElement, Element] = PseudoElement() if _element is None else _element
 
     @overload
@@ -196,806 +196,806 @@ class Tailwind:
             self.element.classes(' '.join(args))
         return self
 
-    def apply(self, element: 'Element') -> None:
+    def apply(self, element: Element) -> None:
         element._classes.extend(self.element._classes)
         element.update()
 
-    def aspect_ratio(self, value: AspectRatio) -> 'Tailwind':
+    def aspect_ratio(self, value: AspectRatio) -> Tailwind:
         """Utilities for controlling the aspect ratio of an element."""
         self.element.classes('aspect-' + value)
         return self
 
-    def container(self) -> 'Tailwind':
+    def container(self) -> Tailwind:
         """A component for fixing an element's width to the current breakpoint."""
         self.element.classes('container')
         return self
 
-    def columns(self, value: Columns) -> 'Tailwind':
+    def columns(self, value: Columns) -> Tailwind:
         """Utilities for controlling the number of columns within an element."""
         self.element.classes('columns-' + value)
         return self
 
-    def break_after(self, value: BreakAfter) -> 'Tailwind':
+    def break_after(self, value: BreakAfter) -> Tailwind:
         """Utilities for controlling how a column or page should break after an element."""
         self.element.classes('break-after-' + value)
         return self
 
-    def break_before(self, value: BreakBefore) -> 'Tailwind':
+    def break_before(self, value: BreakBefore) -> Tailwind:
         """Utilities for controlling how a column or page should break before an element."""
         self.element.classes('break-before-' + value)
         return self
 
-    def break_inside(self, value: BreakInside) -> 'Tailwind':
+    def break_inside(self, value: BreakInside) -> Tailwind:
         """Utilities for controlling how a column or page should break within an element."""
         self.element.classes('break-inside-' + value)
         return self
 
-    def box_decoration_break(self, value: BoxDecorationBreak) -> 'Tailwind':
+    def box_decoration_break(self, value: BoxDecorationBreak) -> Tailwind:
         """Utilities for controlling how element fragments should be rendered across multiple lines, columns, or pages."""
         self.element.classes('box-decoration-' + value)
         return self
 
-    def box_sizing(self, value: BoxSizing) -> 'Tailwind':
+    def box_sizing(self, value: BoxSizing) -> Tailwind:
         """Utilities for controlling how the browser should calculate an element's total size."""
         self.element.classes('box-' + value)
         return self
 
-    def display(self, value: Display) -> 'Tailwind':
+    def display(self, value: Display) -> Tailwind:
         """Utilities for controlling the display box type of an element."""
         self.element.classes('' + value)
         return self
 
-    def floats(self, value: Floats) -> 'Tailwind':
+    def floats(self, value: Floats) -> Tailwind:
         """Utilities for controlling the wrapping of content around an element."""
         self.element.classes('float-' + value)
         return self
 
-    def clear(self, value: Clear) -> 'Tailwind':
+    def clear(self, value: Clear) -> Tailwind:
         """Utilities for controlling the wrapping of content around an element."""
         self.element.classes('clear-' + value)
         return self
 
-    def isolation(self, value: Isolation) -> 'Tailwind':
+    def isolation(self, value: Isolation) -> Tailwind:
         """Utilities for controlling whether an element should explicitly create a new stacking context."""
         self.element.classes('' + value)
         return self
 
-    def object_fit(self, value: ObjectFit) -> 'Tailwind':
+    def object_fit(self, value: ObjectFit) -> Tailwind:
         """Utilities for controlling how a replaced element's content should be resized."""
         self.element.classes('object-' + value)
         return self
 
-    def object_position(self, value: ObjectPosition) -> 'Tailwind':
+    def object_position(self, value: ObjectPosition) -> Tailwind:
         """Utilities for controlling how a replaced element's content should be positioned within its container."""
         self.element.classes('object-' + value)
         return self
 
-    def overflow(self, value: Overflow) -> 'Tailwind':
+    def overflow(self, value: Overflow) -> Tailwind:
         """Utilities for controlling how an element handles content that is too large for the container."""
         self.element.classes('overflow-' + value)
         return self
 
-    def overscroll_behavior(self, value: OverscrollBehavior) -> 'Tailwind':
+    def overscroll_behavior(self, value: OverscrollBehavior) -> Tailwind:
         """Utilities for controlling how the browser behaves when reaching the boundary of a scrolling area."""
         self.element.classes('overscroll-' + value)
         return self
 
-    def position(self, value: Position) -> 'Tailwind':
+    def position(self, value: Position) -> Tailwind:
         """Utilities for controlling how an element is positioned in the DOM."""
         self.element.classes('' + value)
         return self
 
-    def top_right_bottom_left(self, value: TopRightBottomLeft) -> 'Tailwind':
+    def top_right_bottom_left(self, value: TopRightBottomLeft) -> Tailwind:
         """Utilities for controlling the placement of positioned elements."""
         self.element.classes('' + value)
         return self
 
-    def visibility(self, value: Visibility) -> 'Tailwind':
+    def visibility(self, value: Visibility) -> Tailwind:
         """Utilities for controlling the visibility of an element."""
         self.element.classes('' + value)
         return self
 
-    def z_index(self, value: ZIndex) -> 'Tailwind':
+    def z_index(self, value: ZIndex) -> Tailwind:
         """Utilities for controlling the stack order of an element."""
         self.element.classes('z-' + value)
         return self
 
-    def flex_basis(self, value: FlexBasis) -> 'Tailwind':
+    def flex_basis(self, value: FlexBasis) -> Tailwind:
         """Utilities for controlling the initial size of flex items."""
         self.element.classes('basis-' + value)
         return self
 
-    def flex_direction(self, value: FlexDirection) -> 'Tailwind':
+    def flex_direction(self, value: FlexDirection) -> Tailwind:
         """Utilities for controlling the direction of flex items."""
         self.element.classes('flex-' + value)
         return self
 
-    def flex_wrap(self, value: FlexWrap) -> 'Tailwind':
+    def flex_wrap(self, value: FlexWrap) -> Tailwind:
         """Utilities for controlling how flex items wrap."""
         self.element.classes('flex-' + value)
         return self
 
-    def flex(self, value: Flex) -> 'Tailwind':
+    def flex(self, value: Flex) -> Tailwind:
         """Utilities for controlling how flex items both grow and shrink."""
         self.element.classes('flex-' + value)
         return self
 
-    def flex_grow(self, value: FlexGrow) -> 'Tailwind':
+    def flex_grow(self, value: FlexGrow) -> Tailwind:
         """Utilities for controlling how flex items grow."""
         self.element.classes('grow-' + value)
         return self
 
-    def flex_shrink(self, value: FlexShrink) -> 'Tailwind':
+    def flex_shrink(self, value: FlexShrink) -> Tailwind:
         """Utilities for controlling how flex items shrink."""
         self.element.classes('shrink-' + value)
         return self
 
-    def order(self, value: Order) -> 'Tailwind':
+    def order(self, value: Order) -> Tailwind:
         """Utilities for controlling the order of flex and grid items."""
         self.element.classes('order-' + value)
         return self
 
-    def grid_template_columns(self, value: GridTemplateColumns) -> 'Tailwind':
+    def grid_template_columns(self, value: GridTemplateColumns) -> Tailwind:
         """Utilities for specifying the columns in a grid layout."""
         self.element.classes('grid-cols-' + value)
         return self
 
-    def grid_column_start_end(self, value: GridColumnStartEnd) -> 'Tailwind':
+    def grid_column_start_end(self, value: GridColumnStartEnd) -> Tailwind:
         """Utilities for controlling how elements are sized and placed across grid columns."""
         self.element.classes('col-' + value)
         return self
 
-    def grid_template_rows(self, value: GridTemplateRows) -> 'Tailwind':
+    def grid_template_rows(self, value: GridTemplateRows) -> Tailwind:
         """Utilities for specifying the rows in a grid layout."""
         self.element.classes('grid-rows-' + value)
         return self
 
-    def grid_row_start_end(self, value: GridRowStartEnd) -> 'Tailwind':
+    def grid_row_start_end(self, value: GridRowStartEnd) -> Tailwind:
         """Utilities for controlling how elements are sized and placed across grid rows."""
         self.element.classes('row-' + value)
         return self
 
-    def grid_auto_flow(self, value: GridAutoFlow) -> 'Tailwind':
+    def grid_auto_flow(self, value: GridAutoFlow) -> Tailwind:
         """Utilities for controlling how elements in a grid are auto-placed."""
         self.element.classes('grid-flow-' + value)
         return self
 
-    def grid_auto_columns(self, value: GridAutoColumns) -> 'Tailwind':
+    def grid_auto_columns(self, value: GridAutoColumns) -> Tailwind:
         """Utilities for controlling the size of implicitly-created grid columns."""
         self.element.classes('auto-cols-' + value)
         return self
 
-    def grid_auto_rows(self, value: GridAutoRows) -> 'Tailwind':
+    def grid_auto_rows(self, value: GridAutoRows) -> Tailwind:
         """Utilities for controlling the size of implicitly-created grid rows."""
         self.element.classes('auto-rows-' + value)
         return self
 
-    def gap(self, value: Gap) -> 'Tailwind':
+    def gap(self, value: Gap) -> Tailwind:
         """Utilities for controlling gutters between grid and flexbox items."""
         self.element.classes('gap-' + value)
         return self
 
-    def justify_content(self, value: JustifyContent) -> 'Tailwind':
+    def justify_content(self, value: JustifyContent) -> Tailwind:
         """Utilities for controlling how flex and grid items are positioned along a container's main axis."""
         self.element.classes('justify-' + value)
         return self
 
-    def justify_items(self, value: JustifyItems) -> 'Tailwind':
+    def justify_items(self, value: JustifyItems) -> Tailwind:
         """Utilities for controlling how grid items are aligned along their inline axis."""
         self.element.classes('justify-items-' + value)
         return self
 
-    def justify_self(self, value: JustifySelf) -> 'Tailwind':
+    def justify_self(self, value: JustifySelf) -> Tailwind:
         """Utilities for controlling how an individual grid item is aligned along its inline axis."""
         self.element.classes('justify-self-' + value)
         return self
 
-    def align_content(self, value: AlignContent) -> 'Tailwind':
+    def align_content(self, value: AlignContent) -> Tailwind:
         """Utilities for controlling how rows are positioned in multi-row flex and grid containers."""
         self.element.classes('content-' + value)
         return self
 
-    def align_items(self, value: AlignItems) -> 'Tailwind':
+    def align_items(self, value: AlignItems) -> Tailwind:
         """Utilities for controlling how flex and grid items are positioned along a container's cross axis."""
         self.element.classes('items-' + value)
         return self
 
-    def align_self(self, value: AlignSelf) -> 'Tailwind':
+    def align_self(self, value: AlignSelf) -> Tailwind:
         """Utilities for controlling how an individual flex or grid item is positioned along its container's cross axis."""
         self.element.classes('self-' + value)
         return self
 
-    def place_content(self, value: PlaceContent) -> 'Tailwind':
+    def place_content(self, value: PlaceContent) -> Tailwind:
         """Utilities for controlling how content is justified and aligned at the same time."""
         self.element.classes('place-content-' + value)
         return self
 
-    def place_items(self, value: PlaceItems) -> 'Tailwind':
+    def place_items(self, value: PlaceItems) -> Tailwind:
         """Utilities for controlling how items are justified and aligned at the same time."""
         self.element.classes('place-items-' + value)
         return self
 
-    def place_self(self, value: PlaceSelf) -> 'Tailwind':
+    def place_self(self, value: PlaceSelf) -> Tailwind:
         """Utilities for controlling how an individual item is justified and aligned at the same time."""
         self.element.classes('place-self-' + value)
         return self
 
-    def padding(self, value: Padding) -> 'Tailwind':
+    def padding(self, value: Padding) -> Tailwind:
         """Utilities for controlling an element's padding."""
         self.element.classes('' + value)
         return self
 
-    def margin(self, value: Margin) -> 'Tailwind':
+    def margin(self, value: Margin) -> Tailwind:
         """Utilities for controlling an element's margin."""
         self.element.classes('' + value)
         return self
 
-    def space_between(self, value: SpaceBetween) -> 'Tailwind':
+    def space_between(self, value: SpaceBetween) -> Tailwind:
         """Utilities for controlling the space between child elements."""
         self.element.classes('space-' + value)
         return self
 
-    def width(self, value: Width) -> 'Tailwind':
+    def width(self, value: Width) -> Tailwind:
         """Utilities for setting the width of an element."""
         self.element.classes('w-' + value)
         return self
 
-    def min_width(self, value: MinWidth) -> 'Tailwind':
+    def min_width(self, value: MinWidth) -> Tailwind:
         """Utilities for setting the minimum width of an element."""
         self.element.classes('min-w-' + value)
         return self
 
-    def max_width(self, value: MaxWidth) -> 'Tailwind':
+    def max_width(self, value: MaxWidth) -> Tailwind:
         """Utilities for setting the maximum width of an element."""
         self.element.classes('max-w-' + value)
         return self
 
-    def height(self, value: Height) -> 'Tailwind':
+    def height(self, value: Height) -> Tailwind:
         """Utilities for setting the height of an element."""
         self.element.classes('h-' + value)
         return self
 
-    def min_height(self, value: MinHeight) -> 'Tailwind':
+    def min_height(self, value: MinHeight) -> Tailwind:
         """Utilities for setting the minimum height of an element."""
         self.element.classes('min-h-' + value)
         return self
 
-    def max_height(self, value: MaxHeight) -> 'Tailwind':
+    def max_height(self, value: MaxHeight) -> Tailwind:
         """Utilities for setting the maximum height of an element."""
         self.element.classes('max-h-' + value)
         return self
 
-    def font_family(self, value: FontFamily) -> 'Tailwind':
+    def font_family(self, value: FontFamily) -> Tailwind:
         """Utilities for controlling the font family of an element."""
         self.element.classes('font-' + value)
         return self
 
-    def font_size(self, value: FontSize) -> 'Tailwind':
+    def font_size(self, value: FontSize) -> Tailwind:
         """Utilities for controlling the font size of an element."""
         self.element.classes('text-' + value)
         return self
 
-    def font_smoothing(self, value: FontSmoothing) -> 'Tailwind':
+    def font_smoothing(self, value: FontSmoothing) -> Tailwind:
         """Utilities for controlling the font smoothing of an element."""
         self.element.classes('' + value)
         return self
 
-    def font_style(self, value: FontStyle) -> 'Tailwind':
+    def font_style(self, value: FontStyle) -> Tailwind:
         """Utilities for controlling the style of text."""
         self.element.classes('' + value)
         return self
 
-    def font_weight(self, value: FontWeight) -> 'Tailwind':
+    def font_weight(self, value: FontWeight) -> Tailwind:
         """Utilities for controlling the font weight of an element."""
         self.element.classes('font-' + value)
         return self
 
-    def font_variant_numeric(self, value: FontVariantNumeric) -> 'Tailwind':
+    def font_variant_numeric(self, value: FontVariantNumeric) -> Tailwind:
         """Utilities for controlling the variant of numbers."""
         self.element.classes('' + value)
         return self
 
-    def letter_spacing(self, value: LetterSpacing) -> 'Tailwind':
+    def letter_spacing(self, value: LetterSpacing) -> Tailwind:
         """Utilities for controlling the tracking (letter spacing) of an element."""
         self.element.classes('tracking-' + value)
         return self
 
-    def line_clamp(self, value: LineClamp) -> 'Tailwind':
+    def line_clamp(self, value: LineClamp) -> Tailwind:
         """Utilities for clamping text to a specific number of lines."""
         self.element.classes('line-clamp-' + value)
         return self
 
-    def line_height(self, value: LineHeight) -> 'Tailwind':
+    def line_height(self, value: LineHeight) -> Tailwind:
         """Utilities for controlling the leading (line height) of an element."""
         self.element.classes('leading-' + value)
         return self
 
-    def list_style_image(self, value: ListStyleImage) -> 'Tailwind':
+    def list_style_image(self, value: ListStyleImage) -> Tailwind:
         """Utilities for controlling the marker images for list items."""
         self.element.classes('list-image' + value)
         return self
 
-    def list_style_position(self, value: ListStylePosition) -> 'Tailwind':
+    def list_style_position(self, value: ListStylePosition) -> Tailwind:
         """Utilities for controlling the position of bullets/numbers in lists."""
         self.element.classes('list-' + value)
         return self
 
-    def list_style_type(self, value: ListStyleType) -> 'Tailwind':
+    def list_style_type(self, value: ListStyleType) -> Tailwind:
         """Utilities for controlling the bullet/number style of a list."""
         self.element.classes('list-' + value)
         return self
 
-    def text_align(self, value: TextAlign) -> 'Tailwind':
+    def text_align(self, value: TextAlign) -> Tailwind:
         """Utilities for controlling the alignment of text."""
         self.element.classes('text-' + value)
         return self
 
-    def text_color(self, value: TextColor) -> 'Tailwind':
+    def text_color(self, value: TextColor) -> Tailwind:
         """Utilities for controlling the text color of an element."""
         self.element.classes('text-' + value)
         return self
 
-    def text_decoration(self, value: TextDecoration) -> 'Tailwind':
+    def text_decoration(self, value: TextDecoration) -> Tailwind:
         """Utilities for controlling the decoration of text."""
         self.element.classes('' + value)
         return self
 
-    def text_decoration_color(self, value: TextDecorationColor) -> 'Tailwind':
+    def text_decoration_color(self, value: TextDecorationColor) -> Tailwind:
         """Utilities for controlling the color of text decorations."""
         self.element.classes('decoration-' + value)
         return self
 
-    def text_decoration_style(self, value: TextDecorationStyle) -> 'Tailwind':
+    def text_decoration_style(self, value: TextDecorationStyle) -> Tailwind:
         """Utilities for controlling the style of text decorations."""
         self.element.classes('decoration-' + value)
         return self
 
-    def text_decoration_thickness(self, value: TextDecorationThickness) -> 'Tailwind':
+    def text_decoration_thickness(self, value: TextDecorationThickness) -> Tailwind:
         """Utilities for controlling the thickness of text decorations."""
         self.element.classes('decoration-' + value)
         return self
 
-    def text_underline_offset(self, value: TextUnderlineOffset) -> 'Tailwind':
+    def text_underline_offset(self, value: TextUnderlineOffset) -> Tailwind:
         """Utilities for controlling the offset of a text underline."""
         self.element.classes('underline-offset-' + value)
         return self
 
-    def text_transform(self, value: TextTransform) -> 'Tailwind':
+    def text_transform(self, value: TextTransform) -> Tailwind:
         """Utilities for controlling the transformation of text."""
         self.element.classes('' + value)
         return self
 
-    def text_overflow(self, value: TextOverflow) -> 'Tailwind':
+    def text_overflow(self, value: TextOverflow) -> Tailwind:
         """Utilities for controlling text overflow in an element."""
         self.element.classes('' + value)
         return self
 
-    def text_indent(self, value: TextIndent) -> 'Tailwind':
+    def text_indent(self, value: TextIndent) -> Tailwind:
         """Utilities for controlling the amount of empty space shown before text in a block."""
         self.element.classes('indent-' + value)
         return self
 
-    def vertical_align(self, value: VerticalAlign) -> 'Tailwind':
+    def vertical_align(self, value: VerticalAlign) -> Tailwind:
         """Utilities for controlling the vertical alignment of an inline or table-cell box."""
         self.element.classes('align-' + value)
         return self
 
-    def whitespace(self, value: Whitespace) -> 'Tailwind':
+    def whitespace(self, value: Whitespace) -> Tailwind:
         """Utilities for controlling an element's white-space property."""
         self.element.classes('whitespace-' + value)
         return self
 
-    def word_break(self, value: WordBreak) -> 'Tailwind':
+    def word_break(self, value: WordBreak) -> Tailwind:
         """Utilities for controlling word breaks in an element."""
         self.element.classes('break-' + value)
         return self
 
-    def hyphens(self, value: Hyphens) -> 'Tailwind':
+    def hyphens(self, value: Hyphens) -> Tailwind:
         """Utilities for controlling how words should be hyphenated."""
         self.element.classes('hyphens-' + value)
         return self
 
-    def content(self, value: Content) -> 'Tailwind':
+    def content(self, value: Content) -> Tailwind:
         """Utilities for controlling the content of the before and after pseudo-elements."""
         self.element.classes('content' + value)
         return self
 
-    def background_attachment(self, value: BackgroundAttachment) -> 'Tailwind':
+    def background_attachment(self, value: BackgroundAttachment) -> Tailwind:
         """Utilities for controlling how a background image behaves when scrolling."""
         self.element.classes('bg-' + value)
         return self
 
-    def background_clip(self, value: BackgroundClip) -> 'Tailwind':
+    def background_clip(self, value: BackgroundClip) -> Tailwind:
         """Utilities for controlling the bounding box of an element's background."""
         self.element.classes('bg-clip-' + value)
         return self
 
-    def background_color(self, value: BackgroundColor) -> 'Tailwind':
+    def background_color(self, value: BackgroundColor) -> Tailwind:
         """Utilities for controlling an element's background color."""
         self.element.classes('bg-' + value)
         return self
 
-    def background_origin(self, value: BackgroundOrigin) -> 'Tailwind':
+    def background_origin(self, value: BackgroundOrigin) -> Tailwind:
         """Utilities for controlling how an element's background is positioned relative to borders, padding, and content."""
         self.element.classes('bg-origin-' + value)
         return self
 
-    def background_position(self, value: BackgroundPosition) -> 'Tailwind':
+    def background_position(self, value: BackgroundPosition) -> Tailwind:
         """Utilities for controlling the position of an element's background image."""
         self.element.classes('bg-' + value)
         return self
 
-    def background_repeat(self, value: BackgroundRepeat) -> 'Tailwind':
+    def background_repeat(self, value: BackgroundRepeat) -> Tailwind:
         """Utilities for controlling the repetition of an element's background image."""
         self.element.classes('bg-' + value)
         return self
 
-    def background_size(self, value: BackgroundSize) -> 'Tailwind':
+    def background_size(self, value: BackgroundSize) -> Tailwind:
         """Utilities for controlling the background size of an element's background image."""
         self.element.classes('bg-' + value)
         return self
 
-    def background_image(self, value: BackgroundImage) -> 'Tailwind':
+    def background_image(self, value: BackgroundImage) -> Tailwind:
         """Utilities for controlling an element's background image."""
         self.element.classes('bg-' + value)
         return self
 
-    def gradient_color_stops(self, value: GradientColorStops) -> 'Tailwind':
+    def gradient_color_stops(self, value: GradientColorStops) -> Tailwind:
         """Utilities for controlling the color stops in background gradients."""
         self.element.classes('' + value)
         return self
 
-    def border_radius(self, value: BorderRadius) -> 'Tailwind':
+    def border_radius(self, value: BorderRadius) -> Tailwind:
         """Utilities for controlling the border radius of an element."""
         self.element.classes('rounded-' + value)
         return self
 
-    def border_width(self, value: BorderWidth) -> 'Tailwind':
+    def border_width(self, value: BorderWidth) -> Tailwind:
         """Utilities for controlling the width of an element's borders."""
         self.element.classes('border-' + value)
         return self
 
-    def border_color(self, value: BorderColor) -> 'Tailwind':
+    def border_color(self, value: BorderColor) -> Tailwind:
         """Utilities for controlling the color of an element's borders."""
         self.element.classes('border-' + value)
         return self
 
-    def border_style(self, value: BorderStyle) -> 'Tailwind':
+    def border_style(self, value: BorderStyle) -> Tailwind:
         """Utilities for controlling the style of an element's borders."""
         self.element.classes('border-' + value)
         return self
 
-    def divide_width(self, value: DivideWidth) -> 'Tailwind':
+    def divide_width(self, value: DivideWidth) -> Tailwind:
         """Utilities for controlling the border width between elements."""
         self.element.classes('divide-' + value)
         return self
 
-    def divide_color(self, value: DivideColor) -> 'Tailwind':
+    def divide_color(self, value: DivideColor) -> Tailwind:
         """Utilities for controlling the border color between elements."""
         self.element.classes('divide-' + value)
         return self
 
-    def divide_style(self, value: DivideStyle) -> 'Tailwind':
+    def divide_style(self, value: DivideStyle) -> Tailwind:
         """Utilities for controlling the border style between elements."""
         self.element.classes('divide-' + value)
         return self
 
-    def outline_width(self, value: OutlineWidth) -> 'Tailwind':
+    def outline_width(self, value: OutlineWidth) -> Tailwind:
         """Utilities for controlling the width of an element's outline."""
         self.element.classes('outline-' + value)
         return self
 
-    def outline_color(self, value: OutlineColor) -> 'Tailwind':
+    def outline_color(self, value: OutlineColor) -> Tailwind:
         """Utilities for controlling the color of an element's outline."""
         self.element.classes('outline-' + value)
         return self
 
-    def outline_style(self, value: OutlineStyle) -> 'Tailwind':
+    def outline_style(self, value: OutlineStyle) -> Tailwind:
         """Utilities for controlling the style of an element's outline."""
         self.element.classes('outline-' + value)
         return self
 
-    def outline_offset(self, value: OutlineOffset) -> 'Tailwind':
+    def outline_offset(self, value: OutlineOffset) -> Tailwind:
         """Utilities for controlling the offset of an element's outline."""
         self.element.classes('outline-offset-' + value)
         return self
 
-    def ring_width(self, value: RingWidth) -> 'Tailwind':
+    def ring_width(self, value: RingWidth) -> Tailwind:
         """Utilities for creating outline rings with box-shadows."""
         self.element.classes('ring-' + value)
         return self
 
-    def ring_color(self, value: RingColor) -> 'Tailwind':
+    def ring_color(self, value: RingColor) -> Tailwind:
         """Utilities for setting the color of outline rings."""
         self.element.classes('ring-' + value)
         return self
 
-    def ring_offset_width(self, value: RingOffsetWidth) -> 'Tailwind':
+    def ring_offset_width(self, value: RingOffsetWidth) -> Tailwind:
         """Utilities for simulating an offset when adding outline rings."""
         self.element.classes('ring-offset-' + value)
         return self
 
-    def ring_offset_color(self, value: RingOffsetColor) -> 'Tailwind':
+    def ring_offset_color(self, value: RingOffsetColor) -> Tailwind:
         """Utilities for setting the color of outline ring offsets."""
         self.element.classes('ring-offset-' + value)
         return self
 
-    def box_shadow(self, value: BoxShadow) -> 'Tailwind':
+    def box_shadow(self, value: BoxShadow) -> Tailwind:
         """Utilities for controlling the box shadow of an element."""
         self.element.classes('shadow-' + value)
         return self
 
-    def box_shadow_color(self, value: BoxShadowColor) -> 'Tailwind':
+    def box_shadow_color(self, value: BoxShadowColor) -> Tailwind:
         """Utilities for controlling the color of a box shadow."""
         self.element.classes('shadow-' + value)
         return self
 
-    def opacity(self, value: Opacity) -> 'Tailwind':
+    def opacity(self, value: Opacity) -> Tailwind:
         """Utilities for controlling the opacity of an element."""
         self.element.classes('opacity-' + value)
         return self
 
-    def mix_blend_mode(self, value: MixBlendMode) -> 'Tailwind':
+    def mix_blend_mode(self, value: MixBlendMode) -> Tailwind:
         """Utilities for controlling how an element should blend with the background."""
         self.element.classes('mix-blend-' + value)
         return self
 
-    def background_blend_mode(self, value: BackgroundBlendMode) -> 'Tailwind':
+    def background_blend_mode(self, value: BackgroundBlendMode) -> Tailwind:
         """Utilities for controlling how an element's background image should blend with its background color."""
         self.element.classes('bg-blend-' + value)
         return self
 
-    def blur(self, value: Blur) -> 'Tailwind':
+    def blur(self, value: Blur) -> Tailwind:
         """Utilities for applying blur filters to an element."""
         self.element.classes('blur-' + value)
         return self
 
-    def brightness(self, value: Brightness) -> 'Tailwind':
+    def brightness(self, value: Brightness) -> Tailwind:
         """Utilities for applying brightness filters to an element."""
         self.element.classes('brightness-' + value)
         return self
 
-    def contrast(self, value: Contrast) -> 'Tailwind':
+    def contrast(self, value: Contrast) -> Tailwind:
         """Utilities for applying contrast filters to an element."""
         self.element.classes('contrast-' + value)
         return self
 
-    def drop_shadow(self, value: DropShadow) -> 'Tailwind':
+    def drop_shadow(self, value: DropShadow) -> Tailwind:
         """Utilities for applying drop-shadow filters to an element."""
         self.element.classes('drop-shadow-' + value)
         return self
 
-    def grayscale(self, value: Grayscale) -> 'Tailwind':
+    def grayscale(self, value: Grayscale) -> Tailwind:
         """Utilities for applying grayscale filters to an element."""
         self.element.classes('grayscale-' + value)
         return self
 
-    def hue_rotate(self, value: HueRotate) -> 'Tailwind':
+    def hue_rotate(self, value: HueRotate) -> Tailwind:
         """Utilities for applying hue-rotate filters to an element."""
         self.element.classes('hue-rotate-' + value)
         return self
 
-    def invert(self, value: Invert) -> 'Tailwind':
+    def invert(self, value: Invert) -> Tailwind:
         """Utilities for applying invert filters to an element."""
         self.element.classes('invert-' + value)
         return self
 
-    def saturate(self, value: Saturate) -> 'Tailwind':
+    def saturate(self, value: Saturate) -> Tailwind:
         """Utilities for applying saturation filters to an element."""
         self.element.classes('saturate-' + value)
         return self
 
-    def sepia(self, value: Sepia) -> 'Tailwind':
+    def sepia(self, value: Sepia) -> Tailwind:
         """Utilities for applying sepia filters to an element."""
         self.element.classes('sepia-' + value)
         return self
 
-    def backdrop_blur(self, value: BackdropBlur) -> 'Tailwind':
+    def backdrop_blur(self, value: BackdropBlur) -> Tailwind:
         """Utilities for applying backdrop blur filters to an element."""
         self.element.classes('backdrop-blur-' + value)
         return self
 
-    def backdrop_brightness(self, value: BackdropBrightness) -> 'Tailwind':
+    def backdrop_brightness(self, value: BackdropBrightness) -> Tailwind:
         """Utilities for applying backdrop brightness filters to an element."""
         self.element.classes('backdrop-brightness-' + value)
         return self
 
-    def backdrop_contrast(self, value: BackdropContrast) -> 'Tailwind':
+    def backdrop_contrast(self, value: BackdropContrast) -> Tailwind:
         """Utilities for applying backdrop contrast filters to an element."""
         self.element.classes('backdrop-contrast-' + value)
         return self
 
-    def backdrop_grayscale(self, value: BackdropGrayscale) -> 'Tailwind':
+    def backdrop_grayscale(self, value: BackdropGrayscale) -> Tailwind:
         """Utilities for applying backdrop grayscale filters to an element."""
         self.element.classes('backdrop-grayscale-' + value)
         return self
 
-    def backdrop_hue_rotate(self, value: BackdropHueRotate) -> 'Tailwind':
+    def backdrop_hue_rotate(self, value: BackdropHueRotate) -> Tailwind:
         """Utilities for applying backdrop hue-rotate filters to an element."""
         self.element.classes('backdrop-hue-rotate-' + value)
         return self
 
-    def backdrop_invert(self, value: BackdropInvert) -> 'Tailwind':
+    def backdrop_invert(self, value: BackdropInvert) -> Tailwind:
         """Utilities for applying backdrop invert filters to an element."""
         self.element.classes('backdrop-invert-' + value)
         return self
 
-    def backdrop_opacity(self, value: BackdropOpacity) -> 'Tailwind':
+    def backdrop_opacity(self, value: BackdropOpacity) -> Tailwind:
         """Utilities for applying backdrop opacity filters to an element."""
         self.element.classes('backdrop-opacity-' + value)
         return self
 
-    def backdrop_saturate(self, value: BackdropSaturate) -> 'Tailwind':
+    def backdrop_saturate(self, value: BackdropSaturate) -> Tailwind:
         """Utilities for applying backdrop saturation filters to an element."""
         self.element.classes('backdrop-saturate-' + value)
         return self
 
-    def backdrop_sepia(self, value: BackdropSepia) -> 'Tailwind':
+    def backdrop_sepia(self, value: BackdropSepia) -> Tailwind:
         """Utilities for applying backdrop sepia filters to an element."""
         self.element.classes('backdrop-sepia-' + value)
         return self
 
-    def border_collapse(self, value: BorderCollapse) -> 'Tailwind':
+    def border_collapse(self, value: BorderCollapse) -> Tailwind:
         """Utilities for controlling whether table borders should collapse or be separated."""
         self.element.classes('border-' + value)
         return self
 
-    def border_spacing(self, value: BorderSpacing) -> 'Tailwind':
+    def border_spacing(self, value: BorderSpacing) -> Tailwind:
         """Utilities for controlling the spacing between table borders."""
         self.element.classes('border-spacing-' + value)
         return self
 
-    def table_layout(self, value: TableLayout) -> 'Tailwind':
+    def table_layout(self, value: TableLayout) -> Tailwind:
         """Utilities for controlling the table layout algorithm."""
         self.element.classes('table-' + value)
         return self
 
-    def caption_side(self, value: CaptionSide) -> 'Tailwind':
+    def caption_side(self, value: CaptionSide) -> Tailwind:
         """Utilities for controlling the alignment of a caption element inside of a table."""
         self.element.classes('caption-' + value)
         return self
 
-    def transition_property(self, value: TransitionProperty) -> 'Tailwind':
+    def transition_property(self, value: TransitionProperty) -> Tailwind:
         """Utilities for controlling which CSS properties transition."""
         self.element.classes('transition-' + value)
         return self
 
-    def transition_duration(self, value: TransitionDuration) -> 'Tailwind':
+    def transition_duration(self, value: TransitionDuration) -> Tailwind:
         """Utilities for controlling the duration of CSS transitions."""
         self.element.classes('duration-' + value)
         return self
 
-    def transition_timing_function(self, value: TransitionTimingFunction) -> 'Tailwind':
+    def transition_timing_function(self, value: TransitionTimingFunction) -> Tailwind:
         """Utilities for controlling the easing of CSS transitions."""
         self.element.classes('ease-' + value)
         return self
 
-    def transition_delay(self, value: TransitionDelay) -> 'Tailwind':
+    def transition_delay(self, value: TransitionDelay) -> Tailwind:
         """Utilities for controlling the delay of CSS transitions."""
         self.element.classes('delay-' + value)
         return self
 
-    def animation(self, value: Animation) -> 'Tailwind':
+    def animation(self, value: Animation) -> Tailwind:
         """Utilities for animating elements with CSS animations."""
         self.element.classes('animate-' + value)
         return self
 
-    def scale(self, value: Scale) -> 'Tailwind':
+    def scale(self, value: Scale) -> Tailwind:
         """Utilities for scaling elements with transform."""
         self.element.classes('scale-' + value)
         return self
 
-    def rotate(self, value: Rotate) -> 'Tailwind':
+    def rotate(self, value: Rotate) -> Tailwind:
         """Utilities for rotating elements with transform."""
         self.element.classes('rotate-' + value)
         return self
 
-    def translate(self, value: Translate) -> 'Tailwind':
+    def translate(self, value: Translate) -> Tailwind:
         """Utilities for translating elements with transform."""
         self.element.classes('translate-' + value)
         return self
 
-    def skew(self, value: Skew) -> 'Tailwind':
+    def skew(self, value: Skew) -> Tailwind:
         """Utilities for skewing elements with transform."""
         self.element.classes('skew-' + value)
         return self
 
-    def transform_origin(self, value: TransformOrigin) -> 'Tailwind':
+    def transform_origin(self, value: TransformOrigin) -> Tailwind:
         """Utilities for specifying the origin for an element's transformations."""
         self.element.classes('origin-' + value)
         return self
 
-    def accent_color(self, value: AccentColor) -> 'Tailwind':
+    def accent_color(self, value: AccentColor) -> Tailwind:
         """Utilities for controlling the accented color of a form control."""
         self.element.classes('accent-' + value)
         return self
 
-    def appearance(self, value: Appearance) -> 'Tailwind':
+    def appearance(self, value: Appearance) -> Tailwind:
         """Utilities for suppressing native form control styling."""
         self.element.classes('appearance' + value)
         return self
 
-    def cursor(self, value: Cursor) -> 'Tailwind':
+    def cursor(self, value: Cursor) -> Tailwind:
         """Utilities for controlling the cursor style when hovering over an element."""
         self.element.classes('cursor-' + value)
         return self
 
-    def caret_color(self, value: CaretColor) -> 'Tailwind':
+    def caret_color(self, value: CaretColor) -> Tailwind:
         """Utilities for controlling the color of the text input cursor."""
         self.element.classes('caret-' + value)
         return self
 
-    def pointer_events(self, value: PointerEvents) -> 'Tailwind':
+    def pointer_events(self, value: PointerEvents) -> Tailwind:
         """Utilities for controlling whether an element responds to pointer events."""
         self.element.classes('pointer-events-' + value)
         return self
 
-    def resize(self, value: Resize) -> 'Tailwind':
+    def resize(self, value: Resize) -> Tailwind:
         """Utilities for controlling how an element can be resized."""
         self.element.classes('resize-' + value)
         return self
 
-    def scroll_behavior(self, value: ScrollBehavior) -> 'Tailwind':
+    def scroll_behavior(self, value: ScrollBehavior) -> Tailwind:
         """Utilities for controlling the scroll behavior of an element."""
         self.element.classes('scroll-' + value)
         return self
 
-    def scroll_margin(self, value: ScrollMargin) -> 'Tailwind':
+    def scroll_margin(self, value: ScrollMargin) -> Tailwind:
         """Utilities for controlling the scroll offset around items in a snap container."""
         self.element.classes('scroll-' + value)
         return self
 
-    def scroll_padding(self, value: ScrollPadding) -> 'Tailwind':
+    def scroll_padding(self, value: ScrollPadding) -> Tailwind:
         """Utilities for controlling an element's scroll offset within a snap container."""
         self.element.classes('scroll-' + value)
         return self
 
-    def scroll_snap_align(self, value: ScrollSnapAlign) -> 'Tailwind':
+    def scroll_snap_align(self, value: ScrollSnapAlign) -> Tailwind:
         """Utilities for controlling the scroll snap alignment of an element."""
         self.element.classes('snap-' + value)
         return self
 
-    def scroll_snap_stop(self, value: ScrollSnapStop) -> 'Tailwind':
+    def scroll_snap_stop(self, value: ScrollSnapStop) -> Tailwind:
         """Utilities for controlling whether you can skip past possible snap positions."""
         self.element.classes('snap-' + value)
         return self
 
-    def scroll_snap_type(self, value: ScrollSnapType) -> 'Tailwind':
+    def scroll_snap_type(self, value: ScrollSnapType) -> Tailwind:
         """Utilities for controlling how strictly snap points are enforced in a snap container."""
         self.element.classes('snap-' + value)
         return self
 
-    def touch_action(self, value: TouchAction) -> 'Tailwind':
+    def touch_action(self, value: TouchAction) -> Tailwind:
         """Utilities for controlling how an element can be scrolled and zoomed on touchscreens."""
         self.element.classes('touch-' + value)
         return self
 
-    def user_select(self, value: UserSelect) -> 'Tailwind':
+    def user_select(self, value: UserSelect) -> Tailwind:
         """Utilities for controlling whether the user can select text in an element."""
         self.element.classes('select-' + value)
         return self
 
-    def will_change(self, value: WillChange) -> 'Tailwind':
+    def will_change(self, value: WillChange) -> Tailwind:
         """Utilities for optimizing upcoming animations of elements that are expected to change."""
         self.element.classes('will-change-' + value)
         return self
 
-    def fill(self, value: Fill) -> 'Tailwind':
+    def fill(self, value: Fill) -> Tailwind:
         """Utilities for styling the fill of SVG elements."""
         self.element.classes('fill-' + value)
         return self
 
-    def stroke(self, value: Stroke) -> 'Tailwind':
+    def stroke(self, value: Stroke) -> Tailwind:
         """Utilities for styling the stroke of SVG elements."""
         self.element.classes('stroke-' + value)
         return self
 
-    def stroke_width(self, value: StrokeWidth) -> 'Tailwind':
+    def stroke_width(self, value: StrokeWidth) -> Tailwind:
         """Utilities for styling the stroke width of SVG elements."""
         self.element.classes('stroke-' + value)
         return self
 
-    def screen_readers(self, value: ScreenReaders) -> 'Tailwind':
+    def screen_readers(self, value: ScreenReaders) -> Tailwind:
         """Utilities for improving accessibility with screen readers."""
         self.element.classes('' + value)
         return self

+ 1 - 1
nicegui/welcome.py

@@ -2,7 +2,7 @@ import os
 import socket
 from typing import List
 
-from . import globals
+from . import globals  # pylint: disable=redefined-builtin
 
 try:
     import netifaces