mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
apidoc: Move ApidocOptions to `sphinx.ext.apidoc._shared
`
This commit is contained in:
parent
d42cfa702f
commit
95df419f49
@ -13,12 +13,8 @@ from typing import TYPE_CHECKING, Any
|
|||||||
import sphinx.locale
|
import sphinx.locale
|
||||||
from sphinx import __display_version__
|
from sphinx import __display_version__
|
||||||
from sphinx.cmd.quickstart import EXTENSIONS
|
from sphinx.cmd.quickstart import EXTENSIONS
|
||||||
from sphinx.ext.apidoc._generate import (
|
from sphinx.ext.apidoc._generate import create_modules_toc_file, recurse_tree
|
||||||
ApidocOptions,
|
from sphinx.ext.apidoc._shared import LOGGER, ApidocOptions, _remove_old_files
|
||||||
create_modules_toc_file,
|
|
||||||
recurse_tree,
|
|
||||||
)
|
|
||||||
from sphinx.ext.apidoc._shared import LOGGER, _remove_old_files
|
|
||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
from sphinx.util.osutil import ensuredir
|
from sphinx.util.osutil import ensuredir
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@ -18,6 +17,8 @@ if TYPE_CHECKING:
|
|||||||
import re
|
import re
|
||||||
from collections.abc import Iterator, Sequence
|
from collections.abc import Iterator, Sequence
|
||||||
|
|
||||||
|
from sphinx.ext.apidoc._shared import ApidocOptions
|
||||||
|
|
||||||
|
|
||||||
# automodule options
|
# automodule options
|
||||||
if 'SPHINX_APIDOC_OPTIONS' in os.environ:
|
if 'SPHINX_APIDOC_OPTIONS' in os.environ:
|
||||||
@ -349,37 +350,3 @@ def is_excluded(root: str | Path, excludes: Sequence[re.Pattern[str]]) -> bool:
|
|||||||
"""
|
"""
|
||||||
root_str = str(root)
|
root_str = str(root)
|
||||||
return any(exclude.match(root_str) for exclude in excludes)
|
return any(exclude.match(root_str) for exclude in excludes)
|
||||||
|
|
||||||
|
|
||||||
@dataclasses.dataclass(frozen=True, kw_only=True, slots=True)
|
|
||||||
class ApidocOptions:
|
|
||||||
"""Options for apidoc."""
|
|
||||||
|
|
||||||
module_path: Path
|
|
||||||
exclude_pattern: list[str]
|
|
||||||
destdir: Path
|
|
||||||
quiet: bool = False
|
|
||||||
maxdepth: int = 4
|
|
||||||
force: bool = False
|
|
||||||
followlinks: bool = False
|
|
||||||
dryrun: bool = False
|
|
||||||
separatemodules: bool = False
|
|
||||||
includeprivate: bool = False
|
|
||||||
tocfile: str = 'modules'
|
|
||||||
noheadings: bool = False
|
|
||||||
modulefirst: bool = False
|
|
||||||
implicit_namespaces: bool = False
|
|
||||||
automodule_options: set[str] = dataclasses.field(default_factory=set)
|
|
||||||
suffix: str = 'rst'
|
|
||||||
|
|
||||||
remove_old: bool = False
|
|
||||||
|
|
||||||
# --full only
|
|
||||||
full: bool = False
|
|
||||||
append_syspath: bool = False
|
|
||||||
header: str = ''
|
|
||||||
author: str | None = None
|
|
||||||
version: str | None = None
|
|
||||||
release: str | None = None
|
|
||||||
extensions: list[str] | None = None
|
|
||||||
templatedir: str | None = None
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import dataclasses
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from sphinx.locale import __
|
from sphinx.locale import __
|
||||||
@ -28,3 +29,38 @@ def _remove_old_files(
|
|||||||
exc.strerror,
|
exc.strerror,
|
||||||
type='autodoc',
|
type='autodoc',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass(frozen=True, kw_only=True, slots=True)
|
||||||
|
class ApidocOptions:
|
||||||
|
"""Options for apidoc."""
|
||||||
|
|
||||||
|
module_path: Path
|
||||||
|
destdir: Path
|
||||||
|
|
||||||
|
exclude_pattern: Sequence[str] = ()
|
||||||
|
quiet: bool = False
|
||||||
|
maxdepth: int = 4
|
||||||
|
force: bool = False
|
||||||
|
followlinks: bool = False
|
||||||
|
dryrun: bool = False
|
||||||
|
separatemodules: bool = False
|
||||||
|
includeprivate: bool = False
|
||||||
|
tocfile: str = 'modules'
|
||||||
|
noheadings: bool = False
|
||||||
|
modulefirst: bool = False
|
||||||
|
implicit_namespaces: bool = False
|
||||||
|
automodule_options: set[str] = dataclasses.field(default_factory=set)
|
||||||
|
suffix: str = 'rst'
|
||||||
|
|
||||||
|
remove_old: bool = False
|
||||||
|
|
||||||
|
# --full only
|
||||||
|
full: bool = False
|
||||||
|
append_syspath: bool = False
|
||||||
|
header: str = ''
|
||||||
|
author: str | None = None
|
||||||
|
version: str | None = None
|
||||||
|
release: str | None = None
|
||||||
|
extensions: Sequence[str] | None = None
|
||||||
|
templatedir: str | None = None
|
||||||
|
Loading…
Reference in New Issue
Block a user