Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable PGH, bump pyright and fix all #type: ignore #4699

Merged
merged 12 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ repos:
entry: python3 scripts/make_pyi.py

- repo: https://github.com/RobertCraigie/pyright-python
rev: v1.1.334
rev: v1.1.392
hooks:
- id: pyright
args: [reflex, tests]
Expand Down
20 changes: 10 additions & 10 deletions benchmarks/test_benchmark_compile_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def render_component(num: int):
rx.box(
rx.accordion.root(
rx.accordion.item(
header="Full Ingredients", # type: ignore
content="Yes. It's built with accessibility in mind.", # type: ignore
header="Full Ingredients",
content="Yes. It's built with accessibility in mind.",
font_size="3em",
),
rx.accordion.item(
header="Applications", # type: ignore
content="Yes. It's unstyled by default, giving you freedom over the look and feel.", # type: ignore
header="Applications",
content="Yes. It's unstyled by default, giving you freedom over the look and feel.",
),
collapsible=True,
variant="ghost",
Expand Down Expand Up @@ -166,9 +166,9 @@ def app_with_10_components(
root=root,
app_source=functools.partial(
AppWithTenComponentsOnePage,
render_component=render_component, # type: ignore
render_component=render_component, # pyright: ignore [reportCallIssue]
),
) # type: ignore
)


@pytest.fixture(scope="session")
Expand All @@ -189,9 +189,9 @@ def app_with_100_components(
root=root,
app_source=functools.partial(
AppWithHundredComponentOnePage,
render_component=render_component, # type: ignore
render_component=render_component, # pyright: ignore [reportCallIssue]
),
) # type: ignore
)


@pytest.fixture(scope="session")
Expand All @@ -212,9 +212,9 @@ def app_with_1000_components(
root=root,
app_source=functools.partial(
AppWithThousandComponentsOnePage,
render_component=render_component, # type: ignore
render_component=render_component, # pyright: ignore [reportCallIssue]
),
) # type: ignore
)


@pytest.mark.skipif(constants.IS_WINDOWS, reason=WINDOWS_SKIP_REASON)
Expand Down
26 changes: 13 additions & 13 deletions benchmarks/test_benchmark_compile_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def render_multiple_pages(app, num: int):
"""
from typing import Tuple

from rxconfig import config # type: ignore
from rxconfig import config # pyright: ignore [reportMissingImports]

import reflex as rx

Expand Down Expand Up @@ -74,13 +74,13 @@ class State(rx.State):
rx.select(
["C", "PF", "SF", "PG", "SG"],
placeholder="Select a position. (All)",
on_change=State.set_position, # type: ignore
on_change=State.set_position, # pyright: ignore [reportAttributeAccessIssue]
size="3",
),
rx.select(
college,
placeholder="Select a college. (All)",
on_change=State.set_college, # type: ignore
on_change=State.set_college, # pyright: ignore [reportAttributeAccessIssue]
size="3",
),
),
Expand All @@ -95,7 +95,7 @@ class State(rx.State):
default_value=[18, 50],
min=18,
max=50,
on_value_commit=State.set_age, # type: ignore
on_value_commit=State.set_age, # pyright: ignore [reportAttributeAccessIssue]
),
align_items="left",
width="100%",
Expand All @@ -110,7 +110,7 @@ class State(rx.State):
default_value=[0, 25000000],
min=0,
max=25000000,
on_value_commit=State.set_salary, # type: ignore
on_value_commit=State.set_salary, # pyright: ignore [reportAttributeAccessIssue]
),
align_items="left",
width="100%",
Expand All @@ -130,7 +130,7 @@ class State(rx.State):

def AppWithOnePage():
"""A reflex app with one page."""
from rxconfig import config # type: ignore
from rxconfig import config # pyright: ignore [reportMissingImports]

import reflex as rx

Expand Down Expand Up @@ -232,7 +232,7 @@ def app_with_ten_pages(
root=root,
app_source=functools.partial(
AppWithTenPages,
render_comp=render_multiple_pages, # type: ignore
render_comp=render_multiple_pages, # pyright: ignore [reportCallIssue]
),
)

Expand All @@ -255,9 +255,9 @@ def app_with_hundred_pages(
root=root,
app_source=functools.partial(
AppWithHundredPages,
render_comp=render_multiple_pages, # type: ignore
render_comp=render_multiple_pages, # pyright: ignore [reportCallIssue]
),
) # type: ignore
)


@pytest.fixture(scope="session")
Expand All @@ -278,9 +278,9 @@ def app_with_thousand_pages(
root=root,
app_source=functools.partial(
AppWithThousandPages,
render_comp=render_multiple_pages, # type: ignore
render_comp=render_multiple_pages, # pyright: ignore [reportCallIssue]
),
) # type: ignore
)


@pytest.fixture(scope="session")
Expand All @@ -301,9 +301,9 @@ def app_with_ten_thousand_pages(
root=root,
app_source=functools.partial(
AppWithTenThousandPages,
render_comp=render_multiple_pages, # type: ignore
render_comp=render_multiple_pages, # pyright: ignore [reportCallIssue]
),
) # type: ignore
)


@pytest.mark.skipif(constants.IS_WINDOWS, reason=WINDOWS_SKIP_REASON)
Expand Down
Loading
Loading