You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

conf.py 3.1 kB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import os
  2. import re
  3. import sys
  4. from docutils import nodes
  5. from docutils.parsers.rst import roles
  6. from sphinx.application import Sphinx
  7. # -- Path setup --------------------------------------------------------------
  8. sys.path.insert(0, os.path.abspath(".."))
  9. import ablkit # noqa: E402
  10. from unittest.mock import MagicMock
  11. class Mock(MagicMock):
  12. @classmethod
  13. def __getattr__(cls, name):
  14. return MagicMock()
  15. MOCK_MODULES = ["numpy", "pyswip", "torch", "torchvision", "zoopt", "termcolor"]
  16. sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
  17. # -- Project information -----------------------------------------------------
  18. project = "ABL Kit"
  19. copyright = "LAMDA, 2024"
  20. # -- General configuration ---------------------------------------------------
  21. extensions = [
  22. "sphinx.ext.intersphinx",
  23. "sphinx.ext.autodoc",
  24. "sphinx.ext.autosummary",
  25. "sphinx.ext.mathjax",
  26. "sphinx.ext.viewcode",
  27. "sphinx_rtd_theme",
  28. "recommonmark",
  29. "sphinx_markdown_tables",
  30. "sphinx.ext.napoleon",
  31. "sphinx_copybutton",
  32. ]
  33. templates_path = ["_templates"]
  34. source_suffix = [".rst", ".md"]
  35. exclude_patterns = []
  36. gettext_compact = False
  37. master_doc = "index"
  38. suppress_warnings = ["image.nonlocal_uri"]
  39. pygments_style = "default"
  40. # -- Options for HTML output -------------------------------------------------
  41. html_theme = "sphinx_rtd_theme"
  42. html_theme_options = {"display_version": True}
  43. html_static_path = ["_static"]
  44. html_css_files = ["custom.css"]
  45. slug = re.sub(r"\W+", "", project.lower())
  46. htmlhelp_basename = slug
  47. man_pages = [("index", slug, project, 1)]
  48. texinfo_documents = [
  49. ("index", slug, project, slug, project, "Miscellaneous"),
  50. ]
  51. copybutton_selector = "div:not(.code-out) > div.highlight > pre"
  52. def remove_noqa(app: Sphinx, what: str, name: str, obj, options, lines):
  53. new_lines = []
  54. for line in lines:
  55. new_line = re.sub(r"\s*#\s*noqa.*$", "", line)
  56. new_lines.append(new_line)
  57. lines[:] = new_lines
  58. def colored_text_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
  59. node = nodes.inline(rawtext, text, classes=[role])
  60. return [node], []
  61. roles.register_local_role("green-bold", colored_text_role)
  62. roles.register_local_role("blue-bold", colored_text_role)
  63. roles.register_local_role("yellow-bold", colored_text_role)
  64. roles.register_local_role("green", colored_text_role)
  65. roles.register_local_role("blue", colored_text_role)
  66. roles.register_local_role("yellow", colored_text_role)
  67. # Extensions to theme docs
  68. def setup(app):
  69. from sphinx.domains.python import PyField
  70. from sphinx.util.docfields import Field
  71. app.connect("autodoc-process-docstring", remove_noqa)
  72. app.add_object_type(
  73. "confval",
  74. "confval",
  75. objname="configuration value",
  76. indextemplate="pair: %s; configuration value",
  77. doc_field_types=[
  78. PyField("type", label=("Type"), has_arg=False, names=("type",), bodyrolename="class"),
  79. Field(
  80. "default",
  81. label=("Default"),
  82. has_arg=False,
  83. names=("default",),
  84. ),
  85. ],
  86. )

An efficient Python toolkit for Abductive Learning (ABL), a novel paradigm that integrates machine learning and logical reasoning in a unified framework.