Enable warnings and fix some of them

This commit is contained in:
Tobias Gruetzmacher 2018-05-23 00:54:40 +02:00
parent be525dbd54
commit fbb3a18c91
7 changed files with 33 additions and 23 deletions

View file

@ -1,3 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
SITE_NAME = "dosage" SITE_NAME = "dosage"
SITE_SUB = "a comic downloader and archiver" SITE_SUB = "a comic downloader and archiver"
SITE_AUTHOR = "Tobias Gruetzmacher" SITE_AUTHOR = "Tobias Gruetzmacher"
@ -6,7 +9,7 @@ SITE_LINKS = (
{'name': 'Report Issue', 'icon': 'bug', 'url': 'https://github.com/webcomics/dosage/issues/new'}, {'name': 'Report Issue', 'icon': 'bug', 'url': 'https://github.com/webcomics/dosage/issues/new'},
) )
SITE_ICONS = ( SITE_ICONS = (
{'name': 'GitHub', 'icon': 'github', 'url': 'https://github.com/webcomics/dosage/releases/latest'}, {'name': 'GitHub', 'icon': 'github', 'url': 'https://github.com/webcomics/dosage'},
) )
THEME = "doc/.theme" THEME = "doc/.theme"

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher # Copyright (C) 2015-2018 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
@ -42,7 +42,7 @@ class AbsurdNotions(_BasicScraper):
imageSearch = compile(tagre('img', 'src', r'(an[^"]+)')) imageSearch = compile(tagre('img', 'src', r'(an[^"]+)'))
multipleImagesPerStrip = True multipleImagesPerStrip = True
prevSearch = compile(tagre('a', 'href', r'([^"]+)') + prevSearch = compile(tagre('a', 'href', r'([^"]+)') +
tagre('img', 'src', 'nprev\.gif')) tagre('img', 'src', r'nprev\.gif'))
help = 'Index format: n (unpadded)' help = 'Index format: n (unpadded)'
@ -52,7 +52,7 @@ class AcademyVale(_BasicScraper):
firstStripUrl = stripUrl % '001' firstStripUrl = stripUrl % '001'
imageSearch = compile(tagre('img', 'src', r'(avale\d{4}-\d{2}\.gif)')) imageSearch = compile(tagre('img', 'src', r'(avale\d{4}-\d{2}\.gif)'))
prevSearch = compile(tagre('a', 'href', r'(avarch[^">]+)', quote="") + prevSearch = compile(tagre('a', 'href', r'(avarch[^">]+)', quote="") +
tagre('img', 'src', 'AVNavBack\.gif')) tagre('img', 'src', r'AVNavBack\.gif'))
help = 'Index format: nnn' help = 'Index format: nnn'
@ -240,6 +240,7 @@ class Annyseed(_ParserScraper):
return self.stripUrl % '149' return self.stripUrl % '149'
return tourl return tourl
class AppleGeeks(_BasicScraper): class AppleGeeks(_BasicScraper):
url = 'http://www.applegeeks.com/' url = 'http://www.applegeeks.com/'
stripUrl = url + 'comics/viewcomic.php?issue=%s' stripUrl = url + 'comics/viewcomic.php?issue=%s'

View file

@ -1,14 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher # Copyright (C) 2015-2018 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from re import compile, escape from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import bounceStarter, indirectStarter from ..helpers import indirectStarter
from ..util import tagre from ..util import tagre
from .common import _TumblrScraper, _WordPressScraper, _WPNavi from .common import _TumblrScraper, _WordPressScraper, _WPNavi

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher # Copyright (C) 2015-2018 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
@ -72,6 +72,7 @@ class Deathbulge(_BasicScraper):
imageSearch = compile(r"(/images/comics/[^\.]+\.jpg)") imageSearch = compile(r"(/images/comics/[^\.]+\.jpg)")
prevSearch = compile(r'"previous":(\d+),') prevSearch = compile(r'"previous":(\d+),')
firstStripUrl = url + '/1' firstStripUrl = url + '/1'
def getPrevUrl(self, url, data): def getPrevUrl(self, url, data):
if data[1] == self.url: if data[1] == self.url:
data = (data[0], data[1] + '/') data = (data[0], data[1] + '/')

View file

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher # Copyright (C) 2015-2018 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
@ -19,7 +19,12 @@ import traceback
import time import time
import subprocess import subprocess
from six.moves.html_parser import HTMLParser try:
import html
except ImportError:
# Python 2.7
from HTMLParser import HTMLParser
html = HTMLParser()
from six.moves import range from six.moves import range
import six import six
@ -203,12 +208,9 @@ def prettyMatcherList(things):
return "('%s')" % "', '".join(norm) return "('%s')" % "', '".join(norm)
_htmlparser = HTMLParser()
def unescape(text): def unescape(text):
"""Replace HTML entities and character references.""" """Replace HTML entities and character references."""
return _htmlparser.unescape(text) return html.unescape(text)
_nopathquote_chars = "-;/=,~*+()@!" _nopathquote_chars = "-;/=,~*+()@!"

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher # Copyright (C) 2015-2018 Tobias Gruetzmacher
'''update languages.py from pycountry''' '''update languages.py from pycountry'''
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
@ -30,12 +30,12 @@ def main():
def get_used_languages(): def get_used_languages():
lang = {} languages = {}
for scraperobj in get_scrapers(): for scraperobj in get_scrapers():
l = scraperobj.lang lang = scraperobj.lang
if l not in lang: if lang not in languages:
lang[l] = scraperobj.language() languages[lang] = scraperobj.language()
return lang return languages
def write_languages(f, l): def write_languages(f, l):

View file

@ -35,3 +35,6 @@ max-line-length = 120
ignore = E121,E126,E241,FI12,FI14,FI15,FI50,FI51,FI53,FI54,FI55 ignore = E121,E126,E241,FI12,FI14,FI15,FI50,FI51,FI53,FI54,FI55
require-code = True require-code = True
min-version = 2.7 min-version = 2.7
[pytest]
filterwarnings = default