diff --git a/tools/argparse.py b/tools/argparse.py
index 32d948c03..fd7e23fed 100644
--- a/tools/argparse.py
+++ b/tools/argparse.py
@@ -130,7 +130,9 @@ _UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args'
# Utility functions and classes
# =============================
+
class _AttributeHolder(object):
+
"""Abstract base class that provides __repr__.
The __repr__ method returns a string in the format::
@@ -166,6 +168,7 @@ def _ensure_value(namespace, name, value):
# ===============
class HelpFormatter(object):
+
"""Formatter for generating usage messages and argument help strings.
Only the name of this class is considered a public API. All the methods
@@ -639,13 +642,14 @@ class HelpFormatter(object):
def _fill_text(self, text, width, indent):
text = self._whitespace_matcher.sub(' ', text).strip()
return _textwrap.fill(text, width, initial_indent=indent,
- subsequent_indent=indent)
+ subsequent_indent=indent)
def _get_help_string(self, action):
return action.help
class RawDescriptionHelpFormatter(HelpFormatter):
+
"""Help message formatter which retains any formatting in descriptions.
Only the name of this class is considered a public API. All the methods
@@ -657,6 +661,7 @@ class RawDescriptionHelpFormatter(HelpFormatter):
class RawTextHelpFormatter(RawDescriptionHelpFormatter):
+
"""Help message formatter which retains formatting of all help text.
Only the name of this class is considered a public API. All the methods
@@ -668,6 +673,7 @@ class RawTextHelpFormatter(RawDescriptionHelpFormatter):
class ArgumentDefaultsHelpFormatter(HelpFormatter):
+
"""Help message formatter which adds default values to argument help.
Only the name of this class is considered a public API. All the methods
@@ -692,7 +698,7 @@ def _get_action_name(argument):
if argument is None:
return None
elif argument.option_strings:
- return '/'.join(argument.option_strings)
+ return '/'.join(argument.option_strings)
elif argument.metavar not in (None, SUPPRESS):
return argument.metavar
elif argument.dest not in (None, SUPPRESS):
@@ -702,6 +708,7 @@ def _get_action_name(argument):
class ArgumentError(Exception):
+
"""An error from creating or using an argument (optional or positional).
The string value of this exception is the message, augmented with
@@ -722,6 +729,7 @@ class ArgumentError(Exception):
class ArgumentTypeError(Exception):
+
"""An error from trying to convert a command line string to a type."""
pass
@@ -731,6 +739,7 @@ class ArgumentTypeError(Exception):
# ==============
class Action(_AttributeHolder):
+
"""Information about how to convert command line strings to Python objects.
Action objects are used by an ArgumentParser to represent the information
@@ -1108,7 +1117,8 @@ class _SubParsersAction(Action):
# parse all the remaining options into the namespace
# store any unrecognized options on the object, so that the top
# level parser can decide what to do with them
- namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)
+ namespace, arg_strings = parser.parse_known_args(
+ arg_strings, namespace)
if arg_strings:
vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, [])
getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings)
@@ -1119,6 +1129,7 @@ class _SubParsersAction(Action):
# ==============
class FileType(object):
+
"""Factory for creating file object types
Instances of FileType are typically passed as type= arguments to the
@@ -1161,7 +1172,9 @@ class FileType(object):
# Optional and Positional Parsing
# ===========================
+
class Namespace(_AttributeHolder):
+
"""Simple object for storing attributes.
Implements equality by attribute names and values, and provides a simple
@@ -1263,7 +1276,6 @@ class _ActionsContainer(object):
return action.default
return self._defaults.get(dest, None)
-
# =======================
# Adding argument actions
# =======================
@@ -1535,6 +1547,7 @@ class _MutuallyExclusiveGroup(_ArgumentGroup):
class ArgumentParser(_AttributeHolder, _ActionsContainer):
+
"""Object for parsing command line strings into Python objects.
Keyword Arguments:
@@ -1610,12 +1623,12 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
default_prefix = prefix_chars[0]
if self.add_help:
self.add_argument(
- default_prefix+'h', default_prefix*2+'help',
+ default_prefix + 'h', default_prefix * 2 + 'help',
action='help', default=SUPPRESS,
help=_('show this help message and exit'))
if self.version:
self.add_argument(
- default_prefix+'v', default_prefix*2+'version',
+ default_prefix + 'v', default_prefix * 2 + 'version',
action='version', default=SUPPRESS,
version=self.version,
help=_("show program's version number and exit"))
@@ -2075,7 +2088,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# if multiple actions match, the option string was ambiguous
if len(option_tuples) > 1:
options = ', '.join([option_string
- for action, option_string, explicit_arg in option_tuples])
+ for action, option_string, explicit_arg in option_tuples])
tup = arg_string, options
self.error(_('ambiguous option: %s could match %s') % tup)
diff --git a/tools/daca2-report.py b/tools/daca2-report.py
index 2e1aa958d..2a7d2b7cd 100644
--- a/tools/daca2-report.py
+++ b/tools/daca2-report.py
@@ -2,33 +2,34 @@
import os
import sys
+
def readdate(data):
- datepos = -1
- if data[:5] == 'DATE ':
- datepos = 0
- else:
- datepos = data.find('\nDATE ')
- if datepos >= 0:
- datepos = datepos + 1
+ datepos = -1
+ if data[:5] == 'DATE ':
+ datepos = 0
+ else:
+ datepos = data.find('\nDATE ')
+ if datepos >= 0:
+ datepos = datepos + 1
- if datepos < 0:
- return None
+ if datepos < 0:
+ return None
- datestr = ''
- datepos = datepos + 5
- while True:
- if datepos >= len(data):
- return None
- d = data[datepos]
- if d>='0' and d<='9':
- datestr = datestr + d
- elif d=='\n':
- if len(datestr) == 8:
- return datestr[:4] + '-' + datestr[4:6] + '-' + datestr[6:]
- return None
- elif d!=' ' and d!='-':
- return None
- datepos = datepos + 1
+ datestr = ''
+ datepos = datepos + 5
+ while True:
+ if datepos >= len(data):
+ return None
+ d = data[datepos]
+ if d >= '0' and d <= '9':
+ datestr = datestr + d
+ elif d == '\n':
+ if len(datestr) == 8:
+ return datestr[:4] + '-' + datestr[4:6] + '-' + datestr[6:]
+ return None
+ elif d != ' ' and d != '-':
+ return None
+ datepos = datepos + 1
path = '.'
if len(sys.argv) == 2:
@@ -46,47 +47,48 @@ recent = []
daca2 = os.path.expanduser('~/daca2/')
for lib in range(2):
- for a in "0123456789abcdefghijklmnopqrstuvwxyz":
- if lib == 1:
- a = "lib" + a
- if os.path.isfile(daca2 + a + '/results.txt'):
- f = open(daca2 + a + '/results.txt', 'rt')
- data = f.read()
- f.close()
+ for a in "0123456789abcdefghijklmnopqrstuvwxyz":
+ if lib == 1:
+ a = "lib" + a
+ if os.path.isfile(daca2 + a + '/results.txt'):
+ f = open(daca2 + a + '/results.txt', 'rt')
+ data = f.read()
+ f.close()
- datestr = readdate(data)
- if datestr:
- if not lastupdate or datestr > lastupdate:
- lastupdate = datestr
- recent = []
- if datestr == lastupdate:
- recent.append(a)
+ datestr = readdate(data)
+ if datestr:
+ if not lastupdate or datestr > lastupdate:
+ lastupdate = datestr
+ recent = []
+ if datestr == lastupdate:
+ recent.append(a)
- mainpage.write(''+a+'
\n')
+ mainpage.write(
+ '' + a + '
\n')
- data = data.replace('&', ' ')
- data = data.replace('<', '<')
- data = data.replace('>', '>')
- data = data.replace('\'', ''')
- data = data.replace('"', '"')
- data = data.replace('\n', '\n')
+ data = data.replace('&', ' ')
+ data = data.replace('<', '<')
+ data = data.replace('>', '>')
+ data = data.replace('\'', ''')
+ data = data.replace('"', '"')
+ data = data.replace('\n', '\n')
- f = open(path+'/daca2-'+a+'.html', 'wt')
- f.write('\n')
- f.write('
\n' + data + '\n') - f.write('\n') - f.write('\n') - f.close() + f = open(path + '/daca2-' + a + '.html', 'wt') + f.write('\n') + f.write('
\n' + data + '\n') + f.write('\n') + f.write('\n') + f.close() if lastupdate: - mainpage.write('
Last update: ' + lastupdate + '
') - allrecent = '' - for r in recent: - allrecent = allrecent + ' ' + r + '' - mainpage.write('Most recently updated: ' + allrecent + '
') + mainpage.write('Last update: ' + lastupdate + '
') + allrecent = '' + for r in recent: + allrecent = allrecent + ' ' + r + '' + mainpage.write('Most recently updated: ' + allrecent + '
') mainpage.write('