summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2016-06-01 12:46:43 +0200
committerOlivier Dony <odo@openerp.com>2016-06-02 00:50:43 +0200
commit5a8a17b4e033199c81e3610d53f60367c98a75ac (patch)
tree232796f09de7b54408f349b3931259774d460346
parentef0d05b6e00736e6bb69b4f0e5a849f4d8246657 (diff)
[IMP] safe_eval: unused import, linting
-rw-r--r--openerp/tools/safe_eval.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/openerp/tools/safe_eval.py b/openerp/tools/safe_eval.py
index ffbf7e46ffd..262535c0514 100644
--- a/openerp/tools/safe_eval.py
+++ b/openerp/tools/safe_eval.py
@@ -15,7 +15,7 @@ condition/math builtins.
# - safe_eval in lp:~xrg/openobject-server/optimize-5.0
# - safe_eval in tryton http://hg.tryton.org/hgwebdir.cgi/trytond/rev/bbb5f73319ad
-from opcode import HAVE_ARGUMENT, opmap, opname
+from opcode import HAVE_ARGUMENT, opmap
from psycopg2 import OperationalError
from types import CodeType
import logging
@@ -50,7 +50,7 @@ _EXPR_OPCODES = _CONST_OPCODES.union(set(opmap[x] for x in [
'INPLACE_DIVIDE', 'INPLACE_REMAINDER', 'INPLACE_POWER',
'INPLACE_LEFTSHIFT', 'INPLACE_RIGHTSHIFT', 'INPLACE_AND',
'INPLACE_XOR','INPLACE_OR'
- ] if x in opmap))
+] if x in opmap))
_SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
'LOAD_NAME', 'CALL_FUNCTION', 'COMPARE_OP', 'LOAD_ATTR',
@@ -63,7 +63,7 @@ _SAFE_OPCODES = _EXPR_OPCODES.union(set(opmap[x] for x in [
'POP_JUMP_IF_TRUE', 'SETUP_EXCEPT', 'END_FINALLY',
'LOAD_FAST', 'STORE_FAST', 'DELETE_FAST', 'UNPACK_SEQUENCE',
'LOAD_GLOBAL', # Only allows access to restricted globals
- ] if x in opmap))
+] if x in opmap))
_logger = logging.getLogger(__name__)
@@ -277,7 +277,7 @@ def safe_eval(expr, globals_dict=None, locals_dict=None, mode="eval", nocopy=Fal
if not nocopy:
# isinstance() does not work below, we want *exactly* the dict class
if (globals_dict is not None and type(globals_dict) is not dict) \
- or (locals_dict is not None and type(locals_dict) is not dict):
+ or (locals_dict is not None and type(locals_dict) is not dict):
_logger.warning(
"Looks like you are trying to pass a dynamic environment, "
"you should probably pass nocopy=True to safe_eval().")