Browse Source

Restoring authorship annotation for <asatarin@yandex-team.ru>. Commit 2 of 2.

asatarin 3 years ago
parent
commit
ca04a55631

+ 79 - 79
build/scripts/coverage-info.py

@@ -12,18 +12,18 @@ GCNO_EXT = '.gcno'
 
 
 def suffixes(path):
-    """ 
-    >>> list(suffixes('/a/b/c')) 
-    ['c', 'b/c', '/a/b/c'] 
-    >>> list(suffixes('/a/b/c/')) 
-    ['c', 'b/c', '/a/b/c'] 
-    >>> list(suffixes('/a')) 
-    ['/a'] 
-    >>> list(suffixes('/a/')) 
-    ['/a'] 
-    >>> list(suffixes('/')) 
-    [] 
-    """ 
+    """
+    >>> list(suffixes('/a/b/c'))
+    ['c', 'b/c', '/a/b/c']
+    >>> list(suffixes('/a/b/c/'))
+    ['c', 'b/c', '/a/b/c']
+    >>> list(suffixes('/a'))
+    ['/a']
+    >>> list(suffixes('/a/'))
+    ['/a']
+    >>> list(suffixes('/'))
+    []
+    """
     path = os.path.normpath(path)
 
     def up_dirs(cur_path):
@@ -85,21 +85,21 @@ def print_stat(da, fnda, teamcity_stat_output):
             tc_file.write("##teamcity[blockClosed name='Code Coverage Summary']\n")
 
 
-def chunks(l, n): 
-    """ 
-    >>> list(chunks(range(10), 3)) 
-    [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]] 
-    >>> list(chunks(range(10), 5)) 
-    [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]] 
-    """ 
-    for i in xrange(0, len(l), n): 
-        yield l[i:i + n] 
- 
- 
+def chunks(l, n):
+    """
+    >>> list(chunks(range(10), 3))
+    [[0, 1, 2], [3, 4, 5], [6, 7, 8], [9]]
+    >>> list(chunks(range(10), 5))
+    [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]
+    """
+    for i in xrange(0, len(l), n):
+        yield l[i:i + n]
+
+
 def combine_info_files(lcov, files, out_file):
     chunk_size = 50
     files = list(set(files))
- 
+
     for chunk in chunks(files, chunk_size):
         combine_cmd = [lcov]
         if os.path.exists(out_file):
@@ -116,39 +116,39 @@ def combine_info_files(lcov, files, out_file):
         os.rename(out_file_tmp, out_file)
 
 
-def probe_path_global(path, source_root, prefix_filter, exclude_files): 
-    if path.endswith('_ut.cpp'): 
+def probe_path_global(path, source_root, prefix_filter, exclude_files):
+    if path.endswith('_ut.cpp'):
         return None
 
-    for suff in reversed(list(suffixes(path))): 
-        if (not prefix_filter or suff.startswith(prefix_filter)) and (not exclude_files or not exclude_files.match(suff)): 
-            full_path = source_root + os.sep + suff 
-            if os.path.isfile(full_path): 
-                return full_path 
-
-    return None 
-
-
-def update_stat_global(src_file, line, fnda, da): 
-    if line.startswith("FNDA:"): 
-        visits, func_name = line[len("FNDA:"):].split(',') 
-        fnda[src_file + func_name] += int(visits) 
- 
-    if line.startswith("DA"): 
-        line_number, visits = line[len("DA:"):].split(',') 
-        if visits == '=====': 
-            visits = 0 
- 
-        da[src_file + line_number] += int(visits) 
- 
- 
-def gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args): 
-    print >>sys.stderr, '## geninfo', ' '.join(cmd) 
-    subprocess.check_call(cmd) 
-    if recast(cov_info + '.tmp', cov_info, probe_path, update_stat): 
-        lcov_args.append(cov_info) 
- 
- 
+    for suff in reversed(list(suffixes(path))):
+        if (not prefix_filter or suff.startswith(prefix_filter)) and (not exclude_files or not exclude_files.match(suff)):
+            full_path = source_root + os.sep + suff
+            if os.path.isfile(full_path):
+                return full_path
+
+    return None
+
+
+def update_stat_global(src_file, line, fnda, da):
+    if line.startswith("FNDA:"):
+        visits, func_name = line[len("FNDA:"):].split(',')
+        fnda[src_file + func_name] += int(visits)
+
+    if line.startswith("DA"):
+        line_number, visits = line[len("DA:"):].split(',')
+        if visits == '=====':
+            visits = 0
+
+        da[src_file + line_number] += int(visits)
+
+
+def gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args):
+    print >>sys.stderr, '## geninfo', ' '.join(cmd)
+    subprocess.check_call(cmd)
+    if recast(cov_info + '.tmp', cov_info, probe_path, update_stat):
+        lcov_args.append(cov_info)
+
+
 def init_all_coverage_files(gcno_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info, prefix_filter, exclude_files):
     with tarfile.open(gcno_archive) as gcno_tf:
         for gcno_item in gcno_tf:
