mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Expand all any-generics overrides
This commit is contained in:
parent
7c24d408f8
commit
a9ba9f92d3
@ -177,15 +177,29 @@ module = [
|
||||
"sphinx.domains",
|
||||
"sphinx.domains.c",
|
||||
"sphinx.domains.cpp",
|
||||
"sphinx.environment.*",
|
||||
"sphinx.environment",
|
||||
"sphinx.environment.adapters.indexentries",
|
||||
"sphinx.environment.collectors.toctree",
|
||||
"sphinx.events",
|
||||
"sphinx.ext.*",
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.autodoc.directive",
|
||||
"sphinx.ext.autodoc.importer",
|
||||
"sphinx.ext.autodoc.mock",
|
||||
"sphinx.ext.autodoc.mock",
|
||||
"sphinx.ext.autosummary.generate",
|
||||
"sphinx.ext.doctest",
|
||||
"sphinx.ext.graphviz",
|
||||
"sphinx.ext.inheritance_diagram",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.napoleon.docstring",
|
||||
"sphinx.highlighting",
|
||||
"sphinx.jinja2glue",
|
||||
"sphinx.registry",
|
||||
"sphinx.roles",
|
||||
"sphinx.search.*",
|
||||
"sphinx.testing.*",
|
||||
"sphinx.search",
|
||||
"sphinx.testing.fixtures",
|
||||
"sphinx.testing.path",
|
||||
"sphinx.testing.util",
|
||||
"sphinx.util",
|
||||
"sphinx.util.display",
|
||||
"sphinx.util.docfields",
|
||||
|
@ -296,7 +296,7 @@ class Domain:
|
||||
"""Remove traces of a document in the domain-specific inventories."""
|
||||
pass
|
||||
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict) -> None:
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict[str, Any]) -> None:
|
||||
"""Merge in data regarding *docnames* from a different domaindata
|
||||
inventory (coming from a subprocess in parallel builds).
|
||||
"""
|
||||
|
@ -692,7 +692,7 @@ class CDomain(Domain):
|
||||
def process_field_xref(self, pnode: pending_xref) -> None:
|
||||
pnode.attributes.update(self.env.ref_context)
|
||||
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict) -> None:
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict[str, Any]) -> None:
|
||||
if Symbol.debug_show_tree:
|
||||
logger.debug("merge_domaindata:")
|
||||
logger.debug("\tself:")
|
||||
|
@ -833,7 +833,7 @@ class CPPDomain(Domain):
|
||||
def process_field_xref(self, pnode: pending_xref) -> None:
|
||||
pnode.attributes.update(self.env.ref_context)
|
||||
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict) -> None:
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict[str, Any]) -> None:
|
||||
if Symbol.debug_show_tree:
|
||||
logger.debug("merge_domaindata:")
|
||||
logger.debug("\tself:")
|
||||
|
@ -14,13 +14,14 @@ from sphinx.util import inspect
|
||||
from sphinx.util.typing import stringify_annotation
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from sphinx.ext.autodoc import Options
|
||||
from docutils.nodes import Element
|
||||
|
||||
from sphinx.application import Sphinx
|
||||
|
||||
|
||||
def record_typehints(app: Sphinx, objtype: str, name: str, obj: Any,
|
||||
options: dict, args: str, retann: str) -> None:
|
||||
options: Options, args: str, retann: str) -> None:
|
||||
"""Record type hints to env object."""
|
||||
if app.config.autodoc_typehints_format == 'short':
|
||||
mode = 'smart'
|
||||
|
@ -96,7 +96,7 @@ def make_link_role(name: str, base_url: str, caption: str) -> RoleFunction:
|
||||
# Remark: It is an implementation detail that we use Pythons %-formatting.
|
||||
# So far we only expose ``%s`` and require quoting of ``%`` using ``%%``.
|
||||
def role(typ: str, rawtext: str, text: str, lineno: int,
|
||||
inliner: Inliner, options: dict | None = None, content: Sequence[str] = (),
|
||||
inliner: Inliner, options: dict[str, Any] | None = None, content: Sequence[str] = (),
|
||||
) -> tuple[list[Node], list[system_message]]:
|
||||
text = utils.unescape(text)
|
||||
has_explicit_title, title, part = split_explicit_title(text)
|
||||
|
@ -87,7 +87,7 @@ class TodoDomain(Domain):
|
||||
def clear_doc(self, docname: str) -> None:
|
||||
self.todos.pop(docname, None)
|
||||
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict) -> None:
|
||||
def merge_domaindata(self, docnames: list[str], otherdata: dict[str, Any]) -> None:
|
||||
for docname in docnames:
|
||||
self.todos[docname] = otherdata['todos'][docname]
|
||||
|
||||
|
@ -70,11 +70,11 @@ var Stemmer = function() {
|
||||
|
||||
_word_re = re.compile(r'\w+')
|
||||
|
||||
def __init__(self, options: dict) -> None:
|
||||
def __init__(self, options: dict[str, str]) -> None:
|
||||
self.options = options
|
||||
self.init(options)
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
"""
|
||||
Initialize the class with the options the user has given.
|
||||
"""
|
||||
@ -171,10 +171,10 @@ class _JavaScriptIndex:
|
||||
raise ValueError('invalid data')
|
||||
return json.loads(data)
|
||||
|
||||
def dump(self, data: Any, f: IO) -> None:
|
||||
def dump(self, data: Any, f: IO[str]) -> None:
|
||||
f.write(self.dumps(data))
|
||||
|
||||
def load(self, f: IO) -> Any:
|
||||
def load(self, f: IO[str]) -> Any:
|
||||
return self.loads(f.read())
|
||||
|
||||
|
||||
@ -250,7 +250,7 @@ class IndexBuilder:
|
||||
'pickle': pickle
|
||||
}
|
||||
|
||||
def __init__(self, env: BuildEnvironment, lang: str, options: dict, scoring: str) -> None:
|
||||
def __init__(self, env: BuildEnvironment, lang: str, options: dict[str, str], scoring: str) -> None:
|
||||
self.env = env
|
||||
# docname -> title
|
||||
self._titles: dict[str, str] = env._search_index_titles
|
||||
@ -368,8 +368,8 @@ class IndexBuilder:
|
||||
plist.append((fn2index[docname], typeindex, prio, shortanchor, name))
|
||||
return rv
|
||||
|
||||
def get_terms(self, fn2index: dict) -> tuple[dict[str, list[str]], dict[str, list[str]]]:
|
||||
rvs: tuple[dict[str, list[str]], dict[str, list[str]]] = ({}, {})
|
||||
def get_terms(self, fn2index: dict[str, int]) -> tuple[dict[str, list[int] | int], dict[str, list[int] | int]]:
|
||||
rvs: tuple[dict[str, list[int] | int], dict[str, list[int] | int]] = ({}, {})
|
||||
for rv, mapping in zip(rvs, (self._mapping, self._title_mapping)):
|
||||
for k, v in mapping.items():
|
||||
if len(v) == 1:
|
||||
|
@ -113,7 +113,7 @@ class SearchDanish(SearchLanguage):
|
||||
js_stemmer_rawcode = 'danish-stemmer.js'
|
||||
stopwords = danish_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('danish')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -296,7 +296,7 @@ class SearchGerman(SearchLanguage):
|
||||
js_stemmer_rawcode = 'german-stemmer.js'
|
||||
stopwords = german_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('german')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -213,7 +213,7 @@ class SearchEnglish(SearchLanguage):
|
||||
js_stemmer_code = js_porter_stemmer
|
||||
stopwords = english_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('porter')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -356,7 +356,7 @@ class SearchSpanish(SearchLanguage):
|
||||
js_stemmer_rawcode = 'spanish-stemmer.js'
|
||||
stopwords = spanish_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('spanish')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -106,7 +106,7 @@ class SearchFinnish(SearchLanguage):
|
||||
js_stemmer_rawcode = 'finnish-stemmer.js'
|
||||
stopwords = finnish_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('finnish')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -192,7 +192,7 @@ class SearchFrench(SearchLanguage):
|
||||
js_stemmer_rawcode = 'french-stemmer.js'
|
||||
stopwords = french_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('french')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -219,7 +219,7 @@ class SearchHungarian(SearchLanguage):
|
||||
js_stemmer_rawcode = 'hungarian-stemmer.js'
|
||||
stopwords = hungarian_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('hungarian')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -309,7 +309,7 @@ class SearchItalian(SearchLanguage):
|
||||
js_stemmer_rawcode = 'italian-stemmer.js'
|
||||
stopwords = italian_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('italian')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -33,7 +33,7 @@ from sphinx.util import import_object
|
||||
|
||||
|
||||
class BaseSplitter:
|
||||
def __init__(self, options: dict) -> None:
|
||||
def __init__(self, options: dict[str, str]) -> None:
|
||||
self.options = options
|
||||
|
||||
def split(self, input: str) -> list[str]:
|
||||
@ -46,7 +46,7 @@ class BaseSplitter:
|
||||
|
||||
|
||||
class MecabSplitter(BaseSplitter):
|
||||
def __init__(self, options: dict) -> None:
|
||||
def __init__(self, options: dict[str, str]) -> None:
|
||||
super().__init__(options)
|
||||
self.ctypes_libmecab: Any = None
|
||||
self.ctypes_mecab: Any = None
|
||||
@ -64,14 +64,14 @@ class MecabSplitter(BaseSplitter):
|
||||
self.ctypes_mecab, input.encode(self.dict_encode))
|
||||
return result.split(' ')
|
||||
|
||||
def init_native(self, options: dict) -> None:
|
||||
def init_native(self, options: dict[str, str]) -> None:
|
||||
param = '-Owakati'
|
||||
dict = options.get('dict')
|
||||
if dict:
|
||||
param += ' -d %s' % dict
|
||||
self.native = MeCab.Tagger(param)
|
||||
|
||||
def init_ctypes(self, options: dict) -> None:
|
||||
def init_ctypes(self, options: dict[str, str]) -> None:
|
||||
import ctypes.util
|
||||
|
||||
lib = options.get('lib')
|
||||
@ -113,7 +113,7 @@ class MecabSplitter(BaseSplitter):
|
||||
|
||||
|
||||
class JanomeSplitter(BaseSplitter):
|
||||
def __init__(self, options: dict) -> None:
|
||||
def __init__(self, options: dict[str, str]) -> None:
|
||||
super().__init__(options)
|
||||
self.user_dict = options.get('user_dic')
|
||||
self.user_dict_enc = options.get('user_dic_enc', 'utf8')
|
||||
@ -513,7 +513,7 @@ class SearchJapanese(SearchLanguage):
|
||||
lang = 'ja'
|
||||
language_name = 'Japanese'
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
dotted_path = options.get('type', 'sphinx.search.ja.DefaultSplitter')
|
||||
try:
|
||||
self.splitter = import_object(dotted_path)(options)
|
||||
|
@ -120,7 +120,7 @@ class SearchDutch(SearchLanguage):
|
||||
js_stemmer_rawcode = 'dutch-stemmer.js'
|
||||
stopwords = dutch_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('dutch')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -195,7 +195,7 @@ class SearchNorwegian(SearchLanguage):
|
||||
js_stemmer_rawcode = 'norwegian-stemmer.js'
|
||||
stopwords = norwegian_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('norwegian')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -254,7 +254,7 @@ class SearchPortuguese(SearchLanguage):
|
||||
js_stemmer_rawcode = 'portuguese-stemmer.js'
|
||||
stopwords = portuguese_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('portuguese')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -15,7 +15,7 @@ class SearchRomanian(SearchLanguage):
|
||||
js_stemmer_rawcode = 'romanian-stemmer.js'
|
||||
stopwords: set[str] = set()
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('romanian')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -244,7 +244,7 @@ class SearchRussian(SearchLanguage):
|
||||
js_stemmer_rawcode = 'russian-stemmer.js'
|
||||
stopwords = russian_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('russian')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -133,7 +133,7 @@ class SearchSwedish(SearchLanguage):
|
||||
js_stemmer_rawcode = 'swedish-stemmer.js'
|
||||
stopwords = swedish_stopwords
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('swedish')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -15,7 +15,7 @@ class SearchTurkish(SearchLanguage):
|
||||
js_stemmer_rawcode = 'turkish-stemmer.js'
|
||||
stopwords: set[str] = set()
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
self.stemmer = snowballstemmer.stemmer('turkish')
|
||||
|
||||
def stem(self, word: str) -> str:
|
||||
|
@ -227,7 +227,7 @@ class SearchChinese(SearchLanguage):
|
||||
latin1_letters = re.compile(r'[a-zA-Z0-9_]+')
|
||||
latin_terms: list[str] = []
|
||||
|
||||
def init(self, options: dict) -> None:
|
||||
def init(self, options: dict[str, str]) -> None:
|
||||
if JIEBA:
|
||||
dict_path = options.get('dict')
|
||||
if dict_path and os.path.isfile(dict_path):
|
||||
|
Loading…
Reference in New Issue
Block a user