From b0824d61a7383093c8352e5b0632ddaefdaf312b Mon Sep 17 00:00:00 2001 From: Lendemor Date: Mon, 27 Jan 2025 21:02:00 +0100 Subject: [PATCH] ignore incompatible override --- pyrightconfig.json | 3 +++ reflex/components/core/banner.py | 2 +- reflex/components/core/cond.py | 4 ++-- reflex/components/core/match.py | 4 ++-- reflex/testing.py | 8 ++++++-- tests/integration/test_background_task.py | 2 +- tests/integration/test_component_state.py | 2 +- tests/units/components/core/test_cond.py | 2 +- 8 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 pyrightconfig.json diff --git a/pyrightconfig.json b/pyrightconfig.json new file mode 100644 index 000000000..bb1e87263 --- /dev/null +++ b/pyrightconfig.json @@ -0,0 +1,3 @@ +{ + "reportIncompatibleMethodOverride": false +} diff --git a/reflex/components/core/banner.py b/reflex/components/core/banner.py index d4716cfd2..6479bf3b2 100644 --- a/reflex/components/core/banner.py +++ b/reflex/components/core/banner.py @@ -116,7 +116,7 @@ class ConnectionToaster(Toaster): _var_data=VarData( imports={ "react": ["useEffect", "useState"], - **dict(target_url._get_all_var_data().imports), # pyright: ignore [reportArgumentType] + **dict(target_url._get_all_var_data().imports), # pyright: ignore [reportArgumentType, reportOptionalMemberAccess] } ), ).call( diff --git a/reflex/components/core/cond.py b/reflex/components/core/cond.py index b69f95e2a..25b691808 100644 --- a/reflex/components/core/cond.py +++ b/reflex/components/core/cond.py @@ -72,8 +72,8 @@ class Cond(MemoizationLeaf): def _render(self) -> Tag: return CondTag( cond=self.cond, - true_value=self.comp1.render(), - false_value=self.comp2.render(), + true_value=self.comp1.render(), # pyright: ignore [reportOptionalMemberAccess] + false_value=self.comp2.render(), # pyright: ignore [reportOptionalMemberAccess] ) def render(self) -> Dict: diff --git a/reflex/components/core/match.py b/reflex/components/core/match.py index 14a455385..ae8568ac5 100644 --- a/reflex/components/core/match.py +++ b/reflex/components/core/match.py @@ -238,11 +238,11 @@ class Match(MemoizationLeaf): match_cases=match_cases, default=default, # pyright: ignore [reportArgumentType] ), - _var_type=default._var_type, # pyright: ignore [reportAttributeAccessIssue] + _var_type=default._var_type, # pyright: ignore [reportAttributeAccessIssue,reportOptionalMemberAccess] _var_data=VarData.merge( match_cond_var._get_all_var_data(), *[el._get_all_var_data() for case in match_cases for el in case], - default._get_all_var_data(), # pyright: ignore [reportAttributeAccessIssue] + default._get_all_var_data(), # pyright: ignore [reportAttributeAccessIssue, reportOptionalMemberAccess] ), ) diff --git a/reflex/testing.py b/reflex/testing.py index b019f05c2..897cb3424 100644 --- a/reflex/testing.py +++ b/reflex/testing.py @@ -294,11 +294,15 @@ class AppHarness: if p not in before_decorated_pages ] self.app_instance = self.app_module.app - if isinstance(self.app_instance._state_manager, StateManagerRedis): + if self.app_instance and isinstance( + self.app_instance._state_manager, StateManagerRedis + ): # Create our own redis connection for testing. self.state_manager = StateManagerRedis.create(self.app_instance._state) # pyright: ignore [reportArgumentType] else: - self.state_manager = self.app_instance._state_manager + self.state_manager = ( + self.app_instance._state_manager if self.app_instance else None + ) def _reload_state_module(self): """Reload the rx.State module to avoid conflict when reloading.""" diff --git a/tests/integration/test_background_task.py b/tests/integration/test_background_task.py index 17a04e22b..f312f8122 100644 --- a/tests/integration/test_background_task.py +++ b/tests/integration/test_background_task.py @@ -288,7 +288,7 @@ def test_background_task( assert background_task._poll_for(lambda: counter.text == "620", timeout=40) # all tasks should have exited and cleaned up assert background_task._poll_for( - lambda: not background_task.app_instance._background_tasks + lambda: not background_task.app_instance._background_tasks # pyright: ignore [reportOptionalMemberAccess] ) diff --git a/tests/integration/test_component_state.py b/tests/integration/test_component_state.py index 8d843b7db..654dc7ce9 100644 --- a/tests/integration/test_component_state.py +++ b/tests/integration/test_component_state.py @@ -89,7 +89,7 @@ def ComponentStateApp(): mc_d, rx.button( "Inc A", - on_click=mc_a.State.increment, # pyright: ignore [reportAttributeAccessIssue] + on_click=mc_a.State.increment, # pyright: ignore [reportAttributeAccessIssue, reportOptionalMemberAccess] id="inc-a", ), rx.text( diff --git a/tests/units/components/core/test_cond.py b/tests/units/components/core/test_cond.py index 8b91db107..ac073ed29 100644 --- a/tests/units/components/core/test_cond.py +++ b/tests/units/components/core/test_cond.py @@ -113,7 +113,7 @@ def test_cond_no_else(): comp = comp.children[0] assert isinstance(comp, Cond) assert comp.cond._decode() is True - assert comp.comp1.render() == Fragment.create(Text.create("hello")).render() + assert comp.comp1.render() == Fragment.create(Text.create("hello")).render() # pyright: ignore [reportOptionalMemberAccess] assert comp.comp2 == Fragment.create() # Props do not support the use of cond without else