Clean up some minor warnings

This commit is contained in:
Tobias Gruetzmacher 2022-05-28 17:52:42 +02:00
parent 805befe40c
commit f3b8ebf0be
17 changed files with 40 additions and 42 deletions

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2015-2022 Tobias Gruetzmacher
import argparse
import contextlib
import os
@ -139,15 +139,15 @@ def display_version(verbose):
# display update link
text = ('A new version %(version)s of %(app)s is '
'available at %(url)s.')
attrs = dict(version=version, app=AppName,
url=url, currentversion=__version__)
attrs = {'version': version, 'app': AppName,
'url': url, 'currentversion': __version__}
print(text % attrs)
else:
if value is None:
value = 'invalid update file syntax'
text = ('An error occured while checking for an '
'update of %(app)s: %(error)s.')
attrs = dict(error=value, app=AppName)
attrs = {'error': value, 'app': AppName}
print(text % attrs)
return 0

View file

@ -103,8 +103,8 @@ class Output(object):
def writelines(self, lines, level=0):
"""Write multiple messages."""
for line in lines:
for line in line.rstrip(u'\n').split(u'\n'):
self.write(line.rstrip(u'\n'), level=level)
for sline in line.rstrip(u'\n').split(u'\n'):
self.write(sline.rstrip(u'\n'), level=level)
@property
def width(self):

View file

@ -1,14 +1,14 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2021 Tobias Gruetzmacher
# Copyright (C) 2015-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile, escape, MULTILINE
from ..util import tagre
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import regexNamer, bounceStarter, indirectStarter
from .common import _WordPressScraper, _WPNavi, _WPNaviIn, _WPWebcomic
from .common import _WordPressScraper, _WPNavi, _WPWebcomic
class AbstruseGoose(_ParserScraper):

View file

@ -10,7 +10,6 @@ class Derideal(_ParserScraper):
imageSearch = '//img[contains(@class, "comic-page")]'
prevSearch = '//a[i[contains(@class, "fa-angle-left")]]'
latestSearch = '//a[i[contains(@class, "fa-angle-double-right")]]'
starter = indirectStarter
def __init__(self, name, sub, first, last=None):
if name == 'Derideal':

View file

@ -1,12 +1,12 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2021 Tobias Gruetzmacher
# Copyright (C) 2015-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile, escape
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import bounceStarter, indirectStarter
from ..helpers import indirectStarter
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi

View file

@ -1,14 +1,13 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2015-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile, escape
from ..helpers import indirectStarter
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from .common import _WordPressScraper, _WPNavi, _WPWebcomic
from .common import _WordPressScraper, _WPNavi
class IAmArg(_BasicScraper):

View file

@ -1,5 +1,5 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from ..scraper import _ParserScraper
@ -25,7 +25,7 @@ class KemonoCafe(_ParserScraper):
def namer(self, imageUrl, pageUrl):
# Strip date from filenames
filename = imageUrl.rsplit('/', 1)[-1]
if not 'ultrarosa' in pageUrl:
if 'ultrarosa' not in pageUrl:
if filename[4] == '-' and filename[7] == '-':
filename = filename[10:]
if filename[0] == '-' or filename[0] == '_':

View file

@ -86,7 +86,8 @@ class MangaDex(_ParserScraper):
def namer(self, imageUrl, pageUrl):
# Construct filename from episode number and page index in array
chapterNum = self.chapter['attributes']['chapter'] if self.chapter['attributes']['chapter'] != None else 0
chapter = self.chapter['attributes']['chapter']
chapterNum = chapter if chapter is not None else 0
pageNum = self.imageUrls.index(imageUrl)
pageExt = imageUrl.rsplit('.')[-1]
return '%s-%02d.%s' % (chapterNum, pageNum, pageExt)

View file

@ -49,11 +49,12 @@ class RickGriffinStudios(_WPNaviIn):
'ah-club-2-cover': 'ah-club-1-page-24',
'ah-club-3-cover': 'ah-club-2-page-28',
'ah-club-4-cover': 'ah-club-3-page-22',
'ah-club-5-cover': 'ah-club-4-page-24'
'ah-club-5-cover': 'ah-club-4-page-24',
}),
cls('HayvenCelestia', 'hayven-celestia', 'skinchange-p1'),
cls('TheStoryboard', 'the-storyboard', 'the-storyboard-001'),
cls('TracesOfThePast', 'in-the-new-age', 'totp-page-1'),
cls('TracesOfThePastNSFW', 'in-the-new-age', 'totp-page-1-nsfw', adult=True),
cls('ZootopiaNightTerrors', 'zootopia-night-terrors', 'zootopia-night-terrors-p1', 'zootopia-night-terrors-p7'),
cls('ZootopiaNightTerrors', 'zootopia-night-terrors',
'zootopia-night-terrors-p1', 'zootopia-night-terrors-p7'),
)

