mirror of
https://github.com/beetbox/beets.git
synced 2026-01-30 20:13:37 +01:00
resolve FIXMEs from query refactor
This commit is contained in:
parent
d44f9f7052
commit
69905dde9b
2 changed files with 12 additions and 10 deletions
|
|
@ -166,14 +166,17 @@ class NumericQuery(FieldQuery):
|
|||
``year:2001..`` finds music released since the turn of the century.
|
||||
"""
|
||||
def _convert(self, s):
|
||||
"""Convert a string to the appropriate numeric type. If the
|
||||
"""Convert a string to a numeric type (float or int). If the
|
||||
string cannot be converted, return None.
|
||||
"""
|
||||
# This is really just a bit of fun premature optimization.
|
||||
try:
|
||||
# FIXME should work w/ either integer or float
|
||||
return float(s)
|
||||
return int(s)
|
||||
except ValueError:
|
||||
return None
|
||||
try:
|
||||
return float(s)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
def __init__(self, field, pattern, fast=True):
|
||||
super(NumericQuery, self).__init__(field, pattern, fast)
|
||||
|
|
|
|||
|
|
@ -239,7 +239,6 @@ class LibModel(dbcore.Model):
|
|||
"""Shared concrete functionality for Items and Albums.
|
||||
"""
|
||||
_bytes_keys = ('path', 'artpath')
|
||||
# FIXME should be able to replace this with field types.
|
||||
|
||||
def _template_funcs(self):
|
||||
funcs = DefaultTemplateFunctions(self, self._db).functions()
|
||||
|
|
@ -771,12 +770,12 @@ def parse_query_part(part, query_classes={}, prefixes={},
|
|||
class is available, `default_class` is used.
|
||||
|
||||
For instance,
|
||||
parse_query('stapler') == (None, 'stapler', SubstringQuery)
|
||||
parse_query('color:red') == ('color', 'red', SubstringQuery)
|
||||
parse_query(':^Quiet') == (None, '^Quiet', RegexpQuery)
|
||||
parse_query('color::b..e') == ('color', 'b..e', RegexpQuery)
|
||||
'stapler' -> (None, 'stapler', SubstringQuery)
|
||||
'color:red' -> ('color', 'red', SubstringQuery)
|
||||
':^Quiet' -> (None, '^Quiet', RegexpQuery)
|
||||
'color::b..e' -> ('color', 'b..e', RegexpQuery)
|
||||
|
||||
Prefixes may be 'escaped' with a backslash to disable the keying
|
||||
Prefixes may be "escaped" with a backslash to disable the keying
|
||||
behavior.
|
||||
"""
|
||||
part = part.strip()
|
||||
|
|
|
|||
Loading…
Reference in a new issue