Skip to content

Commit

Permalink
[docs] Revert #16919 and fix documentation build (#17270)
Browse files Browse the repository at this point in the history
resolve merge conflict and fix docs
  • Loading branch information
richardliaw authored and jiaodong committed Jul 30, 2021
1 parent 6dae07c commit 6d50bdc
Show file tree
Hide file tree
Showing 3 changed files with 654 additions and 12 deletions.
14 changes: 2 additions & 12 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,8 @@ def __getattr__(cls, name):
sys.modules["tensorflow.keras.callbacks"] = ChildClassMock()
sys.modules["pytorch_lightning"] = ChildClassMock()


def import_or_mock(module):
try:
# Same as `import module`
__import__(module, globals(), locals(), [], 0)
except ImportError:
sys.modules[module] = ChildClassMock()


xgb_modules = ["xgboost", "xgboost.core", "xgboost.callback", "xgboost_ray"]
for xgb_mod in xgb_modules:
import_or_mock(xgb_mod)
assert "ray" not in sys.modules, (
"If ray is already imported, we will not render documentation correctly!")


class SimpleClass(object):
Expand Down
Loading

0 comments on commit 6d50bdc

Please sign in to comment.