Some minor style fixes.

This commit is contained in:
Tobias Gruetzmacher 2017-05-15 00:54:02 +02:00
parent b8484cde50
commit 8b90aa5cfb
18 changed files with 71 additions and 40 deletions

View file

@ -15,8 +15,6 @@ Comic modules for each comic are located in L{dosagelib.plugins}.
""" """
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
import sys
import os
from pbr.version import VersionInfo from pbr.version import VersionInfo
AppName = u'dosage' AppName = u'dosage'

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-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
@ -22,6 +22,7 @@ class ArgumentParser(argparse.ArgumentParser):
with out.pager(): with out.pager():
out.info(self.format_help()) out.info(self.format_help())
Examples = """\ Examples = """\
EXAMPLES EXAMPLES
List available comics: List available comics:
@ -293,6 +294,7 @@ def do_column_list(scrapers):
del names[:names_per_line] del names[:names_per_line]
return num, disabled return num, disabled
TAG_ADULT = "adult" TAG_ADULT = "adult"
TAG_LANG = "lang" TAG_LANG = "lang"
TAG_DISABLED = "dis" TAG_DISABLED = "dis"

View file

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2012-2014 Bastian Kleineidam # Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher # Copyright (C) 2015-2017 Tobias Gruetzmacher
""" """
Define basic configuration data like version or application name. Define basic configuration data like version or application name.
""" """
from __future__ import print_function from __future__ import absolute_import, division, print_function
from . import AppName, AppVersion from . import AppName, AppVersion
App = AppName + u' ' + AppVersion App = AppName + u' ' + AppVersion
@ -18,7 +19,7 @@ UserAgent = u"Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, AppVersion,
Url) Url)
Copyright = u"""Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs Copyright = u"""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-2017 Tobias Gruetzmacher
""" """
Freeware = AppName + u""" comes with ABSOLUTELY NO WARRANTY! Freeware = AppName + u""" comes with ABSOLUTELY NO WARRANTY!
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it

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-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
@ -310,6 +310,7 @@ def addHandlerClass(clazz):
raise ValueError("%s must be subclassed from %s" % (clazz, EventHandler)) raise ValueError("%s must be subclassed from %s" % (clazz, EventHandler))
_handler_classes[clazz.name] = clazz _handler_classes[clazz.name] = clazz
addHandlerClass(HtmlEventHandler) addHandlerClass(HtmlEventHandler)
addHandlerClass(RSSEventHandler) addHandlerClass(RSSEventHandler)
addHandlerClass(JSONEventHandler) addHandlerClass(JSONEventHandler)

View file

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# ISO 693-1 language codes from pycountry # ISO 693-1 language codes from pycountry
# This file is automatically generated, DO NOT EDIT! # This file is automatically generated, DO NOT EDIT!
from __future__ import absolute_import, division, print_function
Languages = { Languages = {
'de': u'German', 'de': 'German',
'en': u'English', 'en': 'English',
'es': u'Spanish; Castilian', 'es': 'Spanish; Castilian',
'fi': u'Finnish', 'fi': 'Finnish',
'fr': u'French', 'fr': 'French',
'it': u'Italian', 'it': 'Italian',
'ja': u'Japanese', 'ja': 'Japanese',
'pt': u'Portuguese', 'pt': 'Portuguese',
} }

View file

@ -1,6 +1,9 @@
# -*- coding: iso-8859-1 -*- # -*- 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
from __future__ import absolute_import, division, print_function
from re import compile, escape from re import compile, escape
from ..scraper import _BasicScraper from ..scraper import _BasicScraper

View file

@ -1,13 +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-2016 Tobias Gruetzmacher # Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
from ..scraper import _ParserScraper from ..scraper import _ParserScraper
from ..helpers import bounceStarter from ..helpers import bounceStarter
class Xkcd(_ParserScraper): class Xkcd(_ParserScraper):
name = 'xkcd' name = 'xkcd'
url = 'http://xkcd.com/' url = 'http://xkcd.com/'

View file

@ -1,12 +1,17 @@
# -*- coding: iso-8859-1 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# TODO: Not sure if this RSS output is "valid", should be though. # Copyright (C) 2015-2017 Tobias Gruetzmacher
# Might also be nice categorise Comics under one Item
from __future__ import absolute_import, division, print_function
import xml.dom.minidom import xml.dom.minidom
import time import time
from .configuration import App from .configuration import App
# TODO: Not sure if this RSS output is "valid", should be though.
# Might also be nice categorise Comics under one Item
class Feed(object): class Feed(object):
"""Write an RSS feed with comic strip images.""" """Write an RSS feed with comic strip images."""
@ -62,8 +67,11 @@ def parseFeed(filename, yesterday):
"""Parse an RSS feed and filter only entries that are newer than yesterday.""" """Parse an RSS feed and filter only entries that are newer than yesterday."""
dom = xml.dom.minidom.parse(filename) dom = xml.dom.minidom.parse(filename)
getText = lambda node, tag: node.getElementsByTagName(tag)[0].childNodes[0].data def getText(node, tag):
getNode = lambda tag: dom.getElementsByTagName(tag) node.getElementsByTagName(tag)[0].childNodes[0].data
def getNode(tag):
dom.getElementsByTagName(tag)
content = getNode('channel')[0] # Only one channel node content = getNode('channel')[0] # Only one channel node

