/usr/lib/python2.7/dist-packages/nameparser/util.py is in python-nameparser 0.5.6-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 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import logging
# http://code.google.com/p/python-nameparser/issues/detail?id=10
log = logging.getLogger('HumanName')
try:
log.addHandler(logging.NullHandler())
except AttributeError:
class NullHandler(logging.Handler):
def emit(self, record):
pass
log.addHandler(NullHandler())
log.setLevel(logging.ERROR)
import sys
if sys.version_info[0] < 3:
text_type = unicode
binary_type = str
def u(x, encoding=None):
if encoding:
return unicode(x, encoding)
else:
return unicode(x)
else:
text_type = str
binary_type = bytes
def u(x, encoding=None):
return text_type(x)
text_types = (text_type, binary_type)
def lc(value):
"""Lower case and remove any periods to normalize for comparison."""
if not value:
return ''
return value.lower().strip('.')
|