22# https://www.sphinx-doc.org/en/master/usage/configuration.html
33
44import contextlib
5- import functools
65import logging
76import os .path
87import 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
155154ignored_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 ------------------------------------------
0 commit comments