Merge "Fix H404/405 violations for tools"
diff --git a/tools/check_uuid.py b/tools/check_uuid.py
index e21c3d8..a71ad39 100755
--- a/tools/check_uuid.py
+++ b/tools/check_uuid.py
@@ -114,10 +114,8 @@
@staticmethod
def _get_idempotent_id(test_node):
- """
- Return key-value dict with all metadata from @test.idempotent_id
- decorators for test method
- """
+ # Return key-value dict with all metadata from @test.idempotent_id
+ # decorators for test method
idempotent_id = None
for decorator in test_node.decorator_list:
if (hasattr(decorator, 'func') and
@@ -264,8 +262,9 @@
return self._filter_tests(check_uuid_in_meta, tests)
def report_collisions(self, tests):
- """Reports collisions if there are any. Returns true if
- collisions exist.
+ """Reports collisions if there are any.
+
+ Returns true if collisions exist.
"""
uuids = {}
@@ -298,8 +297,9 @@
return bool(self._filter_tests(report, tests))
def report_untagged(self, tests):
- """Reports untagged tests if there are any. Returns true if
- untagged tests exist.
+ """Reports untagged tests if there are any.
+
+ Returns true if untagged tests exist.
"""
def report(module_name, test_name, tests):
error_str = "%s:%s\nmissing @test.idempotent_id('...')\n%s\n" % (
@@ -312,9 +312,7 @@
return bool(self._filter_tests(report, tests))
def fix_tests(self, tests):
- """Add uuids to all tests specified in tests and
- fix it in source files
- """
+ """Add uuids to all tests specified in tests and fix it"""
patcher = SourcePatcher()
for module_name in tests:
add_import_once = True
diff --git a/tools/colorizer.py b/tools/colorizer.py
index e7152f2..3f68a51 100755
--- a/tools/colorizer.py
+++ b/tools/colorizer.py
@@ -50,9 +50,9 @@
class _AnsiColorizer(object):
- """
- A colorizer is an object that loosely wraps around a stream, allowing
- callers to write text to the stream in a particular color.
+ """A colorizer is an object that loosely wraps around a stream
+
+ allowing callers to write text to the stream in a particular color.
Colorizer classes must implement C{supported()} and C{write(text, color)}.
"""
@@ -63,7 +63,8 @@
self.stream = stream
def supported(cls, stream=sys.stdout):
- """
+ """Check the current platform supports coloring terminal output
+
A class method that returns True if the current platform supports
coloring terminal output using this method. Returns False otherwise.
"""
@@ -86,8 +87,7 @@
supported = classmethod(supported)
def write(self, text, color):
- """
- Write the given text to the stream in the given color.
+ """Write the given text to the stream in the given color.
@param text: Text to be written to the stream.
@@ -98,9 +98,7 @@
class _Win32Colorizer(object):
- """
- See _AnsiColorizer docstring.
- """
+ """See _AnsiColorizer docstring."""
def __init__(self, stream):
import win32console
red, green, blue, bold = (win32console.FOREGROUND_RED,
@@ -146,9 +144,7 @@
class _NullColorizer(object):
- """
- See _AnsiColorizer docstring.
- """
+ """See _AnsiColorizer docstring."""
def __init__(self, stream):
self.stream = stream
diff --git a/tools/skip_tracker.py b/tools/skip_tracker.py
index 50f33eb..a47e217 100755
--- a/tools/skip_tracker.py
+++ b/tools/skip_tracker.py
@@ -40,7 +40,8 @@
def find_skips(start=TESTDIR):
- """
+ """Find skipped tests
+
Returns a list of tuples (method, bug) that represent
test methods that have been decorated to skip because of
a particular bug.
@@ -67,9 +68,7 @@
def find_skips_in_file(path):
- """
- Return the skip tuples in a test file
- """
+ """Return the skip tuples in a test file"""
BUG_RE = re.compile(r'\s*@.*skip_because\(bug=[\'"](\d+)[\'"]')
DEF_RE = re.compile(r'\s*def (\w+)\(')
bug_found = False