removed codespell ignores and pyright type checking ignores

This commit is contained in:
slackroo 2025-02-19 14:45:49 +05:30
parent 6ea91e542d
commit 70da032c27
6 changed files with 10 additions and 12 deletions

View File

@ -35,11 +35,11 @@ def validate_field_name(bases: List[Type["BaseModel"]], field_name: str) -> None
for base in bases:
if not reload and getattr(base, field_name, None):
pass
except TypeError as te: # codespell:ignore te
except TypeError as e:
raise VarNameError(
f'State var "{field_name}" in {base} has been shadowed by a substate var; '
f'use a different field name instead".'
) from te # codespell:ignore te
) from e
# monkeypatch pydantic validate_field_name method to skip validating

View File

@ -180,7 +180,7 @@ def save_error(error: Exception) -> str:
timestamp = datetime.now().strftime("%Y-%m-%d__%H-%M-%S")
constants.Reflex.LOGS_DIR.mkdir(parents=True, exist_ok=True)
log_path = constants.Reflex.LOGS_DIR / f"error_{timestamp}.log"
traceback.TracebackException.from_exception(error).print(file=log_path.open("w+")) # type: ignore[attr-defined]
traceback.TracebackException.from_exception(error).print(file=log_path.open("w+"))
return str(log_path)

View File

@ -1299,10 +1299,10 @@ def call_event_handler(
compare_result = typehint_issubclass(
args_types_without_vars[i], type_hints_of_provided_callback[arg]
)
except TypeError as te: # codespell:ignore te
except TypeError as e:
raise TypeError(
f"Could not compare types {args_types_without_vars[i]} and {type_hints_of_provided_callback[arg]} for argument {arg} of {event_callback.fn.__qualname__} provided for {key}."
) from te # codespell:ignore te
) from e
if compare_result:
type_match_found[arg] = True

View File

@ -12,7 +12,7 @@ from contextlib import suppress
from reflex.config import environment
try:
from datetime import UTC, datetime # type: ignore[attr-defined]
from datetime import UTC, datetime
except ImportError:
from datetime import datetime

View File

@ -516,12 +516,10 @@ def _issubclass(cls: GenericType, cls_check: GenericType, instance: Any = None)
# Check if the types match.
try:
return cls_check_base == Any or issubclass(cls_base, cls_check_base)
except TypeError as te: # codespell:ignore te
except TypeError as e:
# These errors typically arise from bad annotations and are hard to
# debug without knowing the type that we tried to compare.
raise TypeError(
f"Invalid type for issubclass: {cls_base}"
) from te # codespell:ignore te
raise TypeError(f"Invalid type for issubclass: {cls_base}") from e
def does_obj_satisfy_typed_dict(obj: Any, cls: GenericType) -> bool:

View File

@ -239,8 +239,8 @@ class DependencyTracker:
"""
# Get the original source code and eval it to get the Var.
module = inspect.getmodule(self.func)
positions0 = self._getting_var_instructions[0].positions # type: ignore[attr-defined]
positions1 = self._getting_var_instructions[-1].positions # type: ignore[attr-defined]
positions0 = self._getting_var_instructions[0].positions
positions1 = self._getting_var_instructions[-1].positions
if module is None or positions0 is None or positions1 is None:
raise VarValueError(
f"Cannot determine the source code for the var in {self.func!r}."