mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
8609f177f8
commit
d61e0b5be8
@ -138,7 +138,8 @@ class Ozon(Source):
|
|||||||
for author in authors:
|
for author in authors:
|
||||||
for miauthor in miauthors:
|
for miauthor in miauthors:
|
||||||
#log.debug(u'=> %s <> %s'%(author, miauthor))
|
#log.debug(u'=> %s <> %s'%(author, miauthor))
|
||||||
if author in miauthor: return True
|
if author in miauthor:
|
||||||
|
return True
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def ensure_metadata_match(mi): # {{{
|
def ensure_metadata_match(mi): # {{{
|
||||||
@ -338,7 +339,7 @@ class Ozon(Source):
|
|||||||
metadata.pubdate = toPubdate(log, matcher.group(0))
|
metadata.pubdate = toPubdate(log, matcher.group(0))
|
||||||
|
|
||||||
# overwrite comments from HTML if any
|
# overwrite comments from HTML if any
|
||||||
xpt = u'//*[@id="detail_description"]//*[contains(text(), "От производителя")]/../node()[not(self::comment())][not(self::br)][preceding::*[contains(text(), "От производителя")]]'
|
xpt = u'//*[@id="detail_description"]//*[contains(text(), "От производителя")]/../node()[not(self::comment())][not(self::br)][preceding::*[contains(text(), "От производителя")]]' # noqa
|
||||||
from lxml.etree import ElementBase
|
from lxml.etree import ElementBase
|
||||||
comment_elem = doc.xpath(xpt)
|
comment_elem = doc.xpath(xpt)
|
||||||
if comment_elem:
|
if comment_elem:
|
||||||
@ -391,7 +392,7 @@ def _get_affiliateId(): # {{{
|
|||||||
|
|
||||||
def _format_isbn(log, isbn): # {{{
|
def _format_isbn(log, isbn): # {{{
|
||||||
# for now only RUS ISBN are supported
|
# for now only RUS ISBN are supported
|
||||||
#http://ru.wikipedia.org/wiki/ISBN_российских_издательств
|
# http://ru.wikipedia.org/wiki/ISBN_российских_издательств
|
||||||
isbn_pat = re.compile(r"""
|
isbn_pat = re.compile(r"""
|
||||||
^
|
^
|
||||||
(\d{3})? # match GS1 Prefix for ISBN13
|
(\d{3})? # match GS1 Prefix for ISBN13
|
||||||
@ -416,7 +417,6 @@ def _format_isbn(log, isbn): # {{{
|
|||||||
$
|
$
|
||||||
""", re.VERBOSE)
|
""", re.VERBOSE)
|
||||||
|
|
||||||
|
|
||||||
res = check_isbn(isbn)
|
res = check_isbn(isbn)
|
||||||
if res:
|
if res:
|
||||||
m = isbn_pat.match(res)
|
m = isbn_pat.match(res)
|
||||||
@ -429,7 +429,7 @@ def _format_isbn(log, isbn): # {{{
|
|||||||
|
|
||||||
def _translageLanguageToCode(displayLang): # {{{
|
def _translageLanguageToCode(displayLang): # {{{
|
||||||
displayLang = unicode(displayLang).strip() if displayLang else None
|
displayLang = unicode(displayLang).strip() if displayLang else None
|
||||||
langTbl = { None: 'ru',
|
langTbl = {None: 'ru',
|
||||||
u'Немецкий': 'de',
|
u'Немецкий': 'de',
|
||||||
u'Английский': 'en',
|
u'Английский': 'en',
|
||||||
u'Французский': 'fr',
|
u'Французский': 'fr',
|
||||||
@ -480,7 +480,6 @@ if __name__ == '__main__': # tests {{{
|
|||||||
from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
|
from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
|
||||||
title_test, authors_test, isbn_test)
|
title_test, authors_test, isbn_test)
|
||||||
|
|
||||||
|
|
||||||
test_identify_plugin(Ozon.name,
|
test_identify_plugin(Ozon.name,
|
||||||
[
|
[
|
||||||
# (
|
# (
|
||||||
@ -490,7 +489,7 @@ if __name__ == '__main__': # tests {{{
|
|||||||
# authors_test([u'В. П. Колесников', u'Г. В. Шатков'])]
|
# authors_test([u'В. П. Колесников', u'Г. В. Шатков'])]
|
||||||
# ),
|
# ),
|
||||||
(
|
(
|
||||||
{'identifiers':{'isbn': '9785916572629'} },
|
{'identifiers':{'isbn': '9785916572629'}},
|
||||||
[title_test(u'На все четыре стороны', exact=True),
|
[title_test(u'На все четыре стороны', exact=True),
|
||||||
authors_test([u'А. А. Гилл'])]
|
authors_test([u'А. А. Гилл'])]
|
||||||
),
|
),
|
||||||
@ -501,7 +500,7 @@ if __name__ == '__main__': # tests {{{
|
|||||||
authors_test([u'Erich Maria Remarque'])]
|
authors_test([u'Erich Maria Remarque'])]
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
{'identifiers':{ }, 'title':u'Метро 2033',
|
{'identifiers':{}, 'title':u'Метро 2033',
|
||||||
'authors':[u'Дмитрий Глуховский']},
|
'authors':[u'Дмитрий Глуховский']},
|
||||||
[title_test(u'Метро 2033', exact=False)]
|
[title_test(u'Метро 2033', exact=False)]
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user