mirror of
https://github.com/beetbox/beets.git
synced 2026-01-08 17:08:12 +01:00
Fix linter errors
This commit is contained in:
parent
3f4f559912
commit
7915d7b5a5
2 changed files with 13 additions and 3 deletions
|
|
@ -38,6 +38,9 @@ from .query import MatchQuery, NullSort, TrueQuery, AndQuery, Query, \
|
|||
FieldQuery, Sort
|
||||
from collections.abc import Mapping
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
if TYPE_CHECKING:
|
||||
from beets.library import LibModel
|
||||
from ..util.functemplate import Template
|
||||
|
||||
|
||||
|
|
@ -1193,7 +1196,7 @@ class Database:
|
|||
sort if sort.is_slow() else None, # Slow sort component.
|
||||
)
|
||||
|
||||
def _get(self, model_cls: Union[Type[Model], Type['LibModel']], id) -> Model:
|
||||
def _get(self, model_cls: Union[Type[Model], Type[LibModel]], id) -> Model:
|
||||
"""Get a Model object by its id or None if the id does not
|
||||
exist.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
"""The Query type hierarchy for DBCore.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
import re
|
||||
from operator import mul
|
||||
from typing import Union, Tuple, List, Optional, Pattern, Any, Type, Iterator,\
|
||||
|
|
@ -25,6 +26,12 @@ from datetime import datetime, timedelta
|
|||
import unicodedata
|
||||
from functools import reduce
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from beets.library import Item
|
||||
from beets.dbcore import Model
|
||||
|
||||
|
||||
class ParsingError(ValueError):
|
||||
|
|
@ -73,7 +80,7 @@ class Query:
|
|||
"""
|
||||
return None, ()
|
||||
|
||||
def match(self, item: 'Item'):
|
||||
def match(self, item: Item):
|
||||
"""Check whether this query matches a given Item. Can be used to
|
||||
perform queries on arbitrary sets of Items.
|
||||
"""
|
||||
|
|
@ -119,7 +126,7 @@ class FieldQuery(Query):
|
|||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def match(self, item: 'Model'):
|
||||
def match(self, item: Model):
|
||||
return self.value_match(self.pattern, item.get(self.field))
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
|
|
|||
Loading…
Reference in a new issue