def setup(app: Sphinx) -> SphinxExtMetadata:
    """
	Setup :mod:`sphinx_toolbox.more_autodoc.autonamedtuple`.

	.. versionadded:: 0.8.0

	:param app: The Sphinx application.
	"""

    # Hack to get the docutils tab size, as there doesn't appear to be any other way
    app.setup_extension("sphinx_toolbox.tweaks.tabsize")

    app.registry.domains["py"].object_types["namedtuple"] = ObjType(
        _("namedtuple"), "namedtuple", "class", "obj")
    app.add_directive_to_domain("py", "namedtuple", PyClasslike)
    app.add_role_to_domain("py", "namedtuple", PyXRefRole())

    app.connect("object-description-transform",
                add_fallback_css_class({"namedtuple": "class"}))

    allow_subclass_add(app, NamedTupleDocumenter)

    app.connect("config-inited",
                lambda _, config: add_nbsp_substitution(config))

    return {"parallel_read_safe": True}
示例#2
0
def setup(app: Sphinx) -> SphinxExtMetadata:
    """
	Setup :mod:`sphinx_toolbox.more_autodoc.generic_bases`.

	:param app: The Sphinx app.

	.. versionadded:: 1.5.0
	"""

    allow_subclass_add(app, GenericBasesClassDocumenter)

    return {"parallel_read_safe": True}
def setup(app: Sphinx) -> SphinxExtMetadata:
    """
	Setup :mod:`sphinx_toolbox.more_autodoc.autotypeddict`.

	:param app: The Sphinx application.
	"""

    app.registry.domains["py"].object_types["typeddict"] = ObjType(
        "typeddict", "typeddict", "class", "obj")
    app.add_directive_to_domain("py", "typeddict", PyClasslike)
    app.add_role_to_domain("py", "typeddict", PyXRefRole())
    app.connect("object-description-transform",
                add_fallback_css_class({"typeddict": "class"}))

    allow_subclass_add(app, TypedDictDocumenter)

    return {"parallel_read_safe": True}
def setup(app: Sphinx) -> SphinxExtMetadata:
    """
	Setup :mod:`sphinx_toolbox.more_autodoc.autotypeddict`.

	:param app: The Sphinx app.

	.. versionadded:: 0.5.0
	"""

    app.registry.domains["py"].object_types["typeddict"] = ObjType(
        "typeddict", "typeddict", "class", "obj")
    app.add_directive_to_domain("py", "typeddict", PyClasslike)
    app.add_role_to_domain("py", "typeddict", PyXRefRole())

    allow_subclass_add(app, TypedDictDocumenter)

    return {"parallel_read_safe": True}
示例#5
0
def setup(app: Sphinx) -> SphinxExtMetadata:
    """
	Setup :mod:`sphinx_toolbox.more_autodoc.generic_bases`.

	.. versionadded:: 1.5.0

	:param app: The Sphinx application.
	"""

    allow_subclass_add(app, GenericBasesClassDocumenter)
    app.add_config_value(
        "generic_bases_fully_qualified",
        default=False,
        rebuild="env",
        types=[bool],
    )

    return {"parallel_read_safe": True}
示例#6
0
def setup(app: Sphinx) -> SphinxExtMetadata:
	"""
	Setup :mod:`sphinx_toolbox.more_autosummary`.

	:param app: The Sphinx app.
	"""

	app.setup_extension("sphinx.ext.autosummary")
	app.setup_extension("autodocsumm")

	app.add_directive("autosummary", PatchedAutosummary, override=True)
	autodocsumm.AutosummaryDocumenter.add_autosummary = add_autosummary
	allow_subclass_add(app, PatchedAutoSummClassDocumenter)

	app.add_config_value(
			"autodocsumm_member_order",
			"alphabetical",
			True,
			ENUM("alphabetic", "alphabetical", "bysource"),
			)

	return {"parallel_read_safe": True}
示例#7
0
def setup(app: Sphinx) -> SphinxExtMetadata:
    app.setup_extension("sphinx_toolbox.more_autodoc.autoprotocol")
    allow_subclass_add(app, CoincidenceProtocolDocumenter)

    return {"parallel_read_safe": True}