Skip to content

Commit

Permalink
[docs][python] simplify mocking in docs (#4830)
Browse files Browse the repository at this point in the history
  • Loading branch information
StrikerRUS authored Nov 28, 2021
1 parent 953915f commit 2f5d898
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from shutil import copytree
from subprocess import PIPE, Popen
from typing import Any, List
from unittest.mock import Mock

import sphinx
from docutils.nodes import reference
Expand All @@ -40,22 +39,6 @@

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):
"""Replaces '.rst' with '.html' in all internal links like './[Something].rst[#anchor]'."""
Expand Down Expand Up @@ -109,7 +92,19 @@ def run(self) -> List:
"inherited-members": 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
autodoc_typehints = "none"

Expand Down

0 comments on commit 2f5d898

Please sign in to comment.