View file

@ -6,12 +6,10 @@
from re import compile, escape, IGNORECASE, sub
from os.path import splitext
from requests.exceptions import HTTPError
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter, bounceStarter, joinPathPartsNamer
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPNaviIn, _WPWebcomic
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic
class SabrinaOnline(_BasicScraper):
@ -313,7 +311,7 @@ class SMBC(_ComicControlScraper):
url = 'https://www.smbc-comics.com/'
stripUrl = url + 'comic/%s'
firstStripUrl = stripUrl % '2002-09-05'
imageSearch = ['//img[@id="cc-comic"]', '//div[@id="aftercomic"]/img']
imageSearch = ('//img[@id="cc-comic"]', '//div[@id="aftercomic"]/img')
textSearch = '//img[@id="cc-comic"]/@title'
multipleImagesPerStrip = True

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2015-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile, escape, MULTILINE
try:
@ -12,7 +12,7 @@ except ImportError:
from ..scraper import _BasicScraper, _ParserScraper
from ..helpers import indirectStarter
from ..util import tagre
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPNaviIn, _WPWebcomic
from .common import _ComicControlScraper, _WordPressScraper, _WPNavi, _WPWebcomic
class TailsAndTactics(_ParserScraper):
@ -53,6 +53,7 @@ class TheBrads(_ParserScraper):
multipleImagesPerStrip = True
endOfLife = True
class TheChroniclesOfHuxcyn(_WordPressScraper):
url = 'https://huxcyn.com/'
stripUrl = url + 'comic/%s'

View file

@ -1,8 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from ..scraper import _ParserScraper
from ..helpers import indirectStarter
class Tapastic(_ParserScraper):

View file

@ -1,14 +1,14 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2015-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from re import compile, escape, IGNORECASE
from ..scraper import _BasicScraper, _ParserScraper
from ..util import tagre
from ..helpers import bounceStarter
from .common import _ComicControlScraper, _WPNavi, _WPNaviIn, _WPWebcomic
from .common import _ComicControlScraper, _WPNaviIn, _WPWebcomic
class WapsiSquare(_WPNaviIn):

View file

@ -1,7 +1,7 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2020 Tobias Gruetzmacher
# Copyright (C) 2015-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from .common import _WordPressScraper, _WPWebcomic
@ -16,6 +16,7 @@ class YAFGC(_WordPressScraper):
super().__init__(name)
self.session.add_throttle('www.yafgc.net', 3.0, 15.5)
class YoshSaga(_WPWebcomic):
url = 'https://www.yoshsaga.com/'
stripUrl = url + 'comic/%s/'

View file

@ -118,14 +118,14 @@ def tagre(tag, attribute, value, quote='"', before="", after=""):
prefix = r"[^>]*%s[^>]*\s+" % before
else:
prefix = r"(?:[^>]*\s+)?"
attrs = dict(
tag=case_insensitive_re(tag),
attribute=case_insensitive_re(attribute),
value=value,
quote=quote,
prefix=prefix,
after=after,
)
attrs = {
'tag': case_insensitive_re(tag),
'attribute': case_insensitive_re(attribute),
'value': value,
'quote': quote,
'prefix': prefix,
'after': after,
}
return (r'<\s*%(tag)s\s+%(prefix)s' +
r'%(attribute)s\s*=\s*%(quote)s%(value)s%(quote)' +
r's[^>]*%(after)s[^>]*>') % attrs
@ -308,7 +308,7 @@ at %(url)s and include at least the information below:
Not disclosing some of the information below due to privacy reasons is ok.
I will try to help you nonetheless, but you have to give me something
I can work with ;) .
""" % dict(app=AppName, url=SupportUrl), file=out)
""" % {'app': AppName, 'url': SupportUrl}, file=out)
if etype is None:
etype = sys.exc_info()[0]
if evalue is None:

View file

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2022 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
"""
Script to get a list of Tapastic comics and save the info in a
@ -9,7 +9,6 @@ JSON file for further processing.
from urllib.parse import urlsplit, parse_qs
from scriptutil import ComicListUpdater
from dosagelib.util import check_robotstxt
class TapasticUpdater(ComicListUpdater):

View file

@ -52,6 +52,6 @@ class LoadModScheduling(LoadScopeScheduling):
return mod + "::" + test.split("/", 1)[0]
@pytest.mark.trylast
@pytest.mark.trylast()
def pytest_xdist_make_scheduler(config, log):
return LoadModScheduling(config, log)