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
import sys
import os
from pbr.version import VersionInfo
AppName = u'dosage'

View file

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

View file

@ -1,11 +1,12 @@
# -*- coding: utf-8 -*-
# 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.
"""
from __future__ import print_function
from __future__ import absolute_import, division, print_function
from . import AppName, AppVersion
App = AppName + u' ' + AppVersion
@ -18,7 +19,7 @@ UserAgent = u"Mozilla/5.0 (compatible; %s/%s; +%s)" % (AppName, AppVersion,
Url)
Copyright = u"""Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
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!
This is free software, and you are welcome to redistribute it

View file

@ -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-2017 Tobias Gruetzmacher
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))
_handler_classes[clazz.name] = clazz
addHandlerClass(HtmlEventHandler)
addHandlerClass(RSSEventHandler)
addHandlerClass(JSONEventHandler)

View file

@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
# ISO 693-1 language codes from pycountry
# This file is automatically generated, DO NOT EDIT!
from __future__ import absolute_import, division, print_function
Languages = {
'de': u'German',
'en': u'English',
'es': u'Spanish; Castilian',
'fi': u'Finnish',
'fr': u'French',
'it': u'Italian',
'ja': u'Japanese',
'pt': u'Portuguese',
'de': 'German',
'en': 'English',
'es': 'Spanish; Castilian',
'fi': 'Finnish',
'fr': 'French',
'it': 'Italian',
'ja': 'Japanese',
'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) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from re import compile, escape
from ..scraper import _BasicScraper

View file

@ -1,13 +1,14 @@
# -*- 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-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
from ..scraper import _ParserScraper
from ..helpers import bounceStarter
class Xkcd(_ParserScraper):
name = 'xkcd'
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
# TODO: Not sure if this RSS output is "valid", should be though.
# Might also be nice categorise Comics under one Item
# Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import xml.dom.minidom
import time
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):
"""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."""
dom = xml.dom.minidom.parse(filename)
getText = lambda node, tag: node.getElementsByTagName(tag)[0].childNodes[0].data
getNode = lambda tag: dom.getElementsByTagName(tag)
def getText(node, tag):
node.getElementsByTagName(tag)[0].childNodes[0].data
def getNode(tag):
dom.getElementsByTagName(tag)
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
# License: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
# Author: Sorin Sbarnea
# Changes: changed logging and formatting
from __future__ import absolute_import, division, print_function
import sys
import os
import errno

View file

@ -1,7 +1,10 @@
# -*- coding: iso-8859-1 -*-
"""
Function to check for updates.
"""
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2017 Tobias Gruetzmacher
from __future__ import absolute_import, division, print_function
import os
import dosagelib
from dosagelib import configuration
@ -9,9 +12,9 @@ from .util import urlopen
from distutils.version import StrictVersion
import requests
UPDATE_URL = "https://api.github.com/repos/webcomics/dosage/releases/latest"
def check_update():
"""Return the following values:
(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 ''
return u"cls('%s', '%s'%s)," % (name, path, langopt)
if __name__ == '__main__':
CreatorsUpdater(__file__).run()

View file

@ -2,7 +2,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-2017 Tobias Gruetzmacher
'''update languages.py from pycountry'''
from __future__ import absolute_import, division, print_function
@ -24,6 +24,7 @@ def main():
f.write('# -*- coding: %s -*-%s' % (encoding, 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('from __future__ import absolute_import, division, print_function%s' % os.linesep)
lang = get_used_languages()
write_languages(f, lang)

View file

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

View file

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# 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 subprocess

View file

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

View file

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

View file

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

View file

@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# 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 re