Fix some typings

This commit is contained in:
Serene-Arc 2022-12-27 12:02:19 +10:00
parent 1e9ff27f1a
commit eac46bf9dd
3 changed files with 3 additions and 6 deletions

View file

@ -169,7 +169,7 @@ class StringFieldQuery(FieldQuery):
"""
@classmethod
def value_match(cls: Type['StringFieldQuery'], pattern: str, value: Any):
def value_match(cls, pattern: str, value: Any):
"""Determine whether the value matches the pattern. The value
may have any type.
"""
@ -177,7 +177,7 @@ class StringFieldQuery(FieldQuery):
@classmethod
def string_match(
cls: Type['StringFieldQuery'],
cls,
pattern: str,
value: str,
) -> bool:

View file

@ -38,8 +38,6 @@ PARSE_QUERY_PART_REGEX = re.compile(
)
# TYPING ERROR
# not sure what the query type should be
def parse_query_part(
part: str,
query_classes: Dict = {},

View file

@ -73,7 +73,7 @@ class Type:
except ValueError:
return self.null
def normalize(self, value: model_type) -> model_type:
def normalize(self, value: Union[None, int, float, bytes]) -> model_type:
"""Given a value that will be assigned into a field of this
type, normalize the value to have the appropriate type. This
base implementation only reinterprets `None`.
@ -108,7 +108,6 @@ class Type:
if isinstance(sql_value, str):
return self.parse(sql_value)
else:
# TYPING ERROR
return self.normalize(sql_value)
def to_sql(self, model_value: Any) -> Union[None, int, float, str, bytes]: