Fix/ignore more pyright issues from recent merge
This commit is contained in:
parent
213307c413
commit
0aad41681c
@ -2260,6 +2260,10 @@ class DynamicRouteVar(ComputedVar[Union[str, List[str]]]):
|
||||
pass
|
||||
|
||||
|
||||
async def _default_async_computed_var(_self: BaseState) -> Any:
|
||||
return None
|
||||
|
||||
|
||||
@dataclasses.dataclass(
|
||||
eq=False,
|
||||
frozen=True,
|
||||
@ -2270,7 +2274,7 @@ class AsyncComputedVar(ComputedVar[RETURN_TYPE]):
|
||||
"""A computed var that wraps a coroutinefunction."""
|
||||
|
||||
_fget: Callable[[BaseState], Coroutine[None, None, RETURN_TYPE]] = (
|
||||
dataclasses.field()
|
||||
dataclasses.field(default=_default_async_computed_var)
|
||||
)
|
||||
|
||||
@overload
|
||||
|
@ -70,10 +70,10 @@ class DependencyTracker:
|
||||
"""After initializing, populate the dependencies dict."""
|
||||
with contextlib.suppress(AttributeError):
|
||||
# unbox functools.partial
|
||||
self.func = cast(FunctionType, self.func.func) # pyright: ignore[reportGeneralTypeIssues]
|
||||
self.func = cast(FunctionType, self.func.func) # pyright: ignore[reportAttributeAccessIssue]
|
||||
with contextlib.suppress(AttributeError):
|
||||
# unbox EventHandler
|
||||
self.func = cast(FunctionType, self.func.fn) # pyright: ignore[reportGeneralTypeIssues]
|
||||
self.func = cast(FunctionType, self.func.fn) # pyright: ignore[reportAttributeAccessIssue]
|
||||
|
||||
if isinstance(self.func, FunctionType):
|
||||
with contextlib.suppress(AttributeError, IndexError):
|
||||
@ -150,7 +150,7 @@ class DependencyTracker:
|
||||
"""
|
||||
if isinstance(self.func, CodeType):
|
||||
return {}
|
||||
return self.func.__globals__ # pyright: ignore[reportGeneralTypeIssues]
|
||||
return self.func.__globals__ # pyright: ignore[reportAttributeAccessIssue]
|
||||
|
||||
def _get_closure(self) -> dict[str, Any]:
|
||||
"""Get the closure of the function, with unbound values omitted.
|
||||
@ -163,7 +163,7 @@ class DependencyTracker:
|
||||
return {
|
||||
var_name: get_cell_value(cell)
|
||||
for var_name, cell in zip(
|
||||
self.func.__code__.co_freevars, # pyright: ignore[reportGeneralTypeIssues]
|
||||
self.func.__code__.co_freevars, # pyright: ignore[reportAttributeAccessIssue]
|
||||
self.func.__closure__ or (),
|
||||
strict=False,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user