|
4 | 4 | import _symtable |
5 | 5 | from _symtable import USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, \ |
6 | 6 | DEF_STAR, DEF_DOUBLESTAR, DEF_INTUPLE, DEF_FREE, \ |
7 | | - DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND |
| 7 | + DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND, \ |
| 8 | + OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC |
8 | 9 |
|
9 | 10 | import weakref |
10 | 11 |
|
@@ -97,7 +98,12 @@ def has_children(self): |
97 | 98 | return bool(self._table.children) |
98 | 99 |
|
99 | 100 | def has_exec(self): |
100 | | - return bool() |
| 101 | + """Return true if the scope uses exec""" |
| 102 | + return bool(self._table.optimized & (OPT_EXEC | OPT_BARE_EXEC)) |
| 103 | + |
| 104 | + def has_import_star(self): |
| 105 | + """Return true if the scope uses import *""" |
| 106 | + return bool(self._table.optimized & OPT_IMPORT_STAR) |
101 | 107 |
|
102 | 108 | def get_identifiers(self): |
103 | 109 | return self._table.symbols.keys() |
@@ -190,10 +196,10 @@ def is_global(self): |
190 | 196 | or (self.__flags & DEF_FREE_GLOBAL)) |
191 | 197 |
|
192 | 198 | def is_vararg(self): |
193 | | - return bool(self.flag & DEF_STAR) |
| 199 | + return bool(self.__flags & DEF_STAR) |
194 | 200 |
|
195 | 201 | def is_keywordarg(self): |
196 | | - return bool(self.__flags & DEF_STARSTAR) |
| 202 | + return bool(self.__flags & DEF_DOUBLESTAR) |
197 | 203 |
|
198 | 204 | def is_local(self): |
199 | 205 | return bool(self.__flags & DEF_BOUND) |
|
0 commit comments