Skip to content

Commit 4b500e6

Browse files
authored
Merge pull request #311 from oskarnurm/feat/add-ISODateTime-converter
Migrate `ISODateTime` converter from `bot` repository
2 parents 74072b3 + 6f9de43 commit 4b500e6

File tree

6 files changed

+317
-111
lines changed

6 files changed

+317
-111
lines changed

docs/conf.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# https://www.sphinx-doc.org/en/master/usage/configuration.html
33

44
import contextlib
5-
import functools
65
import logging
76
import os.path
87
import shutil
@@ -119,7 +118,7 @@ def skip(*args) -> bool:
119118
name = args[2]
120119
would_skip = args[4]
121120

122-
if name == "__weakref__":
121+
if name in ("__weakref__", "__subclasshook__"):
123122
return True
124123
return would_skip
125124

@@ -154,7 +153,10 @@ def setup(app: Sphinx) -> None:
154153

155154
ignored_targets = [
156155
"async_rediscache",
157-
"pydantic.main.BaseModel"
156+
"pydantic.main.BaseModel",
157+
"pydantic_core.*",
158+
"pydantic._internal.*",
159+
"pydantic.plugin.*"
158160
]
159161

160162
# nitpick raises warnings as errors. This regex tells nitpick to ignore any warnings that match this regex.
@@ -163,6 +165,11 @@ def setup(app: Sphinx) -> None:
163165
("py:.*", "|".join([f".*{entry}.*" for entry in ignored_targets])),
164166
]
165167

168+
suppress_warnings = [
169+
"sphinx_autodoc_typehints.forward_reference",
170+
"sphinx_autodoc_typehints.guarded_import",
171+
]
172+
166173
# -- Extension configuration -------------------------------------------------
167174

168175
# -- Options for todo extension ----------------------------------------------
@@ -190,11 +197,18 @@ def setup(app: Sphinx) -> None:
190197
"aiohttp": ("https://docs.aiohttp.org/en/stable/", None),
191198
"statsd": ("https://statsd.readthedocs.io/en/v3.3/", ("_static/statsd_additional_objects.inv", None)),
192199
"pydantic": ("https://docs.pydantic.dev/latest/", None),
200+
"dateutil": ("https://dateutil.readthedocs.io/en/stable/", None),
193201
}
194202

195203

196204
# -- Options for the linkcode extension --------------------------------------
197-
linkcode_resolve = functools.partial(utils.linkcode_resolve, REPO_LINK)
205+
def _safe_linkcode_resolve(domain: str, info: dict[str, str]) -> str | None:
206+
try:
207+
return utils.linkcode_resolve(REPO_LINK, domain, info)
208+
except ValueError:
209+
return None
210+
211+
linkcode_resolve = _safe_linkcode_resolve
198212

199213

200214
# -- Options for releases extension ------------------------------------------

docs/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ def linkcode_resolve(repo_link: str, domain: str, info: dict[str, str]) -> str |
6868
# in multiversion builds. We load the module from the file location instead
6969
spec = importlib.util.spec_from_file_location(info["module"], origin, submodule_search_locations=search_locations)
7070
module = importlib.util.module_from_spec(spec)
71-
spec.loader.exec_module(module)
71+
72+
try:
73+
spec.loader.exec_module(module)
74+
except Exception: # noqa: BLE001
75+
return None
7276

7377
symbol = [module]
7478
for name in symbol_name.split("."):

0 commit comments

Comments
 (0)