/usr/share/pyshared/hamcrest/core/compat.py is in python-hamcrest 1.8.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 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
|