mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-13 11:05:56 +00:00
Drop __annotations__ from task data (#834)
This commit is contained in:
parent
1789f9d6be
commit
b1206c5b3d
@ -160,6 +160,7 @@ class MissingProcessInfoError(Exception):
|
||||
class TaskDataBasedScriptEngineEnvironment(TaskDataEnvironment): # type: ignore
|
||||
def __init__(self, environment_globals: dict[str, Any]):
|
||||
self._last_result: dict[str, Any] = {}
|
||||
self._non_user_defined_keys = {"__annotations__"}
|
||||
super().__init__(environment_globals)
|
||||
|
||||
def execute(
|
||||
@ -169,6 +170,9 @@ class TaskDataBasedScriptEngineEnvironment(TaskDataEnvironment): # type: ignore
|
||||
external_context: dict[str, Any] | None = None,
|
||||
) -> bool:
|
||||
super().execute(script, context, external_context)
|
||||
for key in self._non_user_defined_keys:
|
||||
if key in context:
|
||||
context.pop(key)
|
||||
self._last_result = context
|
||||
return True
|
||||
|
||||
@ -199,7 +203,7 @@ class NonTaskDataBasedScriptEngineEnvironment(BasePythonScriptEngineEnvironment)
|
||||
|
||||
def __init__(self, environment_globals: dict[str, Any]):
|
||||
self.state: dict[str, Any] = {}
|
||||
self.non_user_defined_keys = set([*environment_globals.keys()] + ["__builtins__"])
|
||||
self.non_user_defined_keys = set([*environment_globals.keys()] + ["__builtins__", "__annotations__"])
|
||||
super().__init__(environment_globals)
|
||||
|
||||
def evaluate(
|
||||
|
Loading…
x
Reference in New Issue
Block a user