Fix a bunch of flake8 issues
This commit is contained in:
parent
255fbfa1b4
commit
00d0201c5f
17 changed files with 47 additions and 52 deletions
|
@ -202,7 +202,6 @@ def vote_comic(scraperobj):
|
|||
orig_context = out.context
|
||||
out.context = scraperobj.name
|
||||
try:
|
||||
name = scraperobj.name
|
||||
scraperobj.vote()
|
||||
out.info(u'Vote submitted.')
|
||||
except Exception as msg:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -215,6 +215,7 @@ class ButImACatPerson(_WordPressScraper):
|
|||
stripUrl = 'comic/%s/'
|
||||
firstStripUrl = 'sketches-1'
|
||||
|
||||
|
||||
class ButtercupFestival(_ParserScraper):
|
||||
url = 'http://www.buttercupfestival.com/'
|
||||
stripUrl = url + '%s.htm'
|
||||
|
|
|
@ -55,8 +55,10 @@ class FirstWorldProblems(_BasicScraper):
|
|||
url = 'http://bradcolbow.com/archive/C5/'
|
||||
stripUrl = url + '%s/'
|
||||
firstStripUrl = stripUrl % 'P10'
|
||||
imageSearch = compile(tagre("img", "src", r'(http://(?:fwpcomics\.s3\.amazonaws\.com|s3\.amazonaws\.com/fwpcomics)/s1-[^"]+)'))
|
||||
prevSearch = compile(tagre("a", "href", r'(http://bradcolbow\.com/archive/C5/[^"]+)', before="prev"))
|
||||
imageSearch = compile(tagre("img", "src",
|
||||
r'(http://(?:fwpcomics\.s3\.amazonaws\.com|s3\.amazonaws\.com/fwpcomics)/s1-[^"]+)'))
|
||||
prevSearch = compile(tagre("a", "href",
|
||||
r'(http://bradcolbow\.com/archive/C5/[^"]+)', before="prev"))
|
||||
multipleImagesPerStrip = True
|
||||
help = 'Index format: a letter and a number'
|
||||
|
||||
|
@ -137,6 +139,7 @@ class FredoAndPidjin(_ParserScraper):
|
|||
starter = indirectStarter
|
||||
namer = joinPathPartsNamer((0, 1, 2))
|
||||
|
||||
|
||||
class Freefall(_BasicScraper):
|
||||
url = 'http://freefall.purrsia.com/default.htm'
|
||||
stripUrl = 'http://freefall.purrsia.com/ff%s/fc%s.htm'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -10,7 +10,7 @@ from re import compile, escape
|
|||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..helpers import bounceStarter, indirectStarter
|
||||
from ..util import tagre
|
||||
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi
|
||||
from .common import _ComicControlScraper, _WordPressScraper
|
||||
|
||||
|
||||
class Galaxion(_BasicScraper):
|
||||
|
@ -189,7 +189,7 @@ class GunnerkriggCourt(_BasicScraper):
|
|||
imageSearch = compile(tagre("img", "src", r'(/comics/[^"]+)'))
|
||||
prevSearch = compile(
|
||||
tagre("a", "href", r'(\?p=\d+)') +
|
||||
tagre("img", "src", "/images/prev_a\.jpg"))
|
||||
tagre("img", "src", r'/images/prev_a\.jpg'))
|
||||
help = 'Index format: number'
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from re import compile, escape
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..scraper import _BasicScraper
|
||||
from ..util import tagre
|
||||
from ..helpers import bounceStarter, indirectStarter
|
||||
from .common import _ComicControlScraper, _WordPressScraper, _WPNaviIn
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -179,8 +179,8 @@ class MrLovenstein(_BasicScraper):
|
|||
firstStripUrl = stripUrl % '1'
|
||||
imageSearch = (
|
||||
# captures rollover comic
|
||||
compile(tagre("div", "class", r'comic_image') + "\s*.*\s*" +
|
||||
tagre("div", "style", r'display: none;') + "\s*.*\s*" +
|
||||
compile(tagre("div", "class", r'comic_image') + r'\s*.*\s*' +
|
||||
tagre("div", "style", r'display: none;') + r'\s*.*\s' +
|
||||
tagre("img", "src", r'(/images/comics/[^"]+)')),
|
||||
# captures standard comic
|
||||
compile(tagre("img", "src", r'(/images/comics/[^"]+)',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -75,7 +75,7 @@ class NichtLustig(_BasicScraper):
|
|||
url = 'http://www.nichtlustig.de/main.html'
|
||||
stripUrl = 'http://static.nichtlustig.de/toondb/%s.html'
|
||||
lang = 'de'
|
||||
imageSearch = compile('background-image:url\((http://static\.nichtlustig\.de/comics/full/\d+\.jpg)')
|
||||
imageSearch = compile(r'background-image:url\((http://static\.nichtlustig\.de/comics/full/\d+\.jpg)')
|
||||
prevSearch = compile(tagre("a", "href", r'(http://static\.nichtlustig\.de/toondb/\d+\.html)'))
|
||||
latestSearch = compile(tagre("a", "href", r'([^"]*toondb/\d+\.html)'))
|
||||
help = 'Index format: yymmdd'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -94,8 +94,8 @@ class OnTheFastrack(_BasicScraper):
|
|||
def namer(self, image_url, page_url):
|
||||
name = page_url.rsplit('/', 3)[2]
|
||||
if name == "onthefastrack.com":
|
||||
import datetime
|
||||
name = datetime.date.today().strftime("%B-%d-%Y")
|
||||
import datetime
|
||||
name = datetime.date.today().strftime("%B-%d-%Y")
|
||||
# name.title ensures that the comics are named the same
|
||||
# as in the previous scraper
|
||||
return "%s.gif" % name.title()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2018 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -155,7 +155,7 @@ class SequentialArt(_BasicScraper):
|
|||
firstStripUrl = stripUrl % '1'
|
||||
imageSearch = compile(tagre("img", "src", r'([^"]+)', before="strip"))
|
||||
prevSearch = compile(tagre("a", "href", r'(/sequentialart\.php\?s=\d+)') +
|
||||
tagre("img", "src", "Nav_BackOne\.gif"))
|
||||
tagre("img", "src", r'Nav_BackOne\.gif'))
|
||||
help = 'Index format: name'
|
||||
|
||||
|
||||
|
@ -193,7 +193,8 @@ class ShermansLagoon(_BasicScraper):
|
|||
url = 'http://shermanslagoon.com/'
|
||||
stripUrl = url + 'comics/%s'
|
||||
firstStripUrl = stripUrl % '/december-29-2003/'
|
||||
imageSearch = compile(tagre("img", "src", r'(https://safr\.kingfeatures\.com/idn/cnfeed/zone/js/content\.php\?file=.+?)'))
|
||||
imageSearch = compile(tagre("img", "src",
|
||||
r'(https://safr\.kingfeatures\.com/idn/cnfeed/zone/js/content\.php\?file=.+?)'))
|
||||
prevSearch = compile(r'id="previouscomic" class="button white"><a href="(%scomics/[a-z0-9-]+/)"' % url)
|
||||
help = 'Index format: monthname-day-year'
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -63,9 +63,9 @@ class Weregeek(_BasicScraper):
|
|||
stripUrl = url + '%s/'
|
||||
firstStripUrl = stripUrl % '2006/11/27/'
|
||||
imageSearch = compile(tagre("img", "src",
|
||||
r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
|
||||
r'(%scomics/\d+-\d+-\d+[^"]+)' % rurl))
|
||||
prevSearch = compile(tagre("a", "href", r'((%s)?/?\d+/\d+/\d+/)' % rurl) +
|
||||
'\s*' + tagre('img', 'src', '[^"]*previous_day.gif'))
|
||||
r'\s*' + tagre('img', 'src', '[^"]*previous_day.gif'))
|
||||
help = 'Index format: yyyy/mm/dd'
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
from ..scraper import _BasicScraper, _ParserScraper
|
||||
from ..scraper import _ParserScraper
|
||||
from .common import _WordPressScraper
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2016 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -25,9 +25,8 @@ except ImportError:
|
|||
pycountry = None
|
||||
|
||||
from . import loader, configuration, languages
|
||||
from .util import (get_page, makeSequence, get_system_uid, urlopen,
|
||||
unescape, tagre, normaliseURL, prettyMatcherList,
|
||||
requests_session, uniq)
|
||||
from .util import (get_page, makeSequence, get_system_uid, unescape, tagre,
|
||||
normaliseURL, prettyMatcherList, requests_session, uniq)
|
||||
from .comic import ComicStrip
|
||||
from .output import out
|
||||
from .events import getHandler
|
||||
|
@ -112,17 +111,6 @@ class Scraper(object):
|
|||
self.skippedUrls = set()
|
||||
self.hitFirstStripUrl = False
|
||||
|
||||
def __cmp__(self, other):
|
||||
"""Compare scraper by name and index list."""
|
||||
if not isinstance(other, Scraper):
|
||||
return 1
|
||||
# first, order by name
|
||||
d = cmp(self.name, other.name)
|
||||
if d != 0:
|
||||
return d
|
||||
# then by indexes
|
||||
return cmp(self.indexes, other.indexes)
|
||||
|
||||
def __hash__(self):
|
||||
"""Get hash value from name and index list."""
|
||||
return hash((self.name, self.indexes))
|
||||
|
|
|
@ -84,7 +84,7 @@ def get_system_uid():
|
|||
|
||||
|
||||
def get_nt_system_uid():
|
||||
"""Get the MachineGuid from
|
||||
r"""Get the MachineGuid from
|
||||
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\MachineGuid
|
||||
"""
|
||||
try:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2017-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -47,11 +47,14 @@ def bloomingfaeries():
|
|||
|
||||
add(GET, re.compile(r'http://www\.bloomingfaeries\.com/.*\.jpg'), _img(), content_type='image/jpeg')
|
||||
|
||||
|
||||
def zenpencils():
|
||||
add(GET, 'https://zenpencils.com/', _content('zp-home'))
|
||||
add(GET, 'https://zenpencils.com/comic/missing/', _content('zp-223'))
|
||||
add(GET, 'https://zenpencils.com/comic/lifejacket/', _content('zp-222'))
|
||||
add(GET, re.compile(r'https://cdn-zenpencils\.netdna-ssl\.com/wp-content/uploads/.*\.jpg'), _img(), content_type='image/jpeg')
|
||||
add(GET, re.compile(r'https://cdn-zenpencils\.netdna-ssl\.com/wp-content/uploads/.*\.jpg'), _img(),
|
||||
content_type='image/jpeg')
|
||||
|
||||
|
||||
def vote():
|
||||
add(POST, 'https://buildbox.23.gs/count/', '')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
|
||||
# Copyright (C) 2012-2014 Bastian Kleineidam
|
||||
# Copyright (C) 2015-2017 Tobias Gruetzmacher
|
||||
# Copyright (C) 2015-2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
|
@ -12,6 +12,7 @@ import dosagelib.cmd
|
|||
import httpmocks
|
||||
import json
|
||||
|
||||
|
||||
def cmd(*options):
|
||||
"""'Fake' run dosage with given options."""
|
||||
return dosagelib.cmd.main(('--allow-multiple',) + options)
|
||||
|
@ -76,18 +77,18 @@ class TestDosage(object):
|
|||
httpmocks.zenpencils()
|
||||
print(tmpdir)
|
||||
cmd_ok("-v", "-b", str(tmpdir), "-o", "json", "ZenPencils")
|
||||
|
||||
|
||||
directory = tmpdir.join('ZenPencils')
|
||||
f = directory.join('dosage.json').open(encoding='utf-8')
|
||||
data = json.load(f)
|
||||
f.close()
|
||||
|
||||
|
||||
pages = data['pages']
|
||||
assert len(pages) == 1
|
||||
|
||||
|
||||
page = list(pages.keys())[0]
|
||||
assert page == 'https://zenpencils.com/comic/missing/'
|
||||
|
||||
|
||||
images = data['pages'][page]['images']
|
||||
assert len(images) == 2
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import pytest
|
||||
import re
|
||||
from dosagelib.helpers import joinPathPartsNamer
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2019 Tobias Gruetzmacher
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
|
||||
import pytest
|
||||
import re
|
||||
import time
|
||||
from dosagelib.rss import parseFeed
|
||||
|
||||
|
||||
class TestFeed(object):
|
||||
"""
|
||||
Tests for rss.py
|
||||
|
|
Loading…
Reference in a new issue