View file

@ -1,9 +1,11 @@
# -*- coding: iso-8859-1 -*- # -*- coding: utf-8 -*-
# Copied from: https://github.com/pycontribs/tendo # Copied from: https://github.com/pycontribs/tendo
# License: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 # License: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# Author: Sorin Sbarnea # Author: Sorin Sbarnea
# Changes: changed logging and formatting # Changes: changed logging and formatting
from __future__ import absolute_import, division, print_function
import sys import sys
import os import os
import errno import errno

View file

@ -1,7 +1,10 @@
# -*- coding: iso-8859-1 -*- # -*- coding: utf-8 -*-
""" # Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
Function to check for updates. # Copyright (C) 2012-2014 Bastian Kleineidam
""" # Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import os import os
import dosagelib import dosagelib
from dosagelib import configuration from dosagelib import configuration
@ -9,9 +12,9 @@ from .util import urlopen
from distutils.version import StrictVersion from distutils.version import StrictVersion
import requests import requests
UPDATE_URL = "https://api.github.com/repos/webcomics/dosage/releases/latest" UPDATE_URL = "https://api.github.com/repos/webcomics/dosage/releases/latest"
def check_update(): def check_update():
"""Return the following values: """Return the following values:
(False, errmsg) - online version could not be determined (False, errmsg) - online version could not be determined

View file

@ -40,5 +40,6 @@ class CreatorsUpdater(ComicListUpdater):
langopt = ", 'es'" if name.lower().endswith('spanish') else '' langopt = ", 'es'" if name.lower().endswith('spanish') else ''
return u"cls('%s', '%s'%s)," % (name, path, langopt) return u"cls('%s', '%s'%s)," % (name, path, langopt)
if __name__ == '__main__': if __name__ == '__main__':
CreatorsUpdater(__file__).run() CreatorsUpdater(__file__).run()

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-2016 Tobias Gruetzmacher # Copyright (C) 2015-2017 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
@ -24,6 +24,7 @@ def main():
f.write('# -*- coding: %s -*-%s' % (encoding, os.linesep)) f.write('# -*- coding: %s -*-%s' % (encoding, os.linesep))
f.write('# ISO 693-1 language codes from pycountry%s' % os.linesep) f.write('# ISO 693-1 language codes from pycountry%s' % os.linesep)
f.write('# This file is automatically generated, DO NOT EDIT!%s' % os.linesep) f.write('# This file is automatically generated, DO NOT EDIT!%s' % os.linesep)
f.write('from __future__ import absolute_import, division, print_function%s' % os.linesep)
lang = get_used_languages() lang = get_used_languages()
write_languages(f, lang) write_languages(f, lang)

View file

@ -167,5 +167,6 @@ class SmackJeevesUpdater(ComicListUpdater):
opt += ", endOfLife=True" opt += ", endOfLife=True"
return u"cls('%s', %s)," % (name, opt) return u"cls('%s', %s)," % (name, opt)
if __name__ == '__main__': if __name__ == '__main__':
SmackJeevesUpdater(__file__).run() SmackJeevesUpdater(__file__).run()

View file

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Copyright (C) 2013-2014 Bastian Kleineidam # Copyright (C) 2013-2014 Bastian Kleineidam
# Copyright (C) 2016 Tobias Gruetzmacher # Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import os import os
import subprocess import subprocess

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-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function

View file

@ -2,6 +2,8 @@
# Copyright (C) 2013-2014 Bastian Kleineidam # Copyright (C) 2013-2014 Bastian Kleineidam
# Copyright (C) 2015-2016 Tobias Gruetzmacher # Copyright (C) 2015-2016 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import pytest import pytest
from dosagelib import scraper from dosagelib import scraper

View file

@ -4,6 +4,8 @@
# Author: Sorin Sbarnea # Author: Sorin Sbarnea
# Changes: changed logging and formatting # Changes: changed logging and formatting
from __future__ import absolute_import, division, print_function
from dosagelib import singleton from dosagelib import singleton
from multiprocessing import Process from multiprocessing import Process

View file

@ -1,7 +1,9 @@
# -*- 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) 2016 Tobias Gruetzmacher # Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import pytest import pytest
import re import re