This file is indexed.

/usr/lib/python2.7/dist-packages/pex/compatibility.py is in python-pex 1.1.14-2ubuntu2.

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
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

# This file contains several 2.x/3.x compatibility checkstyle violations for a reason
# checkstyle: noqa

import os
from abc import ABCMeta
from numbers import Integral, Real
from sys import version_info as sys_version_info

# TODO(wickman)  Since the io package is available in 2.6.x, use that instead of
# cStringIO/StringIO
try:
  # CPython 2.x
  from cStringIO import StringIO
except ImportError:
  try:
    # Python 2.x
    from StringIO import StringIO
  except:
    # Python 3.x
    from io import StringIO
    from io import BytesIO

try:
  # Python 2.x
  from ConfigParser import ConfigParser
except ImportError:
  # Python 3.x
  from configparser import ConfigParser

AbstractClass = ABCMeta('AbstractClass', (object,), {})
PY2 = sys_version_info[0] == 2
PY3 = sys_version_info[0] == 3
StringIO = StringIO
BytesIO = BytesIO if PY3 else StringIO

integer = (Integral,)
real = (Real,)
numeric = integer + real
string = (str,) if PY3 else (str, unicode)
bytes = (bytes,)

if PY2:
  def to_bytes(st, encoding='utf-8'):
    if isinstance(st, unicode):
      return st.encode(encoding)
    elif isinstance(st, bytes):
      return st
    else:
      raise ValueError('Cannot convert %s to bytes' % type(st))
else:
  def to_bytes(st, encoding='utf-8'):
    if isinstance(st, str):
      return st.encode(encoding)
    elif isinstance(st, bytes):
      return st
    else:
      raise ValueError('Cannot convert %s to bytes.' % type(st))

_PY3_EXEC_FUNCTION = """
def exec_function(ast, globals_map):
  locals_map = globals_map
  exec ast in globals_map, locals_map
  return locals_map
"""

if PY3:
  def exec_function(ast, globals_map):
    locals_map = globals_map
    exec(ast, globals_map, locals_map)
    return locals_map
else:
  eval(compile(_PY3_EXEC_FUNCTION, "<exec_function>", "exec"))

if PY3:
  from contextlib import contextmanager, ExitStack

  @contextmanager
  def nested(*context_managers):
    enters = []
    with ExitStack() as stack:
      for manager in context_managers:
        enters.append(stack.enter_context(manager))
      yield tuple(enters)

else:
  from contextlib import nested


if PY3:
  from urllib.request import pathname2url, url2pathname
else:
  from urllib import pathname2url, url2pathname


WINDOWS = os.name == 'nt'


__all__ = (
  'AbstractClass',
  'BytesIO',
  'ConfigParser',
  'PY2',
  'PY3',
  'StringIO',
  'WINDOWS',
  'bytes',
  'exec_function',
  'nested',
  'pathname2url',
  'string',
  'to_bytes',
  'url2pathname',
)