Unverified Commit 2f5d8985 authored by Nikita Titov's avatar Nikita Titov Committed by GitHub
Browse files

[docs][python] simplify mocking in docs (#4830)

parent 953915f5
...@@ -25,7 +25,6 @@ from re import compile ...@@ -25,7 +25,6 @@ from re import compile
from shutil import copytree from shutil import copytree
from subprocess import PIPE, Popen from subprocess import PIPE, Popen
from typing import Any, List from typing import Any, List
from unittest.mock import Mock
import sphinx import sphinx
from docutils.nodes import reference from docutils.nodes import reference
...@@ -40,22 +39,6 @@ sys.path.insert(0, str(LIB_PATH)) ...@@ -40,22 +39,6 @@ sys.path.insert(0, str(LIB_PATH))
INTERNAL_REF_REGEX = compile(r"(?P<url>\.\/.+)(?P<extension>\.rst)(?P<anchor>$|#)") INTERNAL_REF_REGEX = compile(r"(?P<url>\.\/.+)(?P<extension>\.rst)(?P<anchor>$|#)")
# -- mock out modules
MOCK_MODULES = [
'dask',
'dask.distributed',
'datatable',
'graphviz',
'matplotlib',
'numpy',
'pandas',
'scipy',
'scipy.sparse',
'sklearn'
]
for mod_name in MOCK_MODULES:
sys.modules[mod_name] = Mock()
class InternalRefTransform(Transform): class InternalRefTransform(Transform):
"""Replaces '.rst' with '.html' in all internal links like './[Something].rst[#anchor]'.""" """Replaces '.rst' with '.html' in all internal links like './[Something].rst[#anchor]'."""
...@@ -109,7 +92,19 @@ autodoc_default_options = { ...@@ -109,7 +92,19 @@ autodoc_default_options = {
"inherited-members": True, "inherited-members": True,
"show-inheritance": True, "show-inheritance": True,
} }
# mock out modules
autodoc_mock_imports = [
'dask',
'dask.distributed',
'datatable',
'graphviz',
'matplotlib',
'numpy',
'pandas',
'scipy',
'scipy.sparse',
'sklearn'
]
# hide type hints in API docs # hide type hints in API docs
autodoc_typehints = "none" autodoc_typehints = "none"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment