Skip to content

Commit 2cb193e

Browse files
improve app_src typing (#4324)
1 parent e457d53 commit 2cb193e

30 files changed

+32
-32
lines changed

benchmarks/test_benchmark_compile_pages.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def app_with_one_page(
212212
"""
213213
root = tmp_path_factory.mktemp("app1")
214214

215-
yield AppHarness.create(root=root, app_source=AppWithOnePage) # type: ignore
215+
yield AppHarness.create(root=root, app_source=AppWithOnePage)
216216

217217

218218
@pytest.fixture(scope="session")
@@ -276,7 +276,7 @@ def app_with_thousand_pages(
276276

277277
yield AppHarness.create(
278278
root=root,
279-
app_source=functools.partial( # type: ignore
279+
app_source=functools.partial(
280280
AppWithThousandPages,
281281
render_comp=render_multiple_pages, # type: ignore
282282
),

reflex/testing.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class AppHarness:
118118

119119
app_name: str
120120
app_source: Optional[
121-
types.FunctionType | types.ModuleType | str | functools.partial[Any]
121+
Callable[[], None] | types.ModuleType | str | functools.partial[Any]
122122
]
123123
app_path: pathlib.Path
124124
app_module_path: pathlib.Path
@@ -138,7 +138,7 @@ def create(
138138
cls,
139139
root: pathlib.Path,
140140
app_source: Optional[
141-
types.FunctionType | types.ModuleType | str | functools.partial[Any]
141+
Callable[[], None] | types.ModuleType | str | functools.partial[Any]
142142
] = None,
143143
app_name: Optional[str] = None,
144144
) -> "AppHarness":

tests/integration/test_background_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def background_task(
190190
"""
191191
with AppHarness.create(
192192
root=tmp_path_factory.mktemp("background_task"),
193-
app_source=BackgroundTask, # type: ignore
193+
app_source=BackgroundTask,
194194
) as harness:
195195
yield harness
196196

tests/integration/test_call_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def call_script(tmp_path_factory) -> Generator[AppHarness, None, None]:
355355
"""
356356
with AppHarness.create(
357357
root=tmp_path_factory.mktemp("call_script"),
358-
app_source=CallScript, # type: ignore
358+
app_source=CallScript,
359359
) as harness:
360360
yield harness
361361

tests/integration/test_client_storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def client_side(tmp_path_factory) -> Generator[AppHarness, None, None]:
137137
"""
138138
with AppHarness.create(
139139
root=tmp_path_factory.mktemp("client_side"),
140-
app_source=ClientSide, # type: ignore
140+
app_source=ClientSide,
141141
) as harness:
142142
yield harness
143143

tests/integration/test_component_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def component_state_app(tmp_path) -> Generator[AppHarness, None, None]:
115115
"""
116116
with AppHarness.create(
117117
root=tmp_path,
118-
app_source=ComponentStateApp, # type: ignore
118+
app_source=ComponentStateApp,
119119
) as harness:
120120
yield harness
121121

tests/integration/test_computed_vars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def computed_vars(
125125
"""
126126
with AppHarness.create(
127127
root=tmp_path_factory.mktemp("computed_vars"),
128-
app_source=ComputedVars, # type: ignore
128+
app_source=ComputedVars,
129129
) as harness:
130130
yield harness
131131

tests/integration/test_connection_banner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def connection_banner(tmp_path) -> Generator[AppHarness, None, None]:
5252
"""
5353
with AppHarness.create(
5454
root=tmp_path,
55-
app_source=ConnectionBanner, # type: ignore
55+
app_source=ConnectionBanner,
5656
) as harness:
5757
yield harness
5858

tests/integration/test_deploy_url.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def deploy_url_sample(
4444
"""
4545
with AppHarness.create(
4646
root=tmp_path_factory.mktemp("deploy_url_sample"),
47-
app_source=DeployUrlSample, # type: ignore
47+
app_source=DeployUrlSample,
4848
) as harness:
4949
yield harness
5050

tests/integration/test_dynamic_components.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def dynamic_components(tmp_path_factory) -> Generator[AppHarness, None, None]:
8585
"""
8686
with AppHarness.create(
8787
root=tmp_path_factory.mktemp("dynamic_components"),
88-
app_source=DynamicComponents, # type: ignore
88+
app_source=DynamicComponents,
8989
) as harness:
9090
assert harness.app_instance is not None, "app is not running"
9191
yield harness

0 commit comments

Comments
 (0)