get it right pyright

This commit is contained in:
Khaleel Al-Adhami 2024-10-14 18:26:10 -07:00
parent 6c26854e80
commit a97ec99720

View File

@ -353,7 +353,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
@var_operation @var_operation
def string_lt_operation(lhs: StringVar | str, rhs: StringVar | str): def string_lt_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is less than another string. """Check if a string is less than another string.
Args: Args:
@ -367,7 +367,7 @@ def string_lt_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation @var_operation
def string_gt_operation(lhs: StringVar | str, rhs: StringVar | str): def string_gt_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is greater than another string. """Check if a string is greater than another string.
Args: Args:
@ -381,7 +381,7 @@ def string_gt_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation @var_operation
def string_le_operation(lhs: StringVar | str, rhs: StringVar | str): def string_le_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is less than or equal to another string. """Check if a string is less than or equal to another string.
Args: Args:
@ -395,7 +395,7 @@ def string_le_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation @var_operation
def string_ge_operation(lhs: StringVar | str, rhs: StringVar | str): def string_ge_operation(lhs: StringVar[Any] | str, rhs: StringVar[Any] | str):
"""Check if a string is greater than or equal to another string. """Check if a string is greater than or equal to another string.
Args: Args:
@ -409,7 +409,7 @@ def string_ge_operation(lhs: StringVar | str, rhs: StringVar | str):
@var_operation @var_operation
def string_lower_operation(string: StringVar): def string_lower_operation(string: StringVar[Any]):
"""Convert a string to lowercase. """Convert a string to lowercase.
Args: Args:
@ -422,7 +422,7 @@ def string_lower_operation(string: StringVar):
@var_operation @var_operation
def string_upper_operation(string: StringVar): def string_upper_operation(string: StringVar[Any]):
"""Convert a string to uppercase. """Convert a string to uppercase.
Args: Args:
@ -435,7 +435,7 @@ def string_upper_operation(string: StringVar):
@var_operation @var_operation
def string_strip_operation(string: StringVar): def string_strip_operation(string: StringVar[Any]):
"""Strip a string. """Strip a string.
Args: Args:
@ -449,7 +449,7 @@ def string_strip_operation(string: StringVar):
@var_operation @var_operation
def string_contains_field_operation( def string_contains_field_operation(
haystack: StringVar, needle: StringVar | str, field: StringVar | str haystack: StringVar[Any], needle: StringVar[Any] | str, field: StringVar[Any] | str
): ):
"""Check if a string contains another string. """Check if a string contains another string.
@ -468,7 +468,7 @@ def string_contains_field_operation(
@var_operation @var_operation
def string_contains_operation(haystack: StringVar, needle: StringVar | str): def string_contains_operation(haystack: StringVar[Any], needle: StringVar[Any] | str):
"""Check if a string contains another string. """Check if a string contains another string.
Args: Args:
@ -484,7 +484,9 @@ def string_contains_operation(haystack: StringVar, needle: StringVar | str):
@var_operation @var_operation
def string_starts_with_operation(full_string: StringVar, prefix: StringVar | str): def string_starts_with_operation(
full_string: StringVar[Any], prefix: StringVar[Any] | str
):
"""Check if a string starts with a prefix. """Check if a string starts with a prefix.
Args: Args:
@ -500,7 +502,7 @@ def string_starts_with_operation(full_string: StringVar, prefix: StringVar | str
@var_operation @var_operation
def string_item_operation(string: StringVar, index: NumberVar | int): def string_item_operation(string: StringVar[Any], index: NumberVar | int):
"""Get an item from a string. """Get an item from a string.
Args: Args:
@ -514,7 +516,7 @@ def string_item_operation(string: StringVar, index: NumberVar | int):
@var_operation @var_operation
def array_join_operation(array: ArrayVar, sep: StringVar | str = ""): def array_join_operation(array: ArrayVar, sep: StringVar[Any] | str = ""):
"""Join the elements of an array. """Join the elements of an array.
Args: Args:
@ -539,7 +541,7 @@ _decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL)
frozen=True, frozen=True,
**{"slots": True} if sys.version_info >= (3, 10) else {}, **{"slots": True} if sys.version_info >= (3, 10) else {},
) )
class LiteralStringVar(LiteralVar, StringVar): class LiteralStringVar(LiteralVar, StringVar[str]):
"""Base class for immutable literal string vars.""" """Base class for immutable literal string vars."""
_var_value: str = dataclasses.field(default="") _var_value: str = dataclasses.field(default="")
@ -661,7 +663,7 @@ class LiteralStringVar(LiteralVar, StringVar):
frozen=True, frozen=True,
**{"slots": True} if sys.version_info >= (3, 10) else {}, **{"slots": True} if sys.version_info >= (3, 10) else {},
) )
class ConcatVarOperation(CachedVarOperation, StringVar): class ConcatVarOperation(CachedVarOperation, StringVar[str]):
"""Representing a concatenation of literal string vars.""" """Representing a concatenation of literal string vars."""
_var_value: Tuple[Var, ...] = dataclasses.field(default_factory=tuple) _var_value: Tuple[Var, ...] = dataclasses.field(default_factory=tuple)
@ -1275,7 +1277,7 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
@var_operation @var_operation
def string_split_operation(string: StringVar, sep: StringVar | str = ""): def string_split_operation(string: StringVar[Any], sep: StringVar | str = ""):
"""Split a string. """Split a string.
Args: Args: