From 4dc3d44cea7677ff196dbb4f10c8d938c5324595 Mon Sep 17 00:00:00 2001 From: Khaleel Al-Adhami Date: Wed, 29 Jan 2025 16:38:10 -0800 Subject: [PATCH] dang it darglint --- reflex/vars/base.py | 13 +++++++++---- reflex/vars/sequence.py | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/reflex/vars/base.py b/reflex/vars/base.py index 0c81a4759..b9055c860 100644 --- a/reflex/vars/base.py +++ b/reflex/vars/base.py @@ -1199,15 +1199,14 @@ class Var(Generic[VAR_TYPE]): Args: name: The name of the attribute. - Returns: - The attribute. - Raises: VarAttributeError: If the attribute does not exist. TypeError: If the var type is Any. + + # noqa: DAR101 self """ if name.startswith("_"): - raise AttributeError(f"Attribute {name} not found.") + raise VarAttributeError(f"Attribute {name} not found.") if name == "contains": raise TypeError( @@ -1230,6 +1229,8 @@ class Var(Generic[VAR_TYPE]): Raises: VarTypeError: when attempting to bool-ify the Var. + + # noqa: DAR101 self """ raise VarTypeError( f"Cannot convert Var {str(self)!r} to bool for use with `if`, `and`, `or`, and `not`. " @@ -1241,6 +1242,8 @@ class Var(Generic[VAR_TYPE]): Raises: VarTypeError: when attempting to iterate over the Var. + + # noqa: DAR101 self """ raise VarTypeError( f"Cannot iterate over Var {str(self)!r}. Instead use `rx.foreach`." @@ -1251,6 +1254,8 @@ class Var(Generic[VAR_TYPE]): Raises: VarTypeError: the operation is not supported + + # noqa: DAR101 self """ raise VarTypeError( "'in' operator not supported for Var types, use Var.contains() instead." diff --git a/reflex/vars/sequence.py b/reflex/vars/sequence.py index b0e96aff9..e2e604b22 100644 --- a/reflex/vars/sequence.py +++ b/reflex/vars/sequence.py @@ -1289,6 +1289,9 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]): Returns: The JSON representation of the var. + + Raises: + TypeError: If the array elements are not of type LiteralVar. """ elements = [] for element in self._var_value: