1 | # operation flags
|
2 | OP_ASSIGN = 'OP_ASSIGN'
|
3 | OP_DELETE = 'OP_DELETE'
|
4 | OP_APPLY = 'OP_APPLY'
|
5 |
|
6 | SC_LOCAL = 1
|
7 | SC_GLOBAL_IMPLICIT = 2
|
8 | SC_GLOBAL_EXPLICIT = 3
|
9 | SC_FREE = 4
|
10 | SC_CELL = 5
|
11 | SC_UNKNOWN = 6
|
12 |
|
13 | # NOTE: These really should be an ASDL enum types so we get proper names.
|
14 | # Although we will also need reflection to iterate over them.
|
15 | VALUE_TO_NAME = {}
|
16 |
|
17 | def _const(name, val):
|
18 | VALUE_TO_NAME[val] = name
|
19 | globals()[name] = val
|
20 |
|
21 |
|
22 | _const('CO_OPTIMIZED', 0x0001)
|
23 | _const('CO_NEWLOCALS', 0x0002)
|
24 | _const('CO_VARARGS', 0x0004)
|
25 | _const('CO_VARKEYWORDS', 0x0008)
|
26 | _const('CO_NESTED', 0x0010)
|
27 | _const('CO_GENERATOR', 0x0020)
|
28 | _const('CO_FUTURE_DIVISION', 0x2000)
|
29 | _const('CO_FUTURE_ABSIMPORT', 0x4000)
|
30 | _const('CO_FUTURE_WITH_STATEMENT', 0x8000)
|
31 | # The only FUTURE that's relevant to us. Everything else is the default.
|
32 | _const('CO_FUTURE_PRINT_FUNCTION', 0x10000)
|