Skip to content

Commit 1281a83

Browse files
authored
autodoc: Restore mock module for compatibility (#14152)
1 parent 7926051 commit 1281a83

File tree

5 files changed

+29
-29
lines changed

5 files changed

+29
-29
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Release 9.0.2 (in development)
44
Bugs fixed
55
----------
66

7+
* #14142: autodoc: Restore :mod:`!sphinx.ext.autodoc.mock`.
8+
Patch by Adam Turner.
79

810
Release 9.0.1 (released Dec 01, 2025)
911
=====================================

sphinx/ext/autodoc/importer.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,18 @@
88

99
from sphinx.errors import PycodeError
1010
from sphinx.ext.autodoc._dynamic._importer import (
11-
_find_type_stub_spec as _find_type_stub_spec, # NoQA: PLC0414
11+
_find_type_stub_spec, # NoQA: F401
12+
_reload_module, # NoQA: F401
13+
_StubFileLoader, # NoQA: F401
1214
)
1315
from sphinx.ext.autodoc._dynamic._importer import (
1416
_import_module as import_module,
1517
)
1618
from sphinx.ext.autodoc._dynamic._importer import _mangle_name as mangle
17-
from sphinx.ext.autodoc._dynamic._importer import (
18-
_reload_module as _reload_module, # NoQA: PLC0414
19-
)
20-
from sphinx.ext.autodoc._dynamic._importer import (
21-
_StubFileLoader as _StubFileLoader, # NoQA: PLC0414
22-
)
23-
from sphinx.ext.autodoc._dynamic._member_finder import _filter_enum_dict, unmangle
2419
from sphinx.ext.autodoc._dynamic._member_finder import (
25-
_is_native_enum_api as _is_native_enum_api, # NoQA: PLC0414
20+
_filter_enum_dict,
21+
_is_native_enum_api, # NoQA: F401
22+
unmangle,
2623
)
2724
from sphinx.ext.autodoc._dynamic._mock import ismock, undecorate
2825
from sphinx.ext.autodoc._shared import LOGGER

sphinx/ext/autodoc/mock.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from __future__ import annotations
2+
3+
from sphinx.ext.autodoc._dynamic._mock import (
4+
MockFinder, # NoQA: F401
5+
MockLoader, # NoQA: F401
6+
_make_subclass, # NoQA: F401
7+
_MockModule, # NoQA: F401
8+
_MockObject, # NoQA: F401
9+
ismock, # NoQA: F401
10+
ismockmodule, # NoQA: F401
11+
mock, # NoQA: F401
12+
undecorate, # NoQA: F401
13+
)

sphinx/ext/autodoc/preserve_defaults.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,13 @@
99
from typing import TYPE_CHECKING
1010

1111
from sphinx.ext.autodoc._dynamic._preserve_defaults import (
12-
DefaultValue as DefaultValue, # NoQA: PLC0414
12+
DefaultValue, # NoQA: F401
13+
_get_arguments, # NoQA: F401
14+
_get_arguments_inner, # NoQA: F401
15+
_is_lambda, # NoQA: F401
16+
get_default_value, # NoQA: F401
17+
update_default_value,
1318
)
14-
from sphinx.ext.autodoc._dynamic._preserve_defaults import (
15-
_get_arguments as _get_arguments, # NoQA: PLC0414
16-
)
17-
from sphinx.ext.autodoc._dynamic._preserve_defaults import (
18-
_get_arguments_inner as _get_arguments_inner, # NoQA: PLC0414
19-
)
20-
from sphinx.ext.autodoc._dynamic._preserve_defaults import (
21-
_is_lambda as _is_lambda, # NoQA: PLC0414
22-
)
23-
from sphinx.ext.autodoc._dynamic._preserve_defaults import (
24-
get_default_value as get_default_value, # NoQA: PLC0414
25-
)
26-
from sphinx.ext.autodoc._dynamic._preserve_defaults import update_default_value
2719

2820
if TYPE_CHECKING:
2921
from typing import Any

sphinx/ext/autodoc/type_comment.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@
66

77
from sphinx.ext.autodoc._dynamic._type_comments import (
88
_update_annotations_using_type_comments,
9-
)
10-
from sphinx.ext.autodoc._dynamic._type_comments import (
11-
not_suppressed as not_suppressed, # NoQA: PLC0414
12-
)
13-
from sphinx.ext.autodoc._dynamic._type_comments import (
14-
signature_from_ast as signature_from_ast, # NoQA: PLC0414
9+
not_suppressed, # NoQA: F401
10+
signature_from_ast, # NoQA: F401
1511
)
1612

1713
if TYPE_CHECKING:

0 commit comments

Comments
 (0)