pyflakes/pep8 fixes

This commit is contained in:
Martin A. Brown 2016-03-01 22:53:07 -08:00
parent 78e67c0e6c
commit ee88d451a8
3 changed files with 15 additions and 11 deletions

View File

@ -89,8 +89,9 @@ def build(config, docs, **kwargs):
return 1 return 1
# def script(config, docs, inv, **kwargs): def script(config, docs, inv, **kwargs):
# return 0 raise NotImplementedError
return 0
def getDocumentNames(args): def getDocumentNames(args):
@ -245,7 +246,7 @@ def run(argv):
if not config.sourcedir: if not config.sourcedir:
return " --sourcedir (and --pubdir) required for inventory." return " --sourcedir (and --pubdir) required for inventory."
inv = tldp.inventory.Inventory(config.pubdir, config.sourcedir) inv = tldp.inventory.Inventory(config.pubdir, config.sourcedir)
logger.info("Collected inventory containing %s documents.", logger.info("Collected inventory containing %s documents.",
len(inv.all.keys())) len(inv.all.keys()))
else: else:
inv = None inv = None
@ -285,7 +286,7 @@ def run(argv):
if not workset: if not workset:
logger.info("No work to do.") logger.info("No work to do.")
return 0 return 0
# -- listify the set and sort it # -- listify the set and sort it
# #
docs = sorted(workset, key=lambda x: x.stem.lower()) docs = sorted(workset, key=lambda x: x.stem.lower())

View File

@ -8,11 +8,12 @@ import sys
import errno import errno
import shutil import shutil
import logging import logging
logger = logging.getLogger(__name__)
from tldp.ldpcollection import LDPDocumentCollection from tldp.ldpcollection import LDPDocumentCollection
from tldp.utils import logdir, statfiles from tldp.utils import logdir, statfiles
logger = logging.getLogger(__name__)
class OutputNamingConvention(object): class OutputNamingConvention(object):
'''A base class inherited by OutputDirectory to ensure consistent '''A base class inherited by OutputDirectory to ensure consistent
@ -166,8 +167,8 @@ class OutputCollection(LDPDocumentCollection):
'''construct an OutputCollection '''construct an OutputCollection
If dirname is not supplied, OutputCollection is basically, a dict(). If dirname is not supplied, OutputCollection is basically, a dict().
If dirname is supplied, then OutputCollection scans the filesystem If dirname is supplied, then OutputCollection scans the filesystem for
for subdirectories of dirname and creates an OutputDirectory for each subdirectories of dirname and creates an OutputDirectory for each
subdir. Each subdir name is used as the stem (or key) for holding the subdir. Each subdir name is used as the stem (or key) for holding the
OutputDirectory in the OutputCollection. OutputDirectory in the OutputCollection.

View File

@ -164,8 +164,9 @@ class SourceDocument(object):
self.filename = os.path.abspath(filename) self.filename = os.path.abspath(filename)
if not os.path.exists(self.filename): if not os.path.exists(self.filename):
logger.critical("Missing source document: %s", self.filename) fn = self.filename
raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), self.filename) logger.critical("Missing source document: %s", fn)
raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), fn)
if os.path.isdir(self.filename): if os.path.isdir(self.filename):
self.filename = sourcedoc_fromdir(self.filename) self.filename = sourcedoc_fromdir(self.filename)
@ -176,8 +177,9 @@ class SourceDocument(object):
self.filename = None self.filename = None
if self.filename is None: if self.filename is None:
logger.critical("Source document is not a plain file: %s", filename) fn = filename
raise ValueError(filename + " not identifiable as a document") logger.critical("Source document is not a plain file: %s", fn)
raise ValueError(fn + " not identifiable as a document")
self.doctype = guess(self.filename) self.doctype = guess(self.filename)
self.status = 'source' self.status = 'source'