pyright checklist
This commit is contained in:
parent
4969df2dc2
commit
19e10038b6
10
poetry.lock
generated
10
poetry.lock
generated
@ -1,4 +1,4 @@
|
||||
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
|
||||
# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
|
||||
|
||||
[[package]]
|
||||
name = "alembic"
|
||||
@ -1842,13 +1842,13 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "pyright"
|
||||
version = "1.1.334"
|
||||
version = "1.1.378"
|
||||
description = "Command line wrapper for pyright"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "pyright-1.1.334-py3-none-any.whl", hash = "sha256:dcb13e8358e021189672c4d6ebcad192ab061e4c7225036973ec493183c6da68"},
|
||||
{file = "pyright-1.1.334.tar.gz", hash = "sha256:3adaf10f1f4209575dc022f9c897f7ef024639b7ea5b3cbe49302147e6949cd4"},
|
||||
{file = "pyright-1.1.378-py3-none-any.whl", hash = "sha256:8853776138b01bc284da07ac481235be7cc89d3176b073d2dba73636cb95be79"},
|
||||
{file = "pyright-1.1.378.tar.gz", hash = "sha256:78a043be2876d12d0af101d667e92c7734f3ebb9db71dccc2c220e7e7eb89ca2"},
|
||||
]
|
||||
|
||||
[package.dependencies]
|
||||
@ -3179,4 +3179,4 @@ type = ["pytest-mypy"]
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "c5d4fa9102c7fd39a6300628d22ca67cbf013e6d580eab43723b5b9ee02a57b8"
|
||||
content-hash = "9d77c059894e360c1bc0f5f12bcacab5cd6b86e3ceaf835ba55937218388446d"
|
||||
|
@ -69,7 +69,7 @@ reflex-chakra = ">=0.6.0a"
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pytest = ">=7.1.2,<8.0"
|
||||
pytest-mock = ">=3.10.0,<4.0"
|
||||
pyright = ">=1.1.229,<1.1.335"
|
||||
pyright = ">=1.1.229"
|
||||
darglint = ">=1.8.1,<2.0"
|
||||
toml = ">=0.10.2,<1.0"
|
||||
pytest-asyncio = ">=0.20.1,<0.22.0" # https://github.com/pytest-dev/pytest-asyncio/issues/706
|
||||
|
@ -3,17 +3,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import TYPE_CHECKING, Any, List, Type
|
||||
from typing import Any, List, Type
|
||||
|
||||
try:
|
||||
import pydantic.v1.main as pydantic_main
|
||||
from pydantic.v1 import BaseModel
|
||||
from pydantic.v1.fields import ModelField
|
||||
except ModuleNotFoundError:
|
||||
if not TYPE_CHECKING:
|
||||
import pydantic.main as pydantic_main
|
||||
from pydantic import BaseModel
|
||||
from pydantic.fields import ModelField # type: ignore
|
||||
import pydantic.main as pydantic_main
|
||||
from pydantic import BaseModel
|
||||
from pydantic.fields import ModelField # type: ignore
|
||||
|
||||
|
||||
from reflex import constants
|
||||
@ -48,7 +47,7 @@ def validate_field_name(bases: List[Type["BaseModel"]], field_name: str) -> None
|
||||
pydantic_main.validate_field_name = validate_field_name # type: ignore
|
||||
|
||||
|
||||
class Base(BaseModel): # pyright: ignore [reportUnboundVariable]
|
||||
class Base(BaseModel): # pyright: ignore [reportGeneralTypeIssues]
|
||||
"""The base class subclassed by all Reflex classes.
|
||||
|
||||
This class wraps Pydantic and provides common methods such as
|
||||
@ -65,7 +64,7 @@ class Base(BaseModel): # pyright: ignore [reportUnboundVariable]
|
||||
use_enum_values = True
|
||||
extra = "allow"
|
||||
|
||||
def json(self) -> str:
|
||||
def json(self) -> str: # pyright: ignore [reportIncompatibleMethodOverride]
|
||||
"""Convert the object to a json string.
|
||||
|
||||
Returns:
|
||||
|
@ -149,7 +149,7 @@ class Config(Base):
|
||||
See the [configuration](https://reflex.dev/docs/getting-started/configuration/) docs for more info.
|
||||
"""
|
||||
|
||||
class Config:
|
||||
class Config: # type: ignore
|
||||
"""Pydantic config for the config."""
|
||||
|
||||
validate_assignment = True
|
||||
|
@ -144,7 +144,7 @@ class EventHandler(EventActionsMixin):
|
||||
# Empty string means this event handler is a server side event.
|
||||
state_full_name: str = ""
|
||||
|
||||
class Config:
|
||||
class Config: # type: ignore
|
||||
"""The Pydantic config."""
|
||||
|
||||
# Needed to allow serialization of Callable.
|
||||
@ -229,7 +229,7 @@ class EventSpec(EventActionsMixin):
|
||||
# The arguments to pass to the function.
|
||||
args: Tuple[Tuple[Var, Var], ...] = ()
|
||||
|
||||
class Config:
|
||||
class Config: # type: ignore
|
||||
"""The Pydantic config."""
|
||||
|
||||
# Required to allow tuple fields.
|
||||
@ -363,7 +363,9 @@ class FileUpload(Base):
|
||||
on_upload_progress: Optional[Union[EventHandler, Callable]] = None
|
||||
|
||||
@staticmethod
|
||||
def on_upload_progress_args_spec(_prog: Dict[str, Union[int, float, bool]]):
|
||||
def on_upload_progress_args_spec(
|
||||
_prog: Var[Dict[str, Union[int, float, bool]]],
|
||||
) -> list[Var]:
|
||||
"""Args spec for on_upload_progress event handler.
|
||||
|
||||
Returns:
|
||||
@ -463,7 +465,7 @@ def server_side(name: str, sig: inspect.Signature, **kwargs) -> EventSpec:
|
||||
return None
|
||||
|
||||
fn.__qualname__ = name
|
||||
fn.__signature__ = sig
|
||||
fn.__signature__ = sig # pyright: ignore [reportFunctionMemberAccess]
|
||||
return EventSpec(
|
||||
handler=EventHandler(fn=fn),
|
||||
args=tuple(
|
||||
|
@ -95,8 +95,9 @@ PrimitiveType = Union[int, float, bool, str, list, dict, set, tuple]
|
||||
StateVar = Union[PrimitiveType, Base, None]
|
||||
StateIterVar = Union[list, set, tuple]
|
||||
|
||||
# ArgsSpec = Callable[[Var], list[Var]]
|
||||
ArgsSpec = Callable
|
||||
|
||||
# Type for signatures mapping JS function args to Python function args.
|
||||
ArgsSpec = Callable[..., List]
|
||||
|
||||
|
||||
PrimitiveToAnnotation = {
|
||||
|
Loading…
Reference in New Issue
Block a user