Browse Source

fix pylint

pull/254/head
oliverpool 8 years ago
parent
commit
6ec5b1064b
  1. 8
      patacrep/content/__init__.py
  2. 2
      patacrep/content/section.py
  3. 2
      patacrep/content/setcounter.py
  4. 4
      patacrep/content/song.py
  5. 2
      patacrep/content/songsection.py
  6. 2
      patacrep/files.py
  7. 4
      patacrep/songbook/__main__.py
  8. 4
      patacrep/songs/chordpro/lexer.py
  9. 2
      patacrep/songs/latex/__init__.py
  10. 2
      pylintrc
  11. 2
      setup.py
  12. 2
      test/dynamic.py
  13. 2
      test/test_doctest.py

8
patacrep/content/__init__.py

@ -82,7 +82,7 @@ class ContentItem:
here. here.
""" """
def render(self, __context): def render(self, context):
"""Render this content item. """Render this content item.
Returns a string, to be placed verbatim in the generated .tex file. Returns a string, to be placed verbatim in the generated .tex file.
@ -91,7 +91,7 @@ class ContentItem:
# Block management # 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. """Return a boolean stating if a new block is to be created.
# Arguments # Arguments
@ -108,11 +108,11 @@ class ContentItem:
""" """
return True return True
def begin_block(self, __context): def begin_block(self, context):
"""Return the string to begin a block.""" """Return the string to begin a block."""
return "" return ""
def end_block(self, __context): def end_block(self, context):
"""Return the string to end a block.""" """Return the string to end a block."""
return "" return ""

2
patacrep/content/section.py

@ -22,7 +22,7 @@ class Section(ContentItem):
self.name = name self.name = name
self.short = short self.short = short
def render(self, __context): def render(self, context):
if self.short is None or self.keyword not in KEYWORDS: if self.short is None or self.keyword not in KEYWORDS:
return r'\{}{{{}}}'.format(self.keyword, self.name) return r'\{}{{{}}}'.format(self.keyword, self.name)
else: else:

2
patacrep/content/setcounter.py

@ -10,7 +10,7 @@ class CounterSetter(ContentItem):
self.name = name self.name = name
self.value = value self.value = value
def render(self, __context): def render(self, context):
"""Set the value of the counter.""" """Set the value of the counter."""
return r'\setcounter{{{}}}{{{}}}'.format(self.name, self.value) return r'\setcounter{{{}}}{{{}}}'.format(self.name, self.value)

4
patacrep/content/song.py

@ -30,7 +30,7 @@ class SongRenderer(ContentItem):
return True return True
return False 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 a boolean stating if a new block is to be created."""
return not isinstance(previous, SongRenderer) return not isinstance(previous, SongRenderer)
@ -41,7 +41,7 @@ class SongRenderer(ContentItem):
indexes = "" indexes = ""
return r'\begin{songs}{%s}' % 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 the string to end a block."""
return r'\end{songs}' return r'\end{songs}'

2
patacrep/content/songsection.py

@ -15,7 +15,7 @@ class SongSection(ContentItem):
self.keyword = keyword self.keyword = keyword
self.name = name self.name = name
def render(self, __context): def render(self, context):
"""Render this section or chapter.""" """Render this section or chapter."""
return r'\{}{{{}}}'.format(self.keyword, self.name) return r'\{}{{{}}}'.format(self.keyword, self.name)

2
patacrep/files.py

@ -34,7 +34,7 @@ def recursive_find(root_directory, extensions=None):
pattern = re.compile(r'.*\.({})$'.format('|'.join(extensions))) pattern = re.compile(r'.*\.({})$'.format('|'.join(extensions)))
with chdir(root_directory): 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: for filename in filenames:
if pattern.match(filename): if pattern.match(filename):
matches.append(os.path.join(root, filename)) matches.append(os.path.join(root, filename))

4
patacrep/songbook/__main__.py

@ -19,7 +19,7 @@ LOGGER = logging.getLogger()
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods
class ParseStepsAction(argparse.Action): class ParseStepsAction(argparse.Action):
"""Argparse action to split a string into a list.""" """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): if not getattr(namespace, self.dest):
setattr(namespace, self.dest, []) setattr(namespace, self.dest, [])
setattr( setattr(
@ -33,7 +33,7 @@ class ParseStepsAction(argparse.Action):
class VerboseAction(argparse.Action): class VerboseAction(argparse.Action):
"""Set verbosity level with option --verbose.""" """Set verbosity level with option --verbose."""
def __call__(self, *_args, **_kwargs): def __call__(self, parser, namespace, values, option_string=None):
LOGGER.setLevel(logging.DEBUG) LOGGER.setLevel(logging.DEBUG)
def yesno_type(string): def yesno_type(string):

4
patacrep/songs/chordpro/lexer.py

@ -121,11 +121,11 @@ class ChordProLexer:
r'[^{}\\\r\n\]\[\t ]+' r'[^{}\\\r\n\]\[\t ]+'
return token return token
def t_LBRACKET(self, __token): def t_LBRACKET(self, token):
r'\[' r'\['
self.lexer.push_state('chord') self.lexer.push_state('chord')
def t_chord_RBRACKET(self, __token): def t_chord_RBRACKET(self, token):
r'\]' r'\]'
self.lexer.pop_state() self.lexer.pop_state()

2
patacrep/songs/latex/__init__.py

@ -29,7 +29,7 @@ class Latex2LatexSong(Song):
else: else:
self.authors = [] self.authors = []
def render(self): def render(self, *args, **kwargs):
"""Return the code rendering the song.""" """Return the code rendering the song."""
# pylint: disable=signature-differs # pylint: disable=signature-differs
filename = os.path.basename(self.fullpath) filename = os.path.basename(self.fullpath)

2
pylintrc

@ -169,7 +169,7 @@ enable=import-error,
logging-too-few-args, logging-too-few-args,
logging-too-many-args, logging-too-many-args,
logging-unsupported-format, logging-unsupported-format,
logging-format-interpolation, # logging-format-interpolation,
invalid-unary-operand-type, invalid-unary-operand-type,
unsupported-binary-operation, unsupported-binary-operation,
not-callable, not-callable,

2
setup.py

@ -30,7 +30,7 @@ if sys.platform[0:3] == 'win':
olddir = os.getcwd() olddir = os.getcwd()
os.chdir(root_directory) 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: for filename in filenames:
yield os.path.join(root, filename) yield os.path.join(root, filename)
os.chdir(olddir) os.chdir(olddir)

2
test/dynamic.py

@ -13,7 +13,7 @@ class DynamicTest(type):
def __init__(cls, name, bases, nmspc): def __init__(cls, name, bases, nmspc):
super().__init__(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) setattr(cls, methodname, testmethod)
def _iter_testmethods(cls): def _iter_testmethods(cls):

2
test/test_doctest.py

@ -22,7 +22,7 @@ import doctest
import patacrep import patacrep
from patacrep import files from patacrep import files
def load_tests(__loader, tests, __pattern): def load_tests(loader, tests, pattern):
"""Load tests (doctests). """Load tests (doctests).
""" """
# Loading doctests # Loading doctests

Loading…
Cancel
Save