mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8 compliance
This commit is contained in:
parent
6bfcd2536a
commit
adb0859108
@ -41,7 +41,6 @@ Differences in semantics from pysqlite:
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DynamicFilter(object): # {{{
|
class DynamicFilter(object): # {{{
|
||||||
|
|
||||||
'No longer used, present for legacy compatibility'
|
'No longer used, present for legacy compatibility'
|
||||||
@ -114,9 +113,10 @@ class DBPrefs(dict): # {{{
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
def set_namespaced(self, namespace, key, val):
|
def set_namespaced(self, namespace, key, val):
|
||||||
if u':' in key: raise KeyError('Colons are not allowed in keys')
|
if u':' in key:
|
||||||
if u':' in namespace: raise KeyError('Colons are not allowed in'
|
raise KeyError('Colons are not allowed in keys')
|
||||||
' the namespace')
|
if u':' in namespace:
|
||||||
|
raise KeyError('Colons are not allowed in the namespace')
|
||||||
key = u'namespaced:%s:%s'%(namespace, key)
|
key = u'namespaced:%s:%s'%(namespace, key)
|
||||||
self[key] = val
|
self[key] = val
|
||||||
|
|
||||||
@ -170,7 +170,8 @@ def pynocase(one, two, encoding='utf-8'):
|
|||||||
return cmp(one.lower(), two.lower())
|
return cmp(one.lower(), two.lower())
|
||||||
|
|
||||||
def _author_to_author_sort(x):
|
def _author_to_author_sort(x):
|
||||||
if not x: return ''
|
if not x:
|
||||||
|
return ''
|
||||||
return author_to_author_sort(x.replace('|', ','))
|
return author_to_author_sort(x.replace('|', ','))
|
||||||
|
|
||||||
def icu_collator(s1, s2):
|
def icu_collator(s1, s2):
|
||||||
|
@ -403,16 +403,19 @@ class Cache(object):
|
|||||||
'''
|
'''
|
||||||
if as_file:
|
if as_file:
|
||||||
ret = SpooledTemporaryFile(SPOOL_SIZE)
|
ret = SpooledTemporaryFile(SPOOL_SIZE)
|
||||||
if not self.copy_cover_to(book_id, ret): return
|
if not self.copy_cover_to(book_id, ret):
|
||||||
|
return
|
||||||
ret.seek(0)
|
ret.seek(0)
|
||||||
elif as_path:
|
elif as_path:
|
||||||
pt = PersistentTemporaryFile('_dbcover.jpg')
|
pt = PersistentTemporaryFile('_dbcover.jpg')
|
||||||
with pt:
|
with pt:
|
||||||
if not self.copy_cover_to(book_id, pt): return
|
if not self.copy_cover_to(book_id, pt):
|
||||||
|
return
|
||||||
ret = pt.name
|
ret = pt.name
|
||||||
else:
|
else:
|
||||||
buf = BytesIO()
|
buf = BytesIO()
|
||||||
if not self.copy_cover_to(book_id, buf): return
|
if not self.copy_cover_to(book_id, buf):
|
||||||
|
return
|
||||||
ret = buf.getvalue()
|
ret = buf.getvalue()
|
||||||
if as_image:
|
if as_image:
|
||||||
from PyQt4.Qt import QImage
|
from PyQt4.Qt import QImage
|
||||||
|
@ -191,7 +191,7 @@ class SHLock(object): # {{{
|
|||||||
try:
|
try:
|
||||||
return self._free_waiters.pop()
|
return self._free_waiters.pop()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return Condition(self._lock)#, verbose=True)
|
return Condition(self._lock)
|
||||||
|
|
||||||
def _return_waiter(self, waiter):
|
def _return_waiter(self, waiter):
|
||||||
self._free_waiters.append(waiter)
|
self._free_waiters.append(waiter)
|
||||||
|
@ -172,7 +172,6 @@ class SchemaUpgrade(object):
|
|||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def upgrade_version_6(self):
|
def upgrade_version_6(self):
|
||||||
'Show authors in order'
|
'Show authors in order'
|
||||||
self.conn.execute('''
|
self.conn.execute('''
|
||||||
|
@ -64,7 +64,7 @@ def _match(query, value, matchkind, use_primary_find_in_search=True):
|
|||||||
else:
|
else:
|
||||||
internal_match_ok = False
|
internal_match_ok = False
|
||||||
for t in value:
|
for t in value:
|
||||||
try: ### ignore regexp exceptions, required because search-ahead tries before typing is finished
|
try: # ignore regexp exceptions, required because search-ahead tries before typing is finished
|
||||||
t = icu_lower(t)
|
t = icu_lower(t)
|
||||||
if (matchkind == EQUALS_MATCH):
|
if (matchkind == EQUALS_MATCH):
|
||||||
if internal_match_ok:
|
if internal_match_ok:
|
||||||
@ -547,7 +547,8 @@ class Parser(SearchQueryParser):
|
|||||||
field_metadata = {}
|
field_metadata = {}
|
||||||
|
|
||||||
for x, fm in self.field_metadata.iteritems():
|
for x, fm in self.field_metadata.iteritems():
|
||||||
if x.startswith('@'): continue
|
if x.startswith('@'):
|
||||||
|
continue
|
||||||
if fm['search_terms'] and x != 'series_sort':
|
if fm['search_terms'] and x != 'series_sort':
|
||||||
all_locs.add(x)
|
all_locs.add(x)
|
||||||
field_metadata[x] = fm
|
field_metadata[x] = fm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user