Projet

Général

Profil

0011-trivial-add-pylint-disable-comments-for-individual-e.patch

Frédéric Péters, 04 avril 2021 17:20

Télécharger (3,99 ko)

Voir les différences:

Subject: [PATCH 11/15] trivial: add pylint disable comments for individual
 eval-used warnings (#52732)

 pylint.rc           | 1 -
 wcs/conditions.py   | 1 +
 wcs/data_sources.py | 1 +
 wcs/fields.py       | 1 +
 wcs/scripts.py      | 1 +
 wcs/workflows.py    | 3 +++
 6 files changed, 7 insertions(+), 1 deletion(-)
pylint.rc
16 16
    deprecated-module,
17 17
    disallowed-name,
18 18
    duplicate-code,
19
    eval-used,
20 19
    fixme,
21 20
    global-variable-undefined,
22 21
    import-outside-toplevel,
wcs/conditions.py
69 69

  
70 70
    def evaluate_python(self, local_variables):
71 71
        global_variables = get_publisher().get_global_eval_dict()
72
        # noqa pylint: disable=eval-used
72 73
        return eval(self.value, global_variables, local_variables)
73 74

  
74 75
    def evaluate_django(self, local_variables):
wcs/data_sources.py
281 281
        global_eval_dict = get_publisher().get_global_eval_dict()
282 282
        global_eval_dict.update(data_source_functions)
283 283
        try:
284
            # noqa pylint: disable=eval-used
284 285
            value = eval(data_source.get('value'), global_eval_dict, variables)
285 286
            if not isinstance(value, collections.Iterable):
286 287
                try:
wcs/fields.py
483 483
        elif t == 'formula':
484 484
            formula = self.prefill.get('value')
485 485
            try:
486
                # noqa pylint: disable=eval-used
486 487
                ret = eval(
487 488
                    formula,
488 489
                    get_publisher().get_global_eval_dict(),
wcs/scripts.py
52 52
        data['args'] = args
53 53
        data['__file__'] = self.__file__
54 54
        code_object = compile(self.code, self.script_name, 'exec')
55
        # noqa pylint: disable=eval-used
55 56
        eval(code_object, data)
56 57
        return data.get('result')
57 58

  
wcs/workflows.py
1300 1300
        elif self.anchor == 'python':
1301 1301
            variables = get_publisher().substitutions.get_context_variables()
1302 1302
            try:
1303
                # noqa pylint: disable=eval-used
1303 1304
                anchor_date = eval(self.anchor_expression, get_publisher().get_global_eval_dict(), variables)
1304 1305
            except Exception:
1305 1306
                # get the variables in the locals() namespace so they are
......
2127 2128
                return var
2128 2129

  
2129 2130
        try:
2131
            # noqa pylint: disable=eval-used
2130 2132
            return eval(expression['value'], get_publisher().get_global_eval_dict(), vars)
2131 2133
        except Exception as e:
2132 2134
            if record_errors:
......
2319 2321
                try:
2320 2322
                    # execute any Python expression
2321 2323
                    # and magically convert string like 'form_var_*_raw' to a PicklableUpload
2324
                    # noqa pylint: disable=eval-used
2322 2325
                    picklableupload = eval(attachment, global_eval_dict, local_eval_dict)
2323 2326
                except Exception:
2324 2327
                    get_publisher().notify_of_exception(sys.exc_info(), context='[workflow/attachments]')
2325
-