@@ -177,8 +177,8 @@ def init_all_coverage_files(gcno_archive, fname2gcno, fname2info, geninfo_execut
                     ]
                     gen_info(geninfo_cmd, coverage_info)
 
- 
-def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info): 
+
+def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info):
     with tarfile.open(gcda_archive) as gcda_tf:
         for gcda_item in gcda_tf:
             if gcda_item.isfile() and gcda_item.name.endswith(GCDA_EXT):
@@ -200,7 +200,7 @@ def process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_exe
                             ]
                             gen_info(geninfo_cmd, coverage_info)
 
- 
+
 def gen_cobertura(tool, output, combined_info):
     cmd = [
         tool,
@@ -215,28 +215,28 @@ def gen_cobertura(tool, output, combined_info):
 
 
 def main(source_root, output, gcno_archive, gcda_archive, gcov_tool, prefix_filter, exclude_regexp, teamcity_stat_output, coverage_report_path, gcov_report, lcov_cobertura):
-    exclude_files = re.compile(exclude_regexp) if exclude_regexp else None 
- 
-    fname2gcno = {} 
-    fname2info = collections.defaultdict(list) 
-    lcov_args = [] 
-    geninfo_executable = os.path.join(source_root, 'devtools', 'lcov', 'geninfo') 
- 
-    def probe_path(path): 
-        return probe_path_global(path, source_root, prefix_filter, exclude_files) 
- 
-    fnda = collections.defaultdict(int) 
-    da = collections.defaultdict(int) 
- 
-    def update_stat(src_file, line): 
-        update_stat_global(src_file, line, da, fnda) 
- 
-    def gen_info(cmd, cov_info): 
-        gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args) 
- 
+    exclude_files = re.compile(exclude_regexp) if exclude_regexp else None
+
+    fname2gcno = {}
+    fname2info = collections.defaultdict(list)
+    lcov_args = []
+    geninfo_executable = os.path.join(source_root, 'devtools', 'lcov', 'geninfo')
+
+    def probe_path(path):
+        return probe_path_global(path, source_root, prefix_filter, exclude_files)
+
+    fnda = collections.defaultdict(int)
+    da = collections.defaultdict(int)
+
+    def update_stat(src_file, line):
+        update_stat_global(src_file, line, da, fnda)
+
+    def gen_info(cmd, cov_info):
+        gen_info_global(cmd, cov_info, probe_path, update_stat, lcov_args)
+
     init_all_coverage_files(gcno_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info, prefix_filter, exclude_files)
-    process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info) 
- 
+    process_all_coverage_files(gcda_archive, fname2gcno, fname2info, geninfo_executable, gcov_tool, gen_info)
+
     if coverage_report_path:
         output_dir = coverage_report_path
     else:

+ 1 - 1
contrib/libs/crcutil/interface.cc

@@ -28,7 +28,7 @@ static size_t kAlign = 4 * 1024;
 
 using namespace crcutil;
 
-#if (!defined(__clang__) && defined(__GNUC__)) 
+#if (!defined(__clang__) && defined(__GNUC__))
 // Suppress 'invalid access to non-static data member ...  of NULL object'
 #undef offsetof
 #define offsetof(TYPE, MEMBER) (reinterpret_cast <size_t> \

+ 27 - 27
contrib/python/PyHamcrest/LICENSE.txt

@@ -1,27 +1,27 @@
-BSD License 
- 
-Copyright 2011 hamcrest.org 
-All rights reserved. 
- 
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are met: 
- 
-Redistributions of source code must retain the above copyright notice, this list of 
-conditions and the following disclaimer. Redistributions in binary form must reproduce 
-the above copyright notice, this list of conditions and the following disclaimer in 
-the documentation and/or other materials provided with the distribution. 
- 
-Neither the name of Hamcrest nor the names of its contributors may be used to endorse 
-or promote products derived from this software without specific prior written 
-permission. 
- 
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY 
-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
-DAMAGE. 
+BSD License
+
+Copyright 2011 hamcrest.org
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of
+conditions and the following disclaimer. Redistributions in binary form must reproduce
+the above copyright notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the distribution.
+
+Neither the name of Hamcrest nor the names of its contributors may be used to endorse
+or promote products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
+WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.

+ 6 - 6
contrib/python/PyHamcrest/src/hamcrest/__init__.py

@@ -1,8 +1,8 @@
-from __future__ import absolute_import 
-from hamcrest.core import * 
-from hamcrest.library import * 
- 
+from __future__ import absolute_import
+from hamcrest.core import *
+from hamcrest.library import *
+
 __version__ = "1.9.0"
-__author__ = "Chris Rose" 
+__author__ = "Chris Rose"
 __copyright__ = "Copyright 2015 hamcrest.org"
-__license__ = "BSD, see License.txt" 
+__license__ = "BSD, see License.txt"

+ 7 - 7
contrib/python/PyHamcrest/src/hamcrest/core/__init__.py

@@ -1,7 +1,7 @@
-from __future__ import absolute_import 
-from hamcrest.core.assert_that import assert_that 
-from hamcrest.core.core import * 
- 
-__author__ = "Jon Reid" 
-__copyright__ = "Copyright 2011 hamcrest.org" 
-__license__ = "BSD, see License.txt" 
+from __future__ import absolute_import
+from hamcrest.core.assert_that import assert_that
+from hamcrest.core.core import *
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"

+ 64 - 64
contrib/python/PyHamcrest/src/hamcrest/core/assert_that.py

@@ -1,64 +1,64 @@
-from __future__ import absolute_import 
-from hamcrest.core.matcher import Matcher 
-from hamcrest.core.string_description import StringDescription 
- 
-__author__ = "Jon Reid" 
-__copyright__ = "Copyright 2011 hamcrest.org" 
-__license__ = "BSD, see License.txt" 
-# unittest integration; hide these frames from tracebacks 
-__unittest = True 
-# py.test integration; hide these frames from tracebacks 
-__tracebackhide__ = True 
- 
-def assert_that(arg1, arg2=None, arg3=''): 
-    """Asserts that actual value satisfies matcher. (Can also assert plain 
-    boolean condition.) 
- 
-    :param actual: The object to evaluate as the actual value. 
-    :param matcher: The matcher to satisfy as the expected condition. 
-    :param reason: Optional explanation to include in failure description. 
- 
-    ``assert_that`` passes the actual value to the matcher for evaluation. If 
-    the matcher is not satisfied, an exception is thrown describing the 
-    mismatch. 
- 
-    ``assert_that`` is designed to integrate well with PyUnit and other unit 
-    testing frameworks. The exception raised for an unmet assertion is an 
-    :py:exc:`AssertionError`, which PyUnit reports as a test failure. 
- 
-    With a different set of parameters, ``assert_that`` can also verify a 
-    boolean condition: 
- 
-    .. function:: assert_that(assertion[, reason]) 
- 
-    :param assertion:  Boolean condition to verify. 
-    :param reason:  Optional explanation to include in failure description. 
- 
-    This is equivalent to the :py:meth:`~unittest.TestCase.assertTrue` method 
-    of :py:class:`unittest.TestCase`, but offers greater flexibility in test 
-    writing by being a standalone function. 
- 
-    """ 
-    if isinstance(arg2, Matcher): 
-        _assert_match(actual=arg1, matcher=arg2, reason=arg3) 
-    else: 
-        _assert_bool(assertion=arg1, reason=arg2) 
- 
- 
-def _assert_match(actual, matcher, reason): 
-    if not matcher.matches(actual): 
-        description = StringDescription() 
-        description.append_text(reason)             \ 
-                   .append_text('\nExpected: ')     \ 
-                   .append_description_of(matcher)  \ 
-                   .append_text('\n     but: ') 
-        matcher.describe_mismatch(actual, description) 
-        description.append_text('\n') 
-        raise AssertionError(description) 
- 
- 
-def _assert_bool(assertion, reason=None): 
-    if not assertion: 
-        if not reason: 
-            reason = 'Assertion failed' 
-        raise AssertionError(reason) 
+from __future__ import absolute_import
+from hamcrest.core.matcher import Matcher
+from hamcrest.core.string_description import StringDescription
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+# unittest integration; hide these frames from tracebacks
+__unittest = True
+# py.test integration; hide these frames from tracebacks
+__tracebackhide__ = True
+
+def assert_that(arg1, arg2=None, arg3=''):
+    """Asserts that actual value satisfies matcher. (Can also assert plain
+    boolean condition.)
+
+    :param actual: The object to evaluate as the actual value.
+    :param matcher: The matcher to satisfy as the expected condition.
+    :param reason: Optional explanation to include in failure description.
+
+    ``assert_that`` passes the actual value to the matcher for evaluation. If
+    the matcher is not satisfied, an exception is thrown describing the
+    mismatch.
+
+    ``assert_that`` is designed to integrate well with PyUnit and other unit
+    testing frameworks. The exception raised for an unmet assertion is an
+    :py:exc:`AssertionError`, which PyUnit reports as a test failure.
+
+    With a different set of parameters, ``assert_that`` can also verify a
+    boolean condition:
+
+    .. function:: assert_that(assertion[, reason])
+
+    :param assertion:  Boolean condition to verify.
+    :param reason:  Optional explanation to include in failure description.
+
+    This is equivalent to the :py:meth:`~unittest.TestCase.assertTrue` method
+    of :py:class:`unittest.TestCase`, but offers greater flexibility in test
+    writing by being a standalone function.
+
+    """
+    if isinstance(arg2, Matcher):
+        _assert_match(actual=arg1, matcher=arg2, reason=arg3)
+    else:
+        _assert_bool(assertion=arg1, reason=arg2)
+
+
+def _assert_match(actual, matcher, reason):
+    if not matcher.matches(actual):
+        description = StringDescription()
+        description.append_text(reason)             \
+                   .append_text('\nExpected: ')     \
+                   .append_description_of(matcher)  \
+                   .append_text('\n     but: ')
+        matcher.describe_mismatch(actual, description)
+        description.append_text('\n')
+        raise AssertionError(description)
+
+
+def _assert_bool(assertion, reason=None):
+    if not assertion:
+        if not reason:
+            reason = 'Assertion failed'
+        raise AssertionError(reason)

+ 92 - 92
contrib/python/PyHamcrest/src/hamcrest/core/base_description.py

@@ -1,92 +1,92 @@
-from __future__ import absolute_import 
-__author__ = "Jon Reid" 
-__copyright__ = "Copyright 2011 hamcrest.org" 
-__license__ = "BSD, see License.txt" 
- 
-import warnings 
-import six 
- 
-from hamcrest.core.description import Description 
-from hamcrest.core.selfdescribingvalue import SelfDescribingValue 
-from hamcrest.core.helpers.hasmethod import hasmethod 
- 
-class BaseDescription(Description): 
-    """Base class for all :py:class:`~hamcrest.core.description.Description` 
-    implementations. 
- 
-    """ 
- 
-    def append_text(self, text): 
-        self.append(text) 
-        return self 
- 
-    def append_description_of(self, value): 
-        if hasmethod(value, 'describe_to'): 
-            value.describe_to(self) 
-        elif six.PY3 and isinstance(value, six.text_type): 
-            self.append(repr(value)) 
-        elif six.PY2 and isinstance(value, six.binary_type): 
-            self.append_string_in_python_syntax(value) 
-        elif isinstance(value, six.text_type): 
-            self.append_string_in_python_syntax(value) 
-        else: 
-            description = str(value) 
-            if description[:1] == '<' and description[-1:] == '>': 
-                self.append(description) 
-            else: 
-                self.append('<') 
-                self.append(description) 
-                self.append('>') 
-        return self 
- 
-    def append_value(self, value): 
-        warnings.warn('Call append_description_of instead of append_value', 
-                      DeprecationWarning) 
-        if isinstance(value, str): 
-            self.append_string_in_python_syntax(value) 
-        else: 
-            self.append('<') 
-            self.append(str(value)) 
-            self.append('>') 
-        return self 
- 
-    def append_value_list(self, start, separator, end, list): 
-        warnings.warn('Call append_list instead of append_value_list', 
-                      DeprecationWarning) 
-        return self.append_list(start, separator, end, 
-                                map(SelfDescribingValue, list)) 
- 
-    def append_list(self, start, separator, end, list): 
-        separate = False 
- 
-        self.append(start) 
-        for item in list: 
-            if separate: 
-                self.append(separator) 
-            self.append_description_of(item) 
-            separate = True 
-        self.append(end) 
-        return self 
- 
-    def append(self, string): 
-        """Append the string to the description.""" 
-        raise NotImplementedError('append') 
- 
-    def append_string_in_python_syntax(self, string): 
-        self.append("'") 
-        for ch in string: 
-            self.append(character_in_python_syntax(ch)) 
-        self.append("'") 
- 
- 
-def character_in_python_syntax(ch): 
-    if ch == "'": 
-        return "\'" 
-    elif ch == '\n': 
-        return '\\n' 
-    elif ch == '\r': 
-        return '\\r' 
-    elif ch == '\t': 
-        return '\\t' 
-    else: 
-        return ch 
+from __future__ import absolute_import
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+import warnings
+import six
+
+from hamcrest.core.description import Description
+from hamcrest.core.selfdescribingvalue import SelfDescribingValue
+from hamcrest.core.helpers.hasmethod import hasmethod
+
+class BaseDescription(Description):
+    """Base class for all :py:class:`~hamcrest.core.description.Description`
+    implementations.
+
+    """
+
+    def append_text(self, text):
+        self.append(text)
+        return self
+
+    def append_description_of(self, value):
+        if hasmethod(value, 'describe_to'):
+            value.describe_to(self)
+        elif six.PY3 and isinstance(value, six.text_type):
+            self.append(repr(value))
+        elif six.PY2 and isinstance(value, six.binary_type):
+            self.append_string_in_python_syntax(value)
+        elif isinstance(value, six.text_type):
+            self.append_string_in_python_syntax(value)
+        else:
+            description = str(value)
+            if description[:1] == '<' and description[-1:] == '>':
+                self.append(description)
+            else:
+                self.append('<')
+                self.append(description)
+                self.append('>')
+        return self
+
+    def append_value(self, value):
+        warnings.warn('Call append_description_of instead of append_value',
+                      DeprecationWarning)
+        if isinstance(value, str):
+            self.append_string_in_python_syntax(value)
+        else:
+            self.append('<')
+            self.append(str(value))
+            self.append('>')
+        return self
+
+    def append_value_list(self, start, separator, end, list):
+        warnings.warn('Call append_list instead of append_value_list',
+                      DeprecationWarning)
+        return self.append_list(start, separator, end,
+                                map(SelfDescribingValue, list))
+
+    def append_list(self, start, separator, end, list):
+        separate = False
+
+        self.append(start)
+        for item in list:
+            if separate:
+                self.append(separator)
+            self.append_description_of(item)
+            separate = True
+        self.append(end)
+        return self
+
+    def append(self, string):
+        """Append the string to the description."""
+        raise NotImplementedError('append')
+
+    def append_string_in_python_syntax(self, string):
+        self.append("'")
+        for ch in string:
+            self.append(character_in_python_syntax(ch))
+        self.append("'")
+
+
+def character_in_python_syntax(ch):
+    if ch == "'":
+        return "\'"
+    elif ch == '\n':
+        return '\\n'
+    elif ch == '\r':
+        return '\\r'
+    elif ch == '\t':
+        return '\\t'
+    else:
+        return ch

+ 34 - 34
contrib/python/PyHamcrest/src/hamcrest/core/base_matcher.py

@@ -1,34 +1,34 @@
-from __future__ import absolute_import 
-__author__ = "Jon Reid" 
-__copyright__ = "Copyright 2011 hamcrest.org" 
-__license__ = "BSD, see License.txt" 
- 
-from hamcrest.core.matcher import Matcher 
-from hamcrest.core.string_description import tostring 
- 
- 
-class BaseMatcher(Matcher): 
-    """Base class for all :py:class:`~hamcrest.core.matcher.Matcher` 
-    implementations. 
- 
-    Most implementations can just implement :py:obj:`_matches`, leaving the 
-    handling of any mismatch description to the ``matches`` method. But if it 
-    makes more sense to generate the mismatch description during the matching, 
-    override :py:meth:`~hamcrest.core.matcher.Matcher.matches` instead. 
- 
-    """ 
- 
-    def __str__(self): 
-        return tostring(self) 
- 
-    def _matches(self, item): 
-        raise NotImplementedError('_matches') 
- 
-    def matches(self, item, mismatch_description=None): 
-        match_result = self._matches(item) 
-        if not match_result and mismatch_description: 
-            self.describe_mismatch(item, mismatch_description) 
-        return match_result 
- 
-    def describe_mismatch(self, item, mismatch_description): 
-        mismatch_description.append_text('was ').append_description_of(item) 
+from __future__ import absolute_import
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+from hamcrest.core.matcher import Matcher
+from hamcrest.core.string_description import tostring
+
+
+class BaseMatcher(Matcher):
+    """Base class for all :py:class:`~hamcrest.core.matcher.Matcher`
+    implementations.
+
+    Most implementations can just implement :py:obj:`_matches`, leaving the
+    handling of any mismatch description to the ``matches`` method. But if it
+    makes more sense to generate the mismatch description during the matching,
+    override :py:meth:`~hamcrest.core.matcher.Matcher.matches` instead.
+
+    """
+
+    def __str__(self):
+        return tostring(self)
+
+    def _matches(self, item):
+        raise NotImplementedError('_matches')
+
+    def matches(self, item, mismatch_description=None):
+        match_result = self._matches(item)
+        if not match_result and mismatch_description:
+            self.describe_mismatch(item, mismatch_description)
+        return match_result
+
+    def describe_mismatch(self, item, mismatch_description):
+        mismatch_description.append_text('was ').append_description_of(item)

+ 19 - 19
contrib/python/PyHamcrest/src/hamcrest/core/compat.py

@@ -1,19 +1,19 @@
-__author__ = "Per Fagrell" 
-__copyright__ = "Copyright 2013 hamcrest.org" 
-__license__ = "BSD, see License.txt" 
- 
-__all__ = ['is_callable'] 
- 
-import sys 
- 
-# callable was not part of py3k until 3.2, so we create this 
-# generic is_callable to use callable if possible, otherwise 
-# we use generic homebrew. 
-if sys.version_info[0] == 3 and sys.version_info[1] < 2: 
-    def is_callable(function): 
-        """Return whether the object is callable (i.e., some kind of function).""" 
-        if function is None: 
-            return False 
-        return any("__call__" in klass.__dict__ for klass in type(function).__mro__) 
-else: 
-    is_callable = callable 
+__author__ = "Per Fagrell"
+__copyright__ = "Copyright 2013 hamcrest.org"
+__license__ = "BSD, see License.txt"
+
+__all__ = ['is_callable']
+
+import sys
+
+# callable was not part of py3k until 3.2, so we create this
+# generic is_callable to use callable if possible, otherwise
+# we use generic homebrew.
+if sys.version_info[0] == 3 and sys.version_info[1] < 2:
+    def is_callable(function):
+        """Return whether the object is callable (i.e., some kind of function)."""
+        if function is None:
+            return False
+        return any("__call__" in klass.__dict__ for klass in type(function).__mro__)
+else:
+    is_callable = callable

+ 18 - 18
contrib/python/PyHamcrest/src/hamcrest/core/core/__init__.py

@@ -1,18 +1,18 @@
-from __future__ import absolute_import 
-"""Fundamental matchers of objects and values, and composite matchers.""" 
- 
-from hamcrest.core.core.allof import all_of 
-from hamcrest.core.core.anyof import any_of 
-from hamcrest.core.core.described_as import described_as 
-from hamcrest.core.core.is_ import is_ 
-from hamcrest.core.core.isanything import anything 
-from hamcrest.core.core.isequal import equal_to 
-from hamcrest.core.core.isinstanceof import instance_of 
-from hamcrest.core.core.isnone import none, not_none 
-from hamcrest.core.core.isnot import is_not, not_ 
-from hamcrest.core.core.issame import same_instance 
-from hamcrest.core.core.raises import calling, raises 
- 
-__author__ = "Jon Reid" 
-__copyright__ = "Copyright 2011 hamcrest.org" 
-__license__ = "BSD, see License.txt" 
+from __future__ import absolute_import
+"""Fundamental matchers of objects and values, and composite matchers."""
+
+from hamcrest.core.core.allof import all_of
+from hamcrest.core.core.anyof import any_of
+from hamcrest.core.core.described_as import described_as
+from hamcrest.core.core.is_ import is_
+from hamcrest.core.core.isanything import anything
+from hamcrest.core.core.isequal import equal_to
+from hamcrest.core.core.isinstanceof import instance_of
+from hamcrest.core.core.isnone import none, not_none
+from hamcrest.core.core.isnot import is_not, not_
+from hamcrest.core.core.issame import same_instance
+from hamcrest.core.core.raises import calling, raises
+
+__author__ = "Jon Reid"
+__copyright__ = "Copyright 2011 hamcrest.org"
+__license__ = "BSD, see License.txt"

Some files were not shown because too many files changed in this diff