mirror of https://github.com/tLDP/python-tldp
pyflakes/pep8 adjustments
This commit is contained in:
parent
dec201f50c
commit
53c476cebc
|
@ -7,4 +7,4 @@ import tldp.outputs
|
||||||
import tldp.sources
|
import tldp.sources
|
||||||
import tldp.inventory
|
import tldp.inventory
|
||||||
|
|
||||||
VERSION="0.7.11"
|
VERSION = "0.7.11"
|
||||||
|
|
|
@ -31,7 +31,7 @@ signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||||
|
|
||||||
logformat = '%(levelname)-9s %(name)s %(filename)s#%(lineno)s ' \
|
logformat = '%(levelname)-9s %(name)s %(filename)s#%(lineno)s ' \
|
||||||
+ '%(funcName)s %(message)s'
|
+ '%(funcName)s %(message)s'
|
||||||
logging.basicConfig(stream=sys.stderr, format=logformat, level=logging.ERROR)
|
logging.basicConfig(stream=sys.stderr, format=logformat, level=logging.ERROR)
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ def summary(config, *args, **kwargs):
|
||||||
width.doctype = max([len(x.__name__) for x in knowndoctypes])
|
width.doctype = max([len(x.__name__) for x in knowndoctypes])
|
||||||
width.status = max([len(x) for x in status_types])
|
width.status = max([len(x) for x in status_types])
|
||||||
width.count = len(str(len(inv.source.keys())))
|
width.count = len(str(len(inv.source.keys())))
|
||||||
print('By Document Status (STATUS)', '---------------------------',
|
print('By Document Status (STATUS)', '---------------------------',
|
||||||
sep='\n', file=file)
|
sep='\n', file=file)
|
||||||
for status in status_types:
|
for status in status_types:
|
||||||
count = len(getattr(inv, status, 0))
|
count = len(getattr(inv, status, 0))
|
||||||
|
@ -129,7 +129,7 @@ def summary(config, *args, **kwargs):
|
||||||
if abbrev:
|
if abbrev:
|
||||||
s = s + ', and %d more ...' % (len(abbrev))
|
s = s + ', and %d more ...' % (len(abbrev))
|
||||||
print(s, file=file)
|
print(s, file=file)
|
||||||
print('', 'By Document Type (DOCTYPE)', '--------------------------',
|
print('', 'By Document Type (DOCTYPE)', '--------------------------',
|
||||||
sep='\n', file=file)
|
sep='\n', file=file)
|
||||||
summarybytype = collections.defaultdict(list)
|
summarybytype = collections.defaultdict(list)
|
||||||
for doc in inv.source.values():
|
for doc in inv.source.values():
|
||||||
|
@ -274,7 +274,7 @@ def docbuild(config, docs, **kwargs):
|
||||||
for x, source in enumerate(docs, 1):
|
for x, source in enumerate(docs, 1):
|
||||||
working = source.working
|
working = source.working
|
||||||
runner = source.doctype(source=source, output=working, config=config)
|
runner = source.doctype(source=source, output=working, config=config)
|
||||||
status = 'progress, %d failures, %d successes'
|
status = 'progress, %d failures, %d successes'
|
||||||
status = status % (result.count(False), result.count(True),)
|
status = status % (result.count(False), result.count(True),)
|
||||||
logger.info("%s (%d of %d) initiating build [%s]",
|
logger.info("%s (%d of %d) initiating build [%s]",
|
||||||
source.stem, x, len(docs), status)
|
source.stem, x, len(docs), status)
|
||||||
|
|
|
@ -71,8 +71,7 @@ class Inventory(object):
|
||||||
len(self.orphan),
|
len(self.orphan),
|
||||||
len(self.new),
|
len(self.new),
|
||||||
len(self.stale),
|
len(self.stale),
|
||||||
len(self.broken),
|
len(self.broken),)
|
||||||
)
|
|
||||||
|
|
||||||
def __init__(self, pubdir, sourcedirs):
|
def __init__(self, pubdir, sourcedirs):
|
||||||
'''construct an Inventory
|
'''construct an Inventory
|
||||||
|
|
|
@ -284,6 +284,7 @@ def md5files(name, relative=None):
|
||||||
'''get all of the MD5s for files from here downtree'''
|
'''get all of the MD5s for files from here downtree'''
|
||||||
return fileinfo(name, relative=relative, func=md5file)
|
return fileinfo(name, relative=relative, func=md5file)
|
||||||
|
|
||||||
|
|
||||||
def statfiles(name, relative=None):
|
def statfiles(name, relative=None):
|
||||||
'''
|
'''
|
||||||
>>> statfiles('./docs/x509').keys()
|
>>> statfiles('./docs/x509').keys()
|
||||||
|
@ -295,6 +296,7 @@ def statfiles(name, relative=None):
|
||||||
'''
|
'''
|
||||||
return fileinfo(name, relative=relative, func=statfile)
|
return fileinfo(name, relative=relative, func=statfile)
|
||||||
|
|
||||||
|
|
||||||
def fileinfo(name, relative=None, func=statfile):
|
def fileinfo(name, relative=None, func=statfile):
|
||||||
'''return a dict() with keys being filenames and posix.stat_result values
|
'''return a dict() with keys being filenames and posix.stat_result values
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue