Skip to content

Commit

Permalink
run pyright
Browse files Browse the repository at this point in the history
  • Loading branch information
adhami3310 committed Aug 27, 2024
1 parent e3ae1aa commit 9caccf7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
15 changes: 6 additions & 9 deletions reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import functools
import inspect
import io
import dill
import multiprocess
from pathos import multiprocessing, pools
import os
import platform
import sys
Expand All @@ -37,6 +34,7 @@
from fastapi.middleware import cors
from fastapi.responses import StreamingResponse
from fastapi.staticfiles import StaticFiles
from pathos import pools
from rich.progress import MofNCompleteColumn, Progress, TimeElapsedColumn
from socketio import ASGIApp, AsyncNamespace, AsyncServer
from starlette_admin.contrib.sqla.admin import Admin
Expand All @@ -50,7 +48,6 @@
from reflex.compiler import utils as compiler_utils
from reflex.compiler.compiler import (
ExecutorSafeFunctions,
compile_uncompiled_page_helper,
)
from reflex.components.base.app_wrap import AppWrap
from reflex.components.base.error_boundary import ErrorBoundary
Expand Down Expand Up @@ -180,7 +177,7 @@ class OverlayFragment(Fragment):
class UncompiledPage:
"""An uncompiled page."""

component: Component
component: Union[Component, ComponentCallable]
route: str
title: str
description: str
Expand Down Expand Up @@ -545,8 +542,8 @@ def add_page(
self.uncompiled_pages[route] = UncompiledPage(
component=component,
route=route,
title=title,
description=description,
title=title or constants.DefaultPage.TITLE,
description=description or constants.DefaultPage.DESCRIPTION,
image=image,
on_load=on_load,
meta=meta,
Expand Down Expand Up @@ -1018,7 +1015,7 @@ def _submit_work(fn, *args, **kwargs):
compile_results.append(future.get())
progress.advance(task)

for route, future in pages_futures:
for _, future in pages_futures:
pages_results.append(future.get())
progress.advance(task)

Expand All @@ -1027,7 +1024,7 @@ def _submit_work(fn, *args, **kwargs):
self.pages[route] = component
compile_results.append(compiled_page)

for route, component in self.pages.items():
for _, component in self.pages.items():
# Add component._get_all_imports() to all_imports.
all_imports.update(component._get_all_imports())

Expand Down
9 changes: 7 additions & 2 deletions reflex/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ def purge_web_pages_dir():

if TYPE_CHECKING:
from reflex.app import UncompiledPage
from reflex.event import EventHandler, EventSpec


def compile_uncompiled_page_helper(route: str, page: UncompiledPage) -> Component:
Expand Down Expand Up @@ -596,6 +595,8 @@ def compile_page(
Args:
route: The route of the page to compile.
component: The component to compile.
state: The app state.
Returns:
The path and code of the compiled page.
Expand All @@ -615,9 +616,13 @@ def compile_uncompiled_page(
Args:
route: The route of the page to compile.
page: The uncompiled page.
state: The app state.
style: The style of the page.
theme: The theme of the page.
Returns:
The path and code of the compiled page.
The route, compiled component, and compiled page.
"""
component = compile_uncompiled_page_helper(route, page)
component = component if isinstance(component, Component) else component()
Expand Down
5 changes: 3 additions & 2 deletions reflex/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ def __setitem__(self, key: str, value: Any):
if _var is not None:
# Carry the imports/hooks when setting a Var as a value.
self._var_data = VarData.merge(
self._var_data if hasattr(self, "_var_data") else None, _var._get_all_var_data
())
self._var_data if hasattr(self, "_var_data") else None,
_var._get_all_var_data(),
)
super().__setitem__(key, value)


Expand Down

0 comments on commit 9caccf7

Please sign in to comment.