Kenneth Reitz’s Code Style™

See http://docs.python-requests.org/en/master/dev/contributing/#kenneth-reitz-s-code-style

Effectively, this removes "visual" indents.
This commit is contained in:
Tobias Gruetzmacher 2018-06-29 19:26:17 +02:00
parent 2850420303
commit 6ba1e49bfd
8 changed files with 55 additions and 53 deletions

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
@ -249,7 +249,8 @@ def do_list(column_list=True, verbose=False, listall=False):
"""List available comics.""" """List available comics."""
with out.pager(): with out.pager():
out.info(u'Available comic scrapers:') out.info(u'Available comic scrapers:')
out.info(u'Comics tagged with [%s] require age confirmation with the --adult option.' % TAG_ADULT) out.info(u'Comics tagged with [{}] require age confirmation'
' with the --adult option.'.format(TAG_ADULT))
out.info(u'Non-english comics are tagged with [%s].' % TAG_LANG) out.info(u'Non-english comics are tagged with [%s].' % TAG_LANG)
scrapers = sorted(scraper.get_scrapers(listall), scrapers = sorted(scraper.get_scrapers(listall),
key=lambda s: s.name.lower()) key=lambda s: s.name.lower())
@ -260,7 +261,8 @@ def do_list(column_list=True, verbose=False, listall=False):
out.info(u'%d supported comics.' % num) out.info(u'%d supported comics.' % num)
if disabled: if disabled:
out.info('') out.info('')
out.info(u'Some comics are disabled, they are tagged with [%s:REASON], where REASON is one of:' % TAG_DISABLED) out.info(u'Some comics are disabled, they are tagged with'
' [{}:REASON], where REASON is one of:'.format(TAG_DISABLED))
for k in disabled: for k in disabled:
out.info(u' %-10s %s' % (k, disabled[k])) out.info(u' %-10s %s' % (k, disabled[k]))
return 0 return 0

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

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

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
@ -85,7 +85,7 @@ def _check_strip(outdir, strip, multipleImagesPerStrip):
files.append(fn) files.append(fn)
assert images, 'failed to find images at %s' % strip.strip_url assert images, 'failed to find images at %s' % strip.strip_url
if not multipleImagesPerStrip: if not multipleImagesPerStrip:
assert len(images) == 1, 'found more than 1 image at %s: %s' % ( assert len(images) == 1, 'found more than 1 image at {}: {}'.format(
strip.strip_url, images) strip.strip_url, images)
return files return files
@ -114,6 +114,6 @@ def _check_stripurl(strip, scraperobj):
urlmatch = "^%s$" % urlmatch urlmatch = "^%s$" % urlmatch
ro = re.compile(urlmatch) ro = re.compile(urlmatch)
mo = ro.search(strip.strip_url) mo = ro.search(strip.strip_url)
err = 'strip URL %r does not match stripUrl pattern %s' % ( err = 'strip URL {!r} does not match stripUrl pattern {}'.format(
strip.strip_url, urlmatch) strip.strip_url, urlmatch)
assert mo is not None, err assert mo is not None, err

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
@ -23,8 +23,8 @@ class TestURL(object):
def test_normalisation(self): def test_normalisation(self):
# Test URL normalisation. # Test URL normalisation.
assert normaliseURL('http://example.com//bar/baz&baz') == \ assert (normaliseURL('http://example.com//bar/baz&baz') ==
u'http://example.com/bar/baz&baz' u'http://example.com/bar/baz&baz')
class TestRegex(object): class TestRegex(object):

View file

@ -32,7 +32,7 @@ deps =
[flake8] [flake8]
# we aim for 79, but this suppresses warnings for now... # we aim for 79, but this suppresses warnings for now...
max-line-length = 120 max-line-length = 120
ignore = E121,E126,E241,FI12,FI14,FI15,FI50,FI51,FI53,FI54,FI55 ignore = E127,E128,E241,FI12,FI14,FI15,FI50,FI51,FI53,FI54,FI55
require-code = True require-code = True
min-version = 2.7 min-version = 2.7