From 020977edd872575844a6bb54b1b6c3e0238851ca Mon Sep 17 00:00:00 2001 From: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com> Date: Wed, 22 Apr 2026 07:39:27 +0200 Subject: [PATCH] Remove no longer necessary code. --- jsonargparse/_core.py | 2 -- jsonargparse/_deprecated.py | 4 ---- jsonargparse/_namespace.py | 11 ----------- 3 files changed, 17 deletions(-) diff --git a/jsonargparse/_core.py b/jsonargparse/_core.py index a87393c7..44deef7a 100644 --- a/jsonargparse/_core.py +++ b/jsonargparse/_core.py @@ -56,7 +56,6 @@ NSKeyError, get_non_meta_sorted_keys, is_meta_key, - patch_namespace, recreate_branches, remove_meta, split_key_leaf, @@ -289,7 +288,6 @@ def _parse_known_args_internal(self, args=None, namespace=None, *, argcomplete: namespace = get_argcomplete_namespace(self, namespace) try: with ( - patch_namespace(), parser_context(parent_parser=self, lenient_check=True), ActionTypeHint.subclass_arg_context(self), suppress_required_actions(self), diff --git a/jsonargparse/_deprecated.py b/jsonargparse/_deprecated.py index 40c067a4..611830ee 100644 --- a/jsonargparse/_deprecated.py +++ b/jsonargparse/_deprecated.py @@ -525,10 +525,6 @@ def __call__(self, absolute: bool = True) -> str: return self._absolute if absolute else self._relative -class DebugException(Exception): - pass - - @deprecated(""" usage_and_exit_error_handler was deprecated in v4.20.0 and will be removed in v5.0.0. With the removal of error_handler, there is no longer a need for diff --git a/jsonargparse/_namespace.py b/jsonargparse/_namespace.py index 074be450..e8874237 100644 --- a/jsonargparse/_namespace.py +++ b/jsonargparse/_namespace.py @@ -3,7 +3,6 @@ import argparse from collections import OrderedDict from collections.abc import Iterator -from contextlib import contextmanager from typing import Any, Optional, Union __all__ = ["Namespace"] @@ -52,16 +51,6 @@ def recreate_branches(data, skip_keys=None): return new_data -@contextmanager -def patch_namespace(): - namespace_class = argparse.Namespace - argparse.Namespace = Namespace - try: - yield - finally: - argparse.Namespace = namespace_class - - class Namespace(argparse.Namespace): """Extension of argparse's Namespace to support nesting and subscript access."""