diff --git a/beets/dbcore/query.py b/beets/dbcore/query.py index 1b2310a90..5e887afb2 100644 --- a/beets/dbcore/query.py +++ b/beets/dbcore/query.py @@ -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: diff --git a/beets/dbcore/queryparse.py b/beets/dbcore/queryparse.py index 8834488d5..39c05aef0 100644 --- a/beets/dbcore/queryparse.py +++ b/beets/dbcore/queryparse.py @@ -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 = {}, diff --git a/beets/dbcore/types.py b/beets/dbcore/types.py index 2ae2ab403..ac8dd762b 100644 --- a/beets/dbcore/types.py +++ b/beets/dbcore/types.py @@ -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]: