trivial: add pylint disable comments for individual eval-used warnings

This commit is contained in:
Frédéric Péters 2021-04-03 10:01:09 +02:00
parent 8b839b4177
commit fd6873f087
6 changed files with 7 additions and 1 deletions

View File

@ -16,7 +16,6 @@ disable=
deprecated-module,
disallowed-name,
duplicate-code,
eval-used,
fixme,
global-variable-undefined,
import-outside-toplevel,

View File

@ -69,6 +69,7 @@ class Condition:
def evaluate_python(self, local_variables):
global_variables = get_publisher().get_global_eval_dict()
# noqa pylint: disable=eval-used
return eval(self.value, global_variables, local_variables)
def evaluate_django(self, local_variables):

View File

@ -281,6 +281,7 @@ def get_structured_items(data_source, mode=None):
global_eval_dict = get_publisher().get_global_eval_dict()
global_eval_dict.update(data_source_functions)
try:
# noqa pylint: disable=eval-used
value = eval(data_source.get('value'), global_eval_dict, variables)
if not isinstance(value, collections.Iterable):
try:

View File

@ -483,6 +483,7 @@ class Field:
elif t == 'formula':
formula = self.prefill.get('value')
try:
# noqa pylint: disable=eval-used
ret = eval(
formula,
get_publisher().get_global_eval_dict(),

View File

@ -52,6 +52,7 @@ class Script:
data['args'] = args
data['__file__'] = self.__file__
code_object = compile(self.code, self.script_name, 'exec')
# noqa pylint: disable=eval-used
eval(code_object, data)
return data.get('result')

View File

@ -1300,6 +1300,7 @@ class WorkflowGlobalActionTimeoutTrigger(WorkflowGlobalActionTrigger):
elif self.anchor == 'python':
variables = get_publisher().substitutions.get_context_variables()
try:
# noqa pylint: disable=eval-used
anchor_date = eval(self.anchor_expression, get_publisher().get_global_eval_dict(), variables)
except Exception:
# get the variables in the locals() namespace so they are
@ -2122,6 +2123,7 @@ class WorkflowStatusItem(XmlSerialisable):
return var
try:
# noqa pylint: disable=eval-used
return eval(expression['value'], get_publisher().get_global_eval_dict(), vars)
except Exception as e:
if record_errors:
@ -2314,6 +2316,7 @@ class WorkflowStatusItem(XmlSerialisable):
try:
# execute any Python expression
# and magically convert string like 'form_var_*_raw' to a PicklableUpload
# noqa pylint: disable=eval-used
picklableupload = eval(attachment, global_eval_dict, local_eval_dict)
except Exception:
get_publisher().notify_of_exception(sys.exc_info(), context='[workflow/attachments]')