From 6ec5b1064b274cb49faaf6d16cc2e3e74fd21777 Mon Sep 17 00:00:00 2001 From: oliverpool Date: Sun, 4 Jun 2017 11:37:54 +0200 Subject: [PATCH] fix pylint --- patacrep/content/__init__.py | 8 ++++---- patacrep/content/section.py | 2 +- patacrep/content/setcounter.py | 2 +- patacrep/content/song.py | 4 ++-- patacrep/content/songsection.py | 2 +- patacrep/files.py | 2 +- patacrep/songbook/__main__.py | 4 ++-- patacrep/songs/chordpro/lexer.py | 4 ++-- patacrep/songs/latex/__init__.py | 2 +- pylintrc | 2 +- setup.py | 2 +- test/dynamic.py | 2 +- test/test_doctest.py | 2 +- 13 files changed, 19 insertions(+), 19 deletions(-) diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index 12e9bed9..27c26691 100755 --- a/patacrep/content/__init__.py +++ b/patacrep/content/__init__.py @@ -82,7 +82,7 @@ class ContentItem: here. """ - def render(self, __context): + def render(self, context): """Render this content item. Returns a string, to be placed verbatim in the generated .tex file. @@ -91,7 +91,7 @@ class ContentItem: # Block management - def begin_new_block(self, __previous, __context): + def begin_new_block(self, previous, context): """Return a boolean stating if a new block is to be created. # Arguments @@ -108,11 +108,11 @@ class ContentItem: """ return True - def begin_block(self, __context): + def begin_block(self, context): """Return the string to begin a block.""" return "" - def end_block(self, __context): + def end_block(self, context): """Return the string to end a block.""" return "" diff --git a/patacrep/content/section.py b/patacrep/content/section.py index 78776d5c..c045d8c5 100755 --- a/patacrep/content/section.py +++ b/patacrep/content/section.py @@ -22,7 +22,7 @@ class Section(ContentItem): self.name = name self.short = short - def render(self, __context): + def render(self, context): if self.short is None or self.keyword not in KEYWORDS: return r'\{}{{{}}}'.format(self.keyword, self.name) else: diff --git a/patacrep/content/setcounter.py b/patacrep/content/setcounter.py index 400ce26b..ca0d9bc7 100755 --- a/patacrep/content/setcounter.py +++ b/patacrep/content/setcounter.py @@ -10,7 +10,7 @@ class CounterSetter(ContentItem): self.name = name self.value = value - def render(self, __context): + def render(self, context): """Set the value of the counter.""" return r'\setcounter{{{}}}{{{}}}'.format(self.name, self.value) diff --git a/patacrep/content/song.py b/patacrep/content/song.py index dc35b5ae..9708556e 100755 --- a/patacrep/content/song.py +++ b/patacrep/content/song.py @@ -30,7 +30,7 @@ class SongRenderer(ContentItem): return True return False - def begin_new_block(self, previous, __context): + def begin_new_block(self, previous, context): """Return a boolean stating if a new block is to be created.""" return not isinstance(previous, SongRenderer) @@ -41,7 +41,7 @@ class SongRenderer(ContentItem): indexes = "" return r'\begin{songs}{%s}' % indexes - def end_block(self, __context): + def end_block(self, context): """Return the string to end a block.""" return r'\end{songs}' diff --git a/patacrep/content/songsection.py b/patacrep/content/songsection.py index 132c0666..f9d17593 100755 --- a/patacrep/content/songsection.py +++ b/patacrep/content/songsection.py @@ -15,7 +15,7 @@ class SongSection(ContentItem): self.keyword = keyword self.name = name - def render(self, __context): + def render(self, context): """Render this section or chapter.""" return r'\{}{{{}}}'.format(self.keyword, self.name) diff --git a/patacrep/files.py b/patacrep/files.py index 114513d4..22d9cb44 100644 --- a/patacrep/files.py +++ b/patacrep/files.py @@ -34,7 +34,7 @@ def recursive_find(root_directory, extensions=None): pattern = re.compile(r'.*\.({})$'.format('|'.join(extensions))) with chdir(root_directory): - for root, __ignored, filenames in os.walk(os.curdir): + for root, _, filenames in os.walk(os.curdir): for filename in filenames: if pattern.match(filename): matches.append(os.path.join(root, filename)) diff --git a/patacrep/songbook/__main__.py b/patacrep/songbook/__main__.py index 6793b6f1..94b0b2d3 100644 --- a/patacrep/songbook/__main__.py +++ b/patacrep/songbook/__main__.py @@ -19,7 +19,7 @@ LOGGER = logging.getLogger() # pylint: disable=too-few-public-methods class ParseStepsAction(argparse.Action): """Argparse action to split a string into a list.""" - def __call__(self, __parser, namespace, values, __option_string=None): + def __call__(self, parser, namespace, values, option_string=None): if not getattr(namespace, self.dest): setattr(namespace, self.dest, []) setattr( @@ -33,7 +33,7 @@ class ParseStepsAction(argparse.Action): class VerboseAction(argparse.Action): """Set verbosity level with option --verbose.""" - def __call__(self, *_args, **_kwargs): + def __call__(self, parser, namespace, values, option_string=None): LOGGER.setLevel(logging.DEBUG) def yesno_type(string): diff --git a/patacrep/songs/chordpro/lexer.py b/patacrep/songs/chordpro/lexer.py index c63049aa..535fe889 100644 --- a/patacrep/songs/chordpro/lexer.py +++ b/patacrep/songs/chordpro/lexer.py @@ -121,11 +121,11 @@ class ChordProLexer: r'[^{}\\\r\n\]\[\t ]+' return token - def t_LBRACKET(self, __token): + def t_LBRACKET(self, token): r'\[' self.lexer.push_state('chord') - def t_chord_RBRACKET(self, __token): + def t_chord_RBRACKET(self, token): r'\]' self.lexer.pop_state() diff --git a/patacrep/songs/latex/__init__.py b/patacrep/songs/latex/__init__.py index 27100eba..ddae6a28 100644 --- a/patacrep/songs/latex/__init__.py +++ b/patacrep/songs/latex/__init__.py @@ -29,7 +29,7 @@ class Latex2LatexSong(Song): else: self.authors = [] - def render(self): + def render(self, *args, **kwargs): """Return the code rendering the song.""" # pylint: disable=signature-differs filename = os.path.basename(self.fullpath) diff --git a/pylintrc b/pylintrc index 85f14cbf..87d023b0 100644 --- a/pylintrc +++ b/pylintrc @@ -169,7 +169,7 @@ enable=import-error, logging-too-few-args, logging-too-many-args, logging-unsupported-format, - logging-format-interpolation, + # logging-format-interpolation, invalid-unary-operand-type, unsupported-binary-operation, not-callable, diff --git a/setup.py b/setup.py index aedd2009..4e9230d2 100755 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ if sys.platform[0:3] == 'win': olddir = os.getcwd() os.chdir(root_directory) - for root, __ignored, filenames in os.walk(os.curdir): + for root, _, filenames in os.walk(os.curdir): for filename in filenames: yield os.path.join(root, filename) os.chdir(olddir) diff --git a/test/dynamic.py b/test/dynamic.py index 494dfc8f..4313f23a 100644 --- a/test/dynamic.py +++ b/test/dynamic.py @@ -13,7 +13,7 @@ class DynamicTest(type): def __init__(cls, name, bases, nmspc): super().__init__(name, bases, nmspc) - for methodname, testmethod in cls._iter_testmethods(): + for methodname, testmethod in cls._iter_testmethods(): #pylint: disable=no-value-for-parameter setattr(cls, methodname, testmethod) def _iter_testmethods(cls): diff --git a/test/test_doctest.py b/test/test_doctest.py index 98175716..f101bbc1 100644 --- a/test/test_doctest.py +++ b/test/test_doctest.py @@ -22,7 +22,7 @@ import doctest import patacrep from patacrep import files -def load_tests(__loader, tests, __pattern): +def load_tests(loader, tests, pattern): """Load tests (doctests). """ # Loading doctests