Merge pull request #14675 from mvdbeek/somewhat_valid_dynamic_class_names

Generate somewhat valid SafeStringWrapper-wrapped class names
This commit is contained in:
Marius van den Beek
2022-09-22 16:27:38 +02:00
committed by GitHub
+3 -1
View File
@@ -168,7 +168,9 @@ def wrap_with_safe_string(value, no_wrap_classes=None):
value_mod = inspect.getmodule(value)
if value_mod:
wrapped_class_name = f"{value_mod.__name__}.{wrapped_class_name}"
wrapped_class_name = f"SafeStringWrapper({wrapped_class_name}:{','.join(sorted(map(str, no_wrap_classes)))})"
wrapped_class_name = (
f"SafeStringWrapper__{wrapped_class_name}__{'__'.join(sorted(c.__name__ for c in no_wrap_classes))}"
)
do_wrap_func_name = f"__do_wrap_{wrapped_class_name}"
do_wrap_func = __do_wrap
global_dict = globals()