Skip to content

Commit 5930317

Browse files
authored
One more deprecation API documentation fix (#761)
1 parent 8ce269b commit 5930317

File tree

2 files changed

+10
-25
lines changed

2 files changed

+10
-25
lines changed

jsonargparse/_core.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,8 +1625,7 @@ def dump_header(self, dump_header: Optional[List[str]]):
16251625
self._dump_header = dump_header
16261626

16271627

1628-
from ._deprecated import instantiate_subclasses_patch, parse_as_dict_patch # noqa: E402
1628+
from ._deprecated import parse_as_dict_patch # noqa: E402
16291629

1630-
instantiate_subclasses_patch()
16311630
if "SPHINX_BUILD" not in os.environ:
16321631
parse_as_dict_patch()

jsonargparse/_deprecated.py

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -171,29 +171,6 @@ def patched_save(self, cfg: Union[Namespace, Dict[str, Any]], *args, multifile:
171171
ArgumentParser.save = patched_save
172172

173173

174-
@deprecated(
175-
"""
176-
instantiate_subclasses was deprecated in v4.0.0 and will be removed in v5.0.0.
177-
"""
178-
)
179-
def instantiate_subclasses(self, cfg: Namespace) -> Namespace:
180-
"""Calls instantiate_classes with instantiate_groups=False.
181-
182-
Args:
183-
cfg: The configuration object to use.
184-
185-
Returns:
186-
A configuration object with all subclasses instantiated.
187-
"""
188-
return self.instantiate_classes(cfg, instantiate_groups=False)
189-
190-
191-
def instantiate_subclasses_patch():
192-
from ._core import ArgumentParser
193-
194-
ArgumentParser.instantiate_subclasses = instantiate_subclasses
195-
196-
197174
@deprecated(
198175
"""
199176
ActionEnum was deprecated in v3.9.0 and will be removed in v5.0.0. Enums now
@@ -584,6 +561,15 @@ def error_handler(self, error_handler):
584561
else:
585562
raise ValueError("error_handler can be either a Callable or None.")
586563

564+
@deprecated(
565+
"""
566+
instantiate_subclasses was deprecated in v4.0.0 and will be removed in v5.0.0.
567+
Instead use instantiate_classes.
568+
"""
569+
)
570+
def instantiate_subclasses(self, cfg: Namespace) -> Namespace:
571+
return self.instantiate_classes(cfg, instantiate_groups=False) # type: ignore[attr-defined]
572+
587573
@deprecated(
588574
"""
589575
add_dataclass_arguments was deprecated in v4.35.0 and will be removed in

0 commit comments

Comments
 (0)