/usr/lib/python2.7/dist-packages/sphinx/util/compat.py is in python-sphinx 1.6.7-1ubuntu1.
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 | # -*- coding: utf-8 -*-
"""
sphinx.util.compat
~~~~~~~~~~~~~~~~~~
Stuff for docutils compatibility.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from __future__ import absolute_import
import sys
import warnings
from distutils.version import LooseVersion
from docutils.parsers.rst import Directive # noqa
from docutils import __version__ as _du_version
from sphinx.deprecation import RemovedInSphinx17Warning
docutils_version = tuple(LooseVersion(_du_version).version)[:2]
if False:
# For type annotation
from typing import Any, Dict # NOQA
class _DeprecationWrapper(object):
def __init__(self, mod, deprecated):
# type: (Any, Dict) -> None
self._mod = mod
self._deprecated = deprecated
def __getattr__(self, attr):
# type: (str) -> Any
if attr in self._deprecated:
warnings.warn("sphinx.util.compat.%s is deprecated and will be removed "
"in Sphinx 1.7, please use docutils' instead." % attr,
RemovedInSphinx17Warning)
return self._deprecated[attr]
return getattr(self._mod, attr)
sys.modules[__name__] = _DeprecationWrapper(sys.modules[__name__], dict(
docutils_version = docutils_version,
Directive = Directive,
))
|