mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
various whitespace (auto-fix)
ruff 'E201,E202,E211,E251,E275'
This commit is contained in:
parent
fb0a290127
commit
41cee6f02d
@ -43,7 +43,7 @@ class AdvancedUserRecipe1294946868(BasicNewsRecipe):
|
||||
remove_tags_after = dict(name='div', attrs={'class': ['related-news', 'col']})
|
||||
|
||||
remove_tags = [
|
||||
dict(name='ol', attrs={'class': ['navigation', ]}), dict(name='span', attrs={'class': ['action']}), dict(name='div', attrs={'class': ['twitter comments-list hidden', 'related-news', 'col', 'photo-gallery', 'photo-gallery side-art-block', 'calendario', 'article-comment', 'postto estirar', 'otras_vinetas estirar', 'kment', 'user-actions']}), dict( name='div', attrs={'id': ['twitter-destacados', 'eco-tabs', 'inner', 'vineta_calendario', 'vinetistas clearfix', 'otras_vinetas estirar', 'MIN1', 'main', 'SUP1', 'INT']}), dict(name='ul', attrs={'class': ['article-user-actions', 'stripped-list']}), dict(name='ul', attrs={'id': ['site-links']}), dict(name='li', attrs={'class': ['puntuacion', 'enviar', 'compartir']}) # noqa: E501
|
||||
dict(name='ol', attrs={'class': ['navigation', ]}), dict(name='span', attrs={'class': ['action']}), dict(name='div', attrs={'class': ['twitter comments-list hidden', 'related-news', 'col', 'photo-gallery', 'photo-gallery side-art-block', 'calendario', 'article-comment', 'postto estirar', 'otras_vinetas estirar', 'kment', 'user-actions']}), dict(name='div', attrs={'id': ['twitter-destacados', 'eco-tabs', 'inner', 'vineta_calendario', 'vinetistas clearfix', 'otras_vinetas estirar', 'MIN1', 'main', 'SUP1', 'INT']}), dict(name='ul', attrs={'class': ['article-user-actions', 'stripped-list']}), dict(name='ul', attrs={'id': ['site-links']}), dict(name='li', attrs={'class': ['puntuacion', 'enviar', 'compartir']}) # noqa: E501
|
||||
]
|
||||
|
||||
extra_css = '''
|
||||
|
@ -39,7 +39,7 @@ class afr(BasicNewsRecipe):
|
||||
dict(name=['button', 'aside', 'svg']),
|
||||
]
|
||||
|
||||
remove_tags_after= [ dict(name='aside', attrs={'id':'stickyContainer'})]
|
||||
remove_tags_after= [dict(name='aside', attrs={'id':'stickyContainer'})]
|
||||
|
||||
extra_css = '''
|
||||
#img-cap {font-size:small; text-align:center;}
|
||||
|
@ -26,7 +26,7 @@ class bar(BasicNewsRecipe):
|
||||
prefixed_classes(
|
||||
'text-story-m_story-tags__ story-footer-module__metype__'
|
||||
),
|
||||
dict(name = 'svg')
|
||||
dict(name='svg')
|
||||
]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
|
@ -23,7 +23,7 @@ class BenchmarkPl(BasicNewsRecipe):
|
||||
keep_only_tags = [dict(id=['articleHeader', 'articleGallery']), dict(
|
||||
name='div', attrs={'class': ['m_zwykly', 'gallery']}), dict(id='article')]
|
||||
remove_tags_after = dict(id='article')
|
||||
remove_tags = [dict(name='div', attrs={'class': ['comments', 'body', 'kategoria', 'socialize', 'thumb', 'panelOcenaObserwowane', 'categoryNextToSocializeGallery', 'breadcrumb', 'footer', 'moreTopics']}), dict(name='table', attrs={ 'background': 'http://www.benchmark.pl/uploads/backend_img/a/fotki_newsy/opinie_dnia/bg.png'}), dict(name='table', attrs={'width': '210', 'cellspacing': '1', 'cellpadding': '4', 'border': '0', 'align': 'right'})] # noqa: E501
|
||||
remove_tags = [dict(name='div', attrs={'class': ['comments', 'body', 'kategoria', 'socialize', 'thumb', 'panelOcenaObserwowane', 'categoryNextToSocializeGallery', 'breadcrumb', 'footer', 'moreTopics']}), dict(name='table', attrs={'background': 'http://www.benchmark.pl/uploads/backend_img/a/fotki_newsy/opinie_dnia/bg.png'}), dict(name='table', attrs={'width': '210', 'cellspacing': '1', 'cellpadding': '4', 'border': '0', 'align': 'right'})] # noqa: E501
|
||||
|
||||
INDEX = 'http://www.benchmark.pl'
|
||||
feeds = [(u'Aktualności', u'http://www.benchmark.pl/rss/aktualnosci-pliki.xml'),
|
||||
|
@ -214,7 +214,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
divtags = soup.findAll('div', attrs={'id': ''})
|
||||
if divtags:
|
||||
for div in divtags:
|
||||
del(div['id'])
|
||||
del (div['id'])
|
||||
|
||||
pgall = soup.find('div', attrs={'id': 'storyphoto'})
|
||||
if pgall is not None: # photo gallery perhaps
|
||||
|
@ -21,7 +21,7 @@ class AdvancedUserRecipe1311450855(BasicNewsRecipe):
|
||||
|
||||
feeds = [(u'DI', u'https://di.se/rss')]
|
||||
|
||||
keep_only_tags = [dict(name='h1', attrs={'id': 'ctl00_ExtraWideContentRegion_WideContentRegion_MainRegion_MainContentRegion_MainBodyRegion_headlineNormal'}), dict( name='div', attrs={'id': 'articleBody'})] # noqa: E501
|
||||
keep_only_tags = [dict(name='h1', attrs={'id': 'ctl00_ExtraWideContentRegion_WideContentRegion_MainRegion_MainContentRegion_MainBodyRegion_headlineNormal'}), dict(name='div', attrs={'id': 'articleBody'})] # noqa: E501
|
||||
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class': 'article-actions clear'}), dict(name='div', attrs={'class': 'article-action-popup'}), dict(name='div', attrs={'class': 'header'}), dict(name='div', attrs={'class': 'content clear'}), dict(name='div', attrs={'id': 'articleAdvertisementDiv'}), dict(name='ul', attrs={'class': 'action-list'}) # noqa: E501
|
||||
|
@ -20,7 +20,7 @@ class DiarioSport(BasicNewsRecipe):
|
||||
keep_only_tags = [dict(name='div', attrs={'id': ['noticiasMedio']})]
|
||||
|
||||
remove_tags = [
|
||||
dict(name=['object', 'link', 'script', 'ul']), dict(name='div', attrs={'id': ['scrAdSense', 'herramientas2', 'participacion', 'participacion2', 'bloque1resultados', 'bloque2resultados', 'cont_vinyetesAnt', 'tinta', 'noticiasSuperior', 'cintillopublicidad2']}), dict( name='p', attrs={'class': ['masinformacion', 'hora']}), dict(name='a', attrs={'class': ["'link'"]}), dict(name='div', attrs={'class': ['addthis_toolbox addthis_default_style', 'firma', 'pretitularnoticia']}), dict(name='form', attrs={'id': ['formularioDeBusquedaAvanzada']}) # noqa: E501
|
||||
dict(name=['object', 'link', 'script', 'ul']), dict(name='div', attrs={'id': ['scrAdSense', 'herramientas2', 'participacion', 'participacion2', 'bloque1resultados', 'bloque2resultados', 'cont_vinyetesAnt', 'tinta', 'noticiasSuperior', 'cintillopublicidad2']}), dict(name='p', attrs={'class': ['masinformacion', 'hora']}), dict(name='a', attrs={'class': ["'link'"]}), dict(name='div', attrs={'class': ['addthis_toolbox addthis_default_style', 'firma', 'pretitularnoticia']}), dict(name='form', attrs={'id': ['formularioDeBusquedaAvanzada']}) # noqa: E501
|
||||
]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
|
@ -12,8 +12,8 @@ class Volkskrant(BasicNewsRecipe):
|
||||
country = 'RO'
|
||||
category = 'politics, culture, Romania'
|
||||
resolve_internal_links = True
|
||||
remove_tags_before = { 'class': 'post' }
|
||||
remove_tags_after = { 'class': 'post_content' }
|
||||
remove_tags_before = {'class': 'post'}
|
||||
remove_tags_after = {'class': 'post_content'}
|
||||
remove_tags = [
|
||||
dict(
|
||||
attrs={
|
||||
|
@ -59,7 +59,7 @@ class DnevnikCro(BasicNewsRecipe):
|
||||
soup.html['lang'] = self.lang
|
||||
soup.html['dir'] = self.direction
|
||||
|
||||
attribs = ['style', 'font', 'valign', 'colspan', 'width', 'height', 'rowspan', 'summary', 'align', 'cellspacing', 'cellpadding', 'frames', 'rules', 'border' ] # noqa: E501
|
||||
attribs = ['style', 'font', 'valign', 'colspan', 'width', 'height', 'rowspan', 'summary', 'align', 'cellspacing', 'cellpadding', 'frames', 'rules', 'border'] # noqa: E501
|
||||
for item in soup.body.findAll(name=['table', 'td', 'tr', 'th', 'caption', 'thead', 'tfoot', 'tbody', 'colgroup', 'col']):
|
||||
item.name = 'div'
|
||||
for attrib in attribs:
|
||||
|
@ -214,7 +214,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
divtags = soup.findAll('div', attrs={'id': ''})
|
||||
if divtags:
|
||||
for div in divtags:
|
||||
del(div['id'])
|
||||
del (div['id'])
|
||||
|
||||
pgall = soup.find('div', attrs={'id': 'storyphoto'})
|
||||
if pgall is not None: # photo gallery perhaps
|
||||
|
@ -58,7 +58,7 @@ class elcorreo(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name = ['svg', 'section', 'nav']),
|
||||
dict(name=['svg', 'section', 'nav']),
|
||||
dict(attrs={'data-voc-component':['dropdown', 'modal', 'slider-grab']}),
|
||||
classes(
|
||||
'v-mdl-ath__img-c v-adv v-i-b v-mdl-ath__c--2 v-d-cmp-adv v-d-cmp-nws '
|
||||
|
@ -33,7 +33,7 @@ class AdvancedUserRecipe1294946868(BasicNewsRecipe):
|
||||
|
||||
remove_tags = [
|
||||
dict(name='ul', attrs={'id': ['entidadesNoticia', 'MenuSecciones']}), dict(name='div', attrs={'id': ['ImprimirEnviarNoticia', 'PublicidadSuperior', 'CabeceraDerecha', 'Comentarios', 'comentarios full fbConnectAPI', 'ComentarEstaNoticia', 'ctl00_Superior_Main_MasEnChance_cajamasnoticias', 'gl_chn', 'videos_portada_derecha', 'galeria_portada_central', 'galeria_portada_central_boxes']}), dict( # noqa: E501
|
||||
name='div', attrs={'class': ['infoRelacionada', 'col_1', 'buscador', 'caja doblecolumna strong', 'CHANCE_EP_Encuesta_frontal text', 'seccionportada col_0', 'seccion header', 'text', 'pie caption_over']}), dict(name='a', attrs={'class': ['buscadorLabel']}), dict(name='span', attrs={'class': ['editado']}), dict(name='table'), dict(name='li') ] # noqa: E501
|
||||
name='div', attrs={'class': ['infoRelacionada', 'col_1', 'buscador', 'caja doblecolumna strong', 'CHANCE_EP_Encuesta_frontal text', 'seccionportada col_0', 'seccion header', 'text', 'pie caption_over']}), dict(name='a', attrs={'class': ['buscadorLabel']}), dict(name='span', attrs={'class': ['editado']}), dict(name='table'), dict(name='li')] # noqa: E501
|
||||
|
||||
feeds = [
|
||||
|
||||
|
@ -23,12 +23,12 @@ def format_tickaroo_liveblog(soup):
|
||||
ntag = soup.new_tag('br')
|
||||
tag.insert_before(ntag)
|
||||
|
||||
for tag in soup.findAll(class_ = 'tik4-author__wrapper'):
|
||||
ntag = tag.find(class_ = 'tik4-author__name')
|
||||
for tag in soup.findAll(class_='tik4-author__wrapper'):
|
||||
ntag = tag.find(class_='tik4-author__name')
|
||||
if ntag:
|
||||
temp = ntag.extract()
|
||||
temp['class'] = 'tik4-media-body__title'
|
||||
ntag = tag.find(class_ = 'tik4-author__thumb')
|
||||
ntag = tag.find(class_='tik4-author__thumb')
|
||||
if ntag and temp:
|
||||
ntag.insert_after(temp)
|
||||
|
||||
@ -131,8 +131,8 @@ class FazNet(BasicNewsRecipe):
|
||||
keep_only_tags = [dict(name='article', attrs={'class':['article','storytelling']}),
|
||||
dict(name='body'),
|
||||
dict(name='div', attrs={'class':['imageGallery','image_only']}),
|
||||
dict(name = 'div', attrs ={'class':'tik4-live__container'}),
|
||||
dict(name = 'script', attrs = {'id':'__NUXT_DATA__'}),
|
||||
dict(name='div', attrs={'class':'tik4-live__container'}),
|
||||
dict(name='script', attrs={'id':'__NUXT_DATA__'}),
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
@ -143,7 +143,7 @@ class FazNet(BasicNewsRecipe):
|
||||
'tik4-by','header-detail__image','mm-adbox','upper-toolbar content-container'
|
||||
]}),
|
||||
# dict(name ='script'),
|
||||
dict(name = 'style'),
|
||||
dict(name='style'),
|
||||
dict(name='svg'),
|
||||
dict(name='div', attrs={'data-module':'teaser'}),
|
||||
|
||||
@ -224,14 +224,14 @@ class FazNet(BasicNewsRecipe):
|
||||
tag.unwrap()
|
||||
|
||||
# remove ":""
|
||||
tag = soup.find(class_ ='header-label__content')
|
||||
tag = soup.find(class_='header-label__content')
|
||||
if tag:
|
||||
colon=tag.find(class_ ='sr-only')
|
||||
colon=tag.find(class_='sr-only')
|
||||
if colon:
|
||||
colon.extract()
|
||||
|
||||
# Skip articles behind paywall
|
||||
if soup.find(id = 'faz-paywall'):
|
||||
if soup.find(id='faz-paywall'):
|
||||
self.abort_article('Skipping paywalled article')
|
||||
|
||||
# Remove F.A.Z. ad
|
||||
|
@ -76,7 +76,7 @@ class FreeInquiry(BasicNewsRecipe):
|
||||
url = ''
|
||||
seen.add(url)
|
||||
self.log('Found article:', art_title)
|
||||
yield{
|
||||
yield {
|
||||
'title': art_title,
|
||||
'url': url,
|
||||
'description': desc
|
||||
|
@ -13,13 +13,13 @@ class GithubBlog(BasicNewsRecipe):
|
||||
oldest_article = 14
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name='div', attrs={'class': 'col-12 offset-lg-1 col-lg-10 col-xl-7 mt-5 mt-lg-10 mb-6 mb-lg-8' }),
|
||||
dict(name='section', attrs={'class': lambda x: x and 'post__content' in x.split(' ') })
|
||||
dict(name='div', attrs={'class': 'col-12 offset-lg-1 col-lg-10 col-xl-7 mt-5 mt-lg-10 mb-6 mb-lg-8'}),
|
||||
dict(name='section', attrs={'class': lambda x: x and 'post__content' in x.split(' ')})
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name='div', attrs={'class': lambda x: x and 'post-tags' in x.split(' ') }),
|
||||
dict(name='ul', attrs={'class': lambda x: x and 'post-hero__categories' in x.split(' ') })
|
||||
dict(name='div', attrs={'class': lambda x: x and 'post-tags' in x.split(' ')}),
|
||||
dict(name='ul', attrs={'class': lambda x: x and 'post-hero__categories' in x.split(' ')})
|
||||
]
|
||||
|
||||
preprocess_regexps = [
|
||||
|
@ -45,7 +45,7 @@ class infzm(BasicNewsRecipe):
|
||||
# if article is paywalled, add code to figure out machine_id
|
||||
raw = br.open(res_link).read()
|
||||
html = json_to_html(raw, link)
|
||||
return ({ 'data': html, 'url': link })
|
||||
return ({'data': html, 'url': link})
|
||||
|
||||
extra_css = '''
|
||||
img {display:block; margin:0 auto;}
|
||||
|
@ -14,7 +14,7 @@ from datetime import date, timedelta
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
dates = [ date.today().strftime('%Y/%m/%d'), (date.today() - timedelta(1)).strftime('%Y/%m/%d') ]
|
||||
dates = [date.today().strftime('%Y/%m/%d'), (date.today() - timedelta(1)).strftime('%Y/%m/%d')]
|
||||
|
||||
# ----------- CUSTOMIZATION OPTIONS START -----------
|
||||
|
||||
|
@ -34,7 +34,7 @@ class IlManifesto(BasicNewsRecipe):
|
||||
startSoup = self.index_to_soup(startUrl)
|
||||
lastEdition = startSoup.findAll('div', id='accordion_inedicola')[
|
||||
1].find('a')['href']
|
||||
del(startSoup)
|
||||
del (startSoup)
|
||||
self.manifesto_index = MANIFESTO_BASEURL + lastEdition
|
||||
urlsplit = lastEdition.split('/')
|
||||
self.manifesto_datestr = urlsplit[-1]
|
||||
@ -106,5 +106,5 @@ class IlManifesto(BasicNewsRecipe):
|
||||
summary = sommNode
|
||||
|
||||
template = "<html><head><title>%(title)s</title></head><body><h1>%(title)s</h1><h2>%(subtitle)s</h2><h3>%(author)s</h3><div style='font-size: x-large;'>%(summary)s</div><div>%(content)s</div></body></html>" # noqa: E501
|
||||
del(bs)
|
||||
del (bs)
|
||||
return template % dict(title=title, subtitle=subtitle, author=author, summary=summary, content=content)
|
||||
|
@ -12,8 +12,8 @@ class Volkskrant(BasicNewsRecipe):
|
||||
country = 'IT'
|
||||
category = 'news, politics, Italy, world'
|
||||
resolve_internal_links = True
|
||||
remove_tags_before = { 'name': 'article' }
|
||||
remove_tags_after = { 'name': 'article' }
|
||||
remove_tags_before = {'name': 'article'}
|
||||
remove_tags_after = {'name': 'article'}
|
||||
remove_tags = [
|
||||
dict(
|
||||
attrs={
|
||||
@ -67,8 +67,8 @@ class Volkskrant(BasicNewsRecipe):
|
||||
|
||||
def parse_index(self):
|
||||
soup = self.index_to_soup(self.current_number_url)
|
||||
self.cover_url = soup.find('span', { 'class': 'img_expand' })['data-src']
|
||||
main_container = soup.find('div', { 'class': 'content_data' })
|
||||
self.cover_url = soup.find('span', {'class': 'img_expand'})['data-src']
|
||||
main_container = soup.find('div', {'class': 'content_data'})
|
||||
children = main_container.findAll('div', recursive=False)
|
||||
sections = []
|
||||
current_section = None
|
||||
|
@ -150,7 +150,7 @@ class Liberation(BasicNewsRecipe):
|
||||
}
|
||||
api = 'https://arc.api.liberation.fr/content/v4/?' + urlencode(query, safe='()!', quote_via=quote)
|
||||
rq = Request(
|
||||
url= api,
|
||||
url=api,
|
||||
headers=headers
|
||||
)
|
||||
raw = br.open(rq).read()
|
||||
|
@ -214,7 +214,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
divtags = soup.findAll('div', attrs={'id': ''})
|
||||
if divtags:
|
||||
for div in divtags:
|
||||
del(div['id'])
|
||||
del (div['id'])
|
||||
|
||||
pgall = soup.find('div', attrs={'id': 'storyphoto'})
|
||||
if pgall is not None: # photo gallery perhaps
|
||||
|
@ -214,7 +214,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
divtags = soup.findAll('div', attrs={'id': ''})
|
||||
if divtags:
|
||||
for div in divtags:
|
||||
del(div['id'])
|
||||
del (div['id'])
|
||||
|
||||
pgall = soup.find('div', attrs={'id': 'storyphoto'})
|
||||
if pgall is not None: # photo gallery perhaps
|
||||
|
@ -50,7 +50,7 @@ class Parool(BasicNewsRecipe):
|
||||
teaser_label = self.tag_to_string(header.find('h4').find('span', attrs={'class': 'teaser__label'})).strip()
|
||||
teaser_sublabel = self.tag_to_string(header.find('h4').find('span', attrs={'class': 'teaser__sublabel'})).strip()
|
||||
teaser_title = self.tag_to_string(header.find('h3').find('span', attrs={'class': 'teaser__title__value--short'})).strip()
|
||||
ignore = { 'dirkjan', 's1ngle', 'pukkels', 'hein de kort' }
|
||||
ignore = {'dirkjan', 's1ngle', 'pukkels', 'hein de kort'}
|
||||
if teaser_label.lower() in ignore:
|
||||
continue
|
||||
parts = []
|
||||
|
@ -60,7 +60,7 @@ class projectsynd(BasicNewsRecipe):
|
||||
keep_only_tags = [
|
||||
dict(attrs={'itemprop':lambda x: x and 'associatedMedia' in x.split()}),
|
||||
dict(attrs={'itemprop':['headline', 'datePublished', 'author', 'abstract', 'articleBody']}),
|
||||
dict(name = 'aside', attrs={'data-page-area':'article-bottom'})
|
||||
dict(name='aside', attrs={'data-page-area':'article-bottom'})
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
|
@ -152,7 +152,7 @@ class RadioCanada(BasicNewsRecipe):
|
||||
# The following was copied and adapted as per the following post:
|
||||
# https://www.mobileread.com/forums/showpost.php?p=1165462&postcount=6
|
||||
# Credit goes to user Starson17
|
||||
def parse_feeds (self):
|
||||
def parse_feeds(self):
|
||||
feeds = BasicNewsRecipe.parse_feeds(self)
|
||||
for feed in feeds:
|
||||
for article in feed.articles[:]:
|
||||
|
@ -171,4 +171,4 @@ class respektRecipe(BasicNewsRecipe):
|
||||
o.getparent().replace(o,e)
|
||||
except:
|
||||
pass
|
||||
return(BeautifulSoup(lxml.etree.tostring(root,encoding='unicode')))
|
||||
return (BeautifulSoup(lxml.etree.tostring(root,encoding='unicode')))
|
||||
|
@ -12,8 +12,8 @@ class Volkskrant(BasicNewsRecipe):
|
||||
country = 'RO'
|
||||
category = 'news, politics, Romania'
|
||||
resolve_internal_links = True
|
||||
remove_tags_before = { 'class': 'col-span-8' }
|
||||
remove_tags_after = { 'class': 'col-span-8' }
|
||||
remove_tags_before = {'class': 'col-span-8'}
|
||||
remove_tags_after = {'class': 'col-span-8'}
|
||||
remove_tags = [
|
||||
dict(
|
||||
attrs={
|
||||
|
@ -25,7 +25,7 @@ class scroll(BasicNewsRecipe):
|
||||
'''
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name = 'header'),
|
||||
dict(name='header'),
|
||||
classes('featured-image article-body')
|
||||
]
|
||||
|
||||
|
@ -76,7 +76,7 @@ class FreeInquiry(BasicNewsRecipe):
|
||||
url = ''
|
||||
seen.add(url)
|
||||
self.log('Found article:', art_title)
|
||||
yield{
|
||||
yield {
|
||||
'title': art_title,
|
||||
'url': url,
|
||||
'description': desc
|
||||
|
@ -37,7 +37,7 @@ class spectator(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name = ['svg', 'button']),
|
||||
dict(name=['svg', 'button']),
|
||||
classes(
|
||||
'entry-meta audio-read-block insert--most-popular ad-slot ad-slot--in-content ad-content '
|
||||
'subscription-banner '
|
||||
|
@ -33,7 +33,7 @@ class Stiintasitehnica(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name='span', attrs={'class': ['redEar']}), dict(name='table', attrs={'class': ['connect_widget_interactive_area']}), dict(name='div', attrs={'class': ['panel-overlay']}), dict(name='div', attrs={ 'id': ['pointer']}), dict(name='img', attrs={'class': ['nav-next', 'nav-prev']}), dict(name='table', attrs={'class': ['connect_widget_interactive_area']}), dict(name='hr', attrs={'class': ['dotted']}) # noqa: E501
|
||||
dict(name='span', attrs={'class': ['redEar']}), dict(name='table', attrs={'class': ['connect_widget_interactive_area']}), dict(name='div', attrs={'class': ['panel-overlay']}), dict(name='div', attrs={'id': ['pointer']}), dict(name='img', attrs={'class': ['nav-next', 'nav-prev']}), dict(name='table', attrs={'class': ['connect_widget_interactive_area']}), dict(name='hr', attrs={'class': ['dotted']}) # noqa: E501
|
||||
]
|
||||
|
||||
remove_tags_after = [
|
||||
|
@ -28,7 +28,7 @@ class StrangeHorizons(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name = 'button'),
|
||||
dict(name='button'),
|
||||
classes('font-size sharedaddy comments-form-row')
|
||||
]
|
||||
|
||||
|
@ -50,12 +50,12 @@ class TagesspiegelRss(BasicNewsRecipe):
|
||||
return cover
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name = 'header', attrs={'class':'Bo'}),
|
||||
dict(name = 'div', attrs={'id':'story-elements'})
|
||||
dict(name='header', attrs={'class':'Bo'}),
|
||||
dict(name='div', attrs={'id':'story-elements'})
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name = 'aside'),
|
||||
dict(name='aside'),
|
||||
classes('iqd_mainAd Bs')
|
||||
]
|
||||
|
||||
|
@ -119,9 +119,9 @@ class PrivateEyeRecipe(BasicNewsRecipe):
|
||||
for h in a.findAll('h3'):
|
||||
(title, author) = self.title_author(h.getText())
|
||||
content_articles.append(self.article_entry(
|
||||
title = title,
|
||||
url = self.abs_url(a.get('href')),
|
||||
author = author,
|
||||
title=title,
|
||||
url=self.abs_url(a.get('href')),
|
||||
author=author,
|
||||
))
|
||||
break
|
||||
else:
|
||||
@ -157,9 +157,9 @@ class PrivateEyeRecipe(BasicNewsRecipe):
|
||||
else:
|
||||
(title, author) = self.title_author(a.getText())
|
||||
articles.append(self.article_entry(
|
||||
title = title,
|
||||
url = self.abs_url(a.get('href')),
|
||||
author = author,
|
||||
title=title,
|
||||
url=self.abs_url(a.get('href')),
|
||||
author=author,
|
||||
))
|
||||
|
||||
if not articles:
|
||||
|
@ -65,7 +65,7 @@ class times(BasicNewsRecipe):
|
||||
]
|
||||
|
||||
remove_tags_after = [
|
||||
dict(name = 'div', attrs={'id':'paywall-portal-article-footer'})
|
||||
dict(name='div', attrs={'id':'paywall-portal-article-footer'})
|
||||
]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
|
@ -92,7 +92,7 @@ class TLS(BasicNewsRecipe):
|
||||
if x['byline']['text']:
|
||||
desc = 'By ' + re_html(x['byline']['text']) + ' | ' + desc
|
||||
self.log(' ', title, '\n\t', desc, '\n\t', url)
|
||||
return ({ 'title': title, 'description': desc, 'url': url })
|
||||
return ({'title': title, 'description': desc, 'url': url})
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
for img in soup.findAll('img', attrs={'src':True}):
|
||||
|
@ -227,7 +227,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
divtags = soup.findAll('div', attrs={'id': ''})
|
||||
if divtags:
|
||||
for div in divtags:
|
||||
del(div['id'])
|
||||
del (div['id'])
|
||||
|
||||
pgall = soup.find('div', attrs={'id': 'storyphoto'})
|
||||
if pgall is not None: # photo gallery perhaps
|
||||
|
@ -215,7 +215,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
divtags = soup.findAll('div', attrs={'id': ''})
|
||||
if divtags:
|
||||
for div in divtags:
|
||||
del(div['id'])
|
||||
del (div['id'])
|
||||
|
||||
pgall = soup.find('div', attrs={'id': 'storyphoto'})
|
||||
if pgall is not None: # photo gallery perhaps
|
||||
|
@ -104,7 +104,7 @@ class Volkskrant(BasicNewsRecipe):
|
||||
if tag.name == 'picture':
|
||||
tag.replaceWith(tag.find('img'))
|
||||
|
||||
comic_articles = { 'Bas van der Schot', 'Poldermodellen', 'Gummbah', 'Sigmund' }
|
||||
comic_articles = {'Bas van der Schot', 'Poldermodellen', 'Gummbah', 'Sigmund'}
|
||||
if self.tag_to_string(soup.find('h1')).strip() in comic_articles:
|
||||
for node in soup.find('figure').find_next_siblings():
|
||||
node.extract()
|
||||
|
@ -57,7 +57,7 @@ class CanWestPaper(BasicNewsRecipe):
|
||||
divtags = soup.findAll('div', attrs={'id': ''})
|
||||
if divtags:
|
||||
for div in divtags:
|
||||
del(div['id'])
|
||||
del (div['id'])
|
||||
return soup
|
||||
|
||||
def parse_index(self):
|
||||
|
@ -39,6 +39,7 @@ select = [
|
||||
'E302', 'E303', 'E304', 'E305', 'W391', # blank-line standard
|
||||
'E111', 'E112', 'E113', 'E117', # code indentation
|
||||
'E114', 'E115', 'E116', 'E261', 'E262', 'E265', # comment formating
|
||||
'E201', 'E202', 'E211', 'E251', 'E275', # various whitespace
|
||||
]
|
||||
unfixable = ['PIE794']
|
||||
|
||||
|
@ -109,7 +109,7 @@ class DJVUFile:
|
||||
def __init__(self, instream, verbose=0):
|
||||
self.instream = instream
|
||||
buf = self.instream.read(4)
|
||||
assert(buf == b'AT&T')
|
||||
assert (buf == b'AT&T')
|
||||
buf = self.instream.read()
|
||||
self.dc = DjvuChunk(buf, 0, len(buf), verbose=verbose)
|
||||
|
||||
|
@ -416,7 +416,7 @@ class BZZDecoder:
|
||||
# Create machine independent ffz table
|
||||
for i in range(256):
|
||||
j = i
|
||||
while(j & 0x80):
|
||||
while (j & 0x80):
|
||||
self.ffzt[i] += 1
|
||||
j <<= 1
|
||||
# Initialize table
|
||||
|
@ -306,7 +306,7 @@ class Text(Element):
|
||||
if not (self.text_as_string.endswith(' ') \
|
||||
or self.text_as_string.endswith('-') \
|
||||
or other.text_as_string.startswith(' ') \
|
||||
or other.text_as_string.startswith('-') ):
|
||||
or other.text_as_string.startswith('-')):
|
||||
has_gap = 1
|
||||
else:
|
||||
has_gap = 0
|
||||
|
@ -31,7 +31,7 @@ def toolbar_widgets_for_action(gui, action):
|
||||
# The button might be hidden
|
||||
if not w.isVisible():
|
||||
continue
|
||||
yield(w)
|
||||
yield (w)
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
|
@ -725,7 +725,7 @@ class PluginWidget(QWidget,Ui_Form):
|
||||
self.preset_field.setCurrentIndex(0)
|
||||
|
||||
if item_name in self.presets.keys():
|
||||
del(self.presets[item_name])
|
||||
del (self.presets[item_name])
|
||||
self.presets.commit()
|
||||
|
||||
def preset_save(self):
|
||||
|
@ -206,7 +206,7 @@ class BookInfo(QDialog, DropMixin):
|
||||
|
||||
self.details = Details(parent.book_details.book_info, self,
|
||||
allow_context_menu=library_path is None,
|
||||
is_locked = dialog_number == DialogNumbers.Locked)
|
||||
is_locked=dialog_number == DialogNumbers.Locked)
|
||||
self.details.anchor_clicked.connect(self.on_link_clicked)
|
||||
self.link_delegate = link_delegate
|
||||
self.details.setAttribute(Qt.WidgetAttribute.WA_OpaquePaintEvent, False)
|
||||
|
@ -488,7 +488,7 @@ class AdvancedRecipe(QWidget): # {{{
|
||||
compile_recipe(src)
|
||||
except Exception as err:
|
||||
error_dialog(self, _('Invalid recipe'), _(
|
||||
'Failed to compile the recipe, with syntax error: {}' ).format(err), show=True)
|
||||
'Failed to compile the recipe, with syntax error: {}').format(err), show=True)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -40,7 +40,7 @@ class Tracker:
|
||||
self.last_pos = 0
|
||||
self.queue: deque[Utterance] = deque()
|
||||
|
||||
def parse_marked_text(self, marked_text, limit = MAX_UTTERANCE_LENGTH):
|
||||
def parse_marked_text(self, marked_text, limit=MAX_UTTERANCE_LENGTH):
|
||||
self.clear()
|
||||
text = []
|
||||
text_len = chunk_len = index_in_positions = offset_in_text = 0
|
||||
|
@ -401,7 +401,7 @@ class Main(MainWindow):
|
||||
self.action_save.setEnabled(False)
|
||||
self.action_save_copy = treg('save.png', _('Save a ©'), self.boss.save_copy, 'save-copy', 'Ctrl+Alt+S', _('Save a copy of the book'))
|
||||
self.action_save_copy_edit = treg('save.png', _('Save a © and edit in new window'), partial(self.boss._save_copy, 'edit'), 'save-copy-edit',
|
||||
'Ctrl+Shift+S', _( 'Save a copy of the book and edit it in a new window'))
|
||||
'Ctrl+Shift+S', _('Save a copy of the book and edit it in a new window'))
|
||||
self.action_save_copy_replace = treg('save.png', _('Save a © and edit here'), partial(self.boss._save_copy, 'replace'),
|
||||
'save-copy-replace', 'Ctrl+Alt+Shift+S', _('Save a copy of the book and edit it in this window'))
|
||||
self.action_quit = treg('window-close.png', _('&Quit'), self.boss.quit, 'quit', 'Ctrl+Q', _('Quit'))
|
||||
|
@ -124,7 +124,7 @@ class Worker(QWebEnginePage):
|
||||
if not sip.isdeleted(self):
|
||||
self.messages_dispatch.emit(messages)
|
||||
|
||||
def runjs(self, js: str, callback = None) -> None:
|
||||
def runjs(self, js: str, callback=None) -> None:
|
||||
if callback is None:
|
||||
self.runJavaScript(js, QWebEngineScript.ScriptWorldId.ApplicationWorld)
|
||||
else:
|
||||
|
@ -157,7 +157,7 @@ def category_item_as_json(x, clear_rating=False):
|
||||
return ans
|
||||
|
||||
|
||||
def get_gpref(name: str, defval = None):
|
||||
def get_gpref(name: str, defval=None):
|
||||
gprefs = getattr(get_gpref, 'gprefs', None)
|
||||
if gprefs is None:
|
||||
from calibre.utils.config import JSONConfig
|
||||
|
@ -56,7 +56,7 @@ class Query:
|
||||
query_string[name] = [getattr(self, macro)]
|
||||
else:
|
||||
# remove the name/value pair
|
||||
del(query_string[name])
|
||||
del (query_string[name])
|
||||
|
||||
# copy the url parts and substitute in our new query string
|
||||
url_parts = list(self.url_parts)
|
||||
|
@ -299,7 +299,7 @@ class Element(Node):
|
||||
def __init__(self, attributes=None, text=None, cdata=None, qname=None, qattributes=None, check_grammar=True, **args):
|
||||
if qname is not None:
|
||||
self.qname = qname
|
||||
assert(hasattr(self, 'qname'))
|
||||
assert (hasattr(self, 'qname'))
|
||||
self.ownerDocument = None
|
||||
self.childNodes=[]
|
||||
self.allowed_children = grammar.allowed_children.get(self.qname)
|
||||
|
Loading…
x
Reference in New Issue
Block a user