From ee88d451a8c63bfe1043c4d4019fbfcab9072ff9 Mon Sep 17 00:00:00 2001 From: "Martin A. Brown" Date: Tue, 1 Mar 2016 22:53:07 -0800 Subject: [PATCH] pyflakes/pep8 fixes --- tldp/driver.py | 9 +++++---- tldp/outputs.py | 7 ++++--- tldp/sources.py | 10 ++++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tldp/driver.py b/tldp/driver.py index e2e9b3a..44fa52c 100644 --- a/tldp/driver.py +++ b/tldp/driver.py @@ -89,8 +89,9 @@ def build(config, docs, **kwargs): return 1 -# def script(config, docs, inv, **kwargs): -# return 0 +def script(config, docs, inv, **kwargs): + raise NotImplementedError + return 0 def getDocumentNames(args): @@ -245,7 +246,7 @@ def run(argv): if not config.sourcedir: return " --sourcedir (and --pubdir) required for inventory." 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())) else: inv = None @@ -285,7 +286,7 @@ def run(argv): if not workset: logger.info("No work to do.") return 0 - + # -- listify the set and sort it # docs = sorted(workset, key=lambda x: x.stem.lower()) diff --git a/tldp/outputs.py b/tldp/outputs.py index 4902b1c..f0c736a 100644 --- a/tldp/outputs.py +++ b/tldp/outputs.py @@ -8,11 +8,12 @@ import sys import errno import shutil import logging -logger = logging.getLogger(__name__) from tldp.ldpcollection import LDPDocumentCollection from tldp.utils import logdir, statfiles +logger = logging.getLogger(__name__) + class OutputNamingConvention(object): '''A base class inherited by OutputDirectory to ensure consistent @@ -166,8 +167,8 @@ class OutputCollection(LDPDocumentCollection): '''construct an OutputCollection If dirname is not supplied, OutputCollection is basically, a dict(). - If dirname is supplied, then OutputCollection scans the filesystem - for subdirectories of dirname and creates an OutputDirectory for each + If dirname is supplied, then OutputCollection scans the filesystem for + subdirectories of dirname and creates an OutputDirectory for each subdir. Each subdir name is used as the stem (or key) for holding the OutputDirectory in the OutputCollection. diff --git a/tldp/sources.py b/tldp/sources.py index 9837d3b..5aff94e 100644 --- a/tldp/sources.py +++ b/tldp/sources.py @@ -164,8 +164,9 @@ class SourceDocument(object): self.filename = os.path.abspath(filename) if not os.path.exists(self.filename): - logger.critical("Missing source document: %s", self.filename) - raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), self.filename) + fn = self.filename + logger.critical("Missing source document: %s", fn) + raise IOError(errno.ENOENT, os.strerror(errno.ENOENT), fn) if os.path.isdir(self.filename): self.filename = sourcedoc_fromdir(self.filename) @@ -176,8 +177,9 @@ class SourceDocument(object): self.filename = None if self.filename is None: - logger.critical("Source document is not a plain file: %s", filename) - raise ValueError(filename + " not identifiable as a document") + fn = filename + 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.status = 'source'