Skip to content

Commit 43a1c61

Browse files
committed
Un-deprecate sphinx.util.import_object
1 parent b678d17 commit 43a1c61

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

sphinx/builders/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
from sphinx.locale import __
2525
from sphinx.util import (
2626
get_filetype,
27+
import_object,
2728
logging,
2829
rst,
2930
)
30-
from sphinx.util._importer import import_object
3131
from sphinx.util._pathlib import _StrPathProperty
3232
from sphinx.util.build_phase import BuildPhase
3333
from sphinx.util.display import progress_message, status_iterator

sphinx/search/ja.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
from sphinx.errors import ExtensionError, SphinxError
3737
from sphinx.search import SearchLanguage
38-
from sphinx.util._importer import import_object
38+
from sphinx.util import import_object
3939

4040

4141
class BaseSplitter:

sphinx/util/__init__.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,6 @@ def __getattr__(name: str) -> Any:
9898
_deprecation_warning(__name__, name, '', remove=(10, 0))
9999
return obj
100100

101-
if name == 'import_object':
102-
from sphinx.util._importer import import_object
103-
104-
_deprecation_warning(__name__, name, '', remove=(10, 0))
105-
return import_object
106-
107101
# Re-exported for backwards compatibility,
108102
# but not currently deprecated
109103

@@ -112,6 +106,11 @@ def __getattr__(name: str) -> Any:
112106

113107
return encode_uri
114108

109+
if name == 'import_object':
110+
from sphinx.util._importer import import_object
111+
112+
return import_object
113+
115114
if name == 'isurl':
116115
from sphinx.util._uri import is_url
117116

tests/test_util/test_util.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,11 @@ def test_exported_attributes():
6969
assert sphinx.util.FilenameUniqDict is FilenameUniqDict
7070
with pytest.warns(RemovedInSphinx10Warning, match=r'deprecated.'):
7171
assert sphinx.util.DownloadFiles is DownloadFiles
72-
with pytest.warns(RemovedInSphinx10Warning, match=r'deprecated.'):
73-
assert sphinx.util.import_object is import_object
7472

7573
# Re-exported for backwards compatibility,
7674
# but not currently deprecated
7775
assert sphinx.util.encode_uri is encode_uri
76+
assert sphinx.util.import_object is import_object
7877
assert sphinx.util.isurl is is_url
7978
assert sphinx.util.parselinenos is parse_line_num_spec
8079
assert sphinx.util.patfilter is patfilter

0 commit comments

Comments
 (0)