Skip to content

Commit 2144882

Browse files
committed
Correct some PEP8 post-docstring whitespace
To better match #2597 for a cleaner diff.
1 parent 009c6a4 commit 2144882

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

beets/dbcore/query.py

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class InvalidQueryError(ParsingError):
4040
4141
The query should be a unicode string or a list, which will be space-joined.
4242
"""
43+
4344
def __init__(self, query, explanation):
4445
if isinstance(query, list):
4546
query = " ".join(query)
@@ -53,6 +54,7 @@ class InvalidQueryArgumentValueError(ParsingError):
5354
It exists to be caught in upper stack levels so a meaningful (i.e. with the
5455
query) InvalidQueryError can be raised.
5556
"""
57+
5658
def __init__(self, what, expected, detail=None):
5759
message = u"'{0}' is not {1}".format(what, expected)
5860
if detail:
@@ -63,6 +65,7 @@ def __init__(self, what, expected, detail=None):
6365
class Query(object):
6466
"""An abstract class representing a query into the item database.
6567
"""
68+
6669
def clause(self):
6770
"""Generate an SQLite expression implementing the query.
6871
@@ -95,6 +98,7 @@ class FieldQuery(Query):
9598
string. Subclasses may also provide `col_clause` to implement the
9699
same matching functionality in SQLite.
97100
"""
101+
98102
def __init__(self, field, pattern, fast=True):
99103
self.field = field
100104
self.pattern = pattern
@@ -134,6 +138,7 @@ def __hash__(self):
134138

135139
class MatchQuery(FieldQuery):
136140
"""A query that looks for exact matches in an item field."""
141+
137142
def col_clause(self):
138143
return self.field + " = ?", [self.pattern]
139144

@@ -143,6 +148,7 @@ def value_match(cls, pattern, value):
143148

144149

145150
class NoneQuery(FieldQuery):
151+
"""A query that checks whether a field is null."""
146152

147153
def __init__(self, field, fast=True):
148154
super(NoneQuery, self).__init__(field, None, fast)
@@ -165,6 +171,7 @@ class StringFieldQuery(FieldQuery):
165171
"""A FieldQuery that converts values to strings before matching
166172
them.
167173
"""
174+
168175
@classmethod
169176
def value_match(cls, pattern, value):
170177
"""Determine whether the value matches the pattern. The value
@@ -182,11 +189,12 @@ def string_match(cls, pattern, value):
182189

183190
class SubstringQuery(StringFieldQuery):
184191
"""A query that matches a substring in a specific item field."""
192+
185193
def col_clause(self):
186194
pattern = (self.pattern
187-
.replace('\\', '\\\\')
188-
.replace('%', '\\%')
189-
.replace('_', '\\_'))
195+
.replace('\\', '\\\\')
196+
.replace('%', '\\%')
197+
.replace('_', '\\_'))
190198
search = '%' + pattern + '%'
191199
clause = self.field + " like ? escape '\\'"
192200
subvals = [search]
@@ -204,6 +212,7 @@ class RegexpQuery(StringFieldQuery):
204212
Raises InvalidQueryError when the pattern is not a valid regular
205213
expression.
206214
"""
215+
207216
def __init__(self, field, pattern, fast=True):
208217
super(RegexpQuery, self).__init__(field, pattern, fast)
209218
pattern = self._normalize(pattern)
@@ -231,6 +240,7 @@ class BooleanQuery(MatchQuery):
231240
"""Matches a boolean field. Pattern should either be a boolean or a
232241
string reflecting a boolean.
233242
"""
243+
234244
def __init__(self, field, pattern, fast=True):
235245
super(BooleanQuery, self).__init__(field, pattern, fast)
236246
if isinstance(pattern, six.string_types):
@@ -244,6 +254,7 @@ class BytesQuery(MatchQuery):
244254
`unicode` equivalently in Python 2. Always use this query instead of
245255
`MatchQuery` when matching on BLOB values.
246256
"""
257+
247258
def __init__(self, field, pattern):
248259
super(BytesQuery, self).__init__(field, pattern)
249260

@@ -270,6 +281,7 @@ class NumericQuery(FieldQuery):
270281
Raises InvalidQueryError when the pattern does not represent an int or
271282
a float.
272283
"""
284+
273285
def _convert(self, s):
274286
"""Convert a string to a numeric type (float or int).
275287
@@ -337,6 +349,7 @@ class CollectionQuery(Query):
337349
"""An abstract query class that aggregates other queries. Can be
338350
indexed like a list to access the sub-queries.
339351
"""
352+
340353
def __init__(self, subqueries=()):
341354
self.subqueries = subqueries
342355

@@ -389,6 +402,7 @@ class AnyFieldQuery(CollectionQuery):
389402
any field. The individual field query class is provided to the
390403
constructor.
391404
"""
405+
392406
def __init__(self, pattern, fields, cls):
393407
self.pattern = pattern
394408
self.fields = fields
@@ -424,6 +438,7 @@ class MutableCollectionQuery(CollectionQuery):
424438
"""A collection query whose subqueries may be modified after the
425439
query is initialized.
426440
"""
441+
427442
def __setitem__(self, key, value):
428443
self.subqueries[key] = value
429444

@@ -433,6 +448,7 @@ def __delitem__(self, key):
433448

434449
class AndQuery(MutableCollectionQuery):
435450
"""A conjunction of a list of other queries."""
451+
436452
def clause(self):
437453
return self.clause_with_joiner('and')
438454

@@ -442,6 +458,7 @@ def match(self, item):
442458

443459
class OrQuery(MutableCollectionQuery):
444460
"""A conjunction of a list of other queries."""
461+
445462
def clause(self):
446463
return self.clause_with_joiner('or')
447464

@@ -453,6 +470,7 @@ class NotQuery(Query):
453470
"""A query that matches the negation of its `subquery`, as a shorcut for
454471
performing `not(subquery)` without using regular expressions.
455472
"""
473+
456474
def __init__(self, subquery):
457475
self.subquery = subquery
458476

@@ -481,6 +499,7 @@ def __hash__(self):
481499

482500
class TrueQuery(Query):
483501
"""A query that always matches."""
502+
484503
def clause(self):
485504
return '1', ()
486505

@@ -490,6 +509,7 @@ def match(self, item):
490509

491510
class FalseQuery(Query):
492511
"""A query that never matches."""
512+
493513
def clause(self):
494514
return '0', ()
495515

0 commit comments

Comments
 (0)