This file is indexed.

/usr/lib/python2.7/dist-packages/pypandoc/py3compat.py is in python-pypandoc 1.3.3+ds0-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
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
# -*- coding: utf-8 -*-
from __future__ import with_statement

import sys
import locale

# compat code from IPython py3compat.py and encoding.py, which is licensed under the terms of the
# Modified BSD License (also known as New or Revised or 3-Clause BSD)
_DEFAULT_ENCODING = None
try:
    # There are reports of getpreferredencoding raising errors
    # in some cases, which may well be fixed, but let's be conservative here.
    _DEFAULT_ENCODING = locale.getpreferredencoding()
except Exception:
    pass

_DEFAULT_ENCODING = _DEFAULT_ENCODING or sys.getdefaultencoding()


def _decode(s, encoding=None):
    encoding = encoding or _DEFAULT_ENCODING
    return s.decode(encoding)


def _encode(u, encoding=None):
    encoding = encoding or _DEFAULT_ENCODING
    return u.encode(encoding)


def cast_unicode(s, encoding=None):
    if isinstance(s, bytes):
        return _decode(s, encoding)
    return s


def cast_bytes(s, encoding=None):
    # bytes == str on py2.7 -> always encode on py2
    if not isinstance(s, bytes):
        return _encode(s, encoding)
    return s


if sys.version_info[0] >= 3:
    PY3 = True

    string_types = (str,)
    unicode_type = str

    # from http://stackoverflow.com/questions/11687478/convert-a-filename-to-a-file-url
    from urllib.parse import urljoin, urlparse
    from urllib.request import pathname2url, url2pathname

    def path2url(path):
        return urljoin('file:', pathname2url(path))

    def url2path(url):
        return url2pathname(urlparse(url).path)

else:
    PY3 = False

    string_types = (str, unicode)  # noqa: F821
    unicode_type = unicode  # noqa: F821

    from urlparse import urljoin, urlparse
    import urllib

    def path2url(path):
        return urljoin('file:', urllib.pathname2url(path))

    def url2path(url):
        return urllib.url2pathname(urlparse(url).path)