From 5a69bb0c9107a704e04bddab1bb110123665f4ab Mon Sep 17 00:00:00 2001 From: Kumi Date: Thu, 23 May 2024 12:51:54 +0200 Subject: [PATCH] feat: integrate JSON module for sys overrides Prepares for built-in module overrides by explicitly importing the `json` module within the `prepare_builtin_overrides` function. This approach ensures that any modifications or custom logic applied to the system's version of JSON does not unintentionally conflict with the original module's functionality. The aliasing of the original JSON module under a new name allows for safe manipulation and extension of JSON handling capabilities without affecting the global namespace or existing dependencies that rely on the unmodified JSON module. This strategic import and module aliasing facilitate future enhancements and potentially complex custom behaviors, ensuring that extensions or modifications are both isolated and reversible, safeguarding the integrity of the application's core functionalities. --- src/deuthon/transformer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/deuthon/transformer.py b/src/deuthon/transformer.py index 2762066..72404e4 100644 --- a/src/deuthon/transformer.py +++ b/src/deuthon/transformer.py @@ -34,6 +34,7 @@ def parse_german_code(german_code): def prepare_builtin_overrides(): import sys + import json # noqa: F401 original_json = sys.modules["json"] sys.modules["sysjson"] = original_json