summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-06-20 12:08:07 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:37 +0100
commitef1de9ecaf73e28234d284b79ec45e084d0f0c53 (patch)
tree417f87922c1a2fa4a3bbd4b35e0772221f96641e
parent20dc452614c991d1a4f5b7dcc1307cd03cba0c55 (diff)
downloadpoky-ef1de9ecaf73e28234d284b79ec45e084d0f0c53.tar.gz
Apply some 2to3 refactorings
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rwxr-xr-xbitbake/bin/bitbake2
-rwxr-xr-xbitbake/bin/bitdoc26
-rw-r--r--bitbake/lib/bb/COW.py6
-rw-r--r--bitbake/lib/bb/cooker.py18
-rw-r--r--bitbake/lib/bb/fetch/__init__.py2
-rw-r--r--bitbake/lib/bb/parse/ast.py13
-rw-r--r--bitbake/lib/bb/runqueue.py2
-rw-r--r--bitbake/lib/bb/shell.py9
-rw-r--r--bitbake/lib/bb/ui/knotty.py2
-rw-r--r--bitbake/lib/bb/ui/ncurses.py2
-rw-r--r--bitbake/lib/bb/utils.py4
11 files changed, 43 insertions, 43 deletions
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index 34cfadb986..fdf1e20f84 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -200,7 +200,7 @@ Default BBFILES are the .bb files in the current directory.""")
200 else: 200 else:
201 try: 201 try:
202 return_value = ui_init(serverConnection.connection, serverConnection.events) 202 return_value = ui_init(serverConnection.connection, serverConnection.events)
203 except Exception, e: 203 except Exception as e:
204 print "FATAL: Unable to start to '%s' UI: %s" % (ui, e) 204 print "FATAL: Unable to start to '%s' UI: %s" % (ui, e)
205 raise 205 raise
206 finally: 206 finally:
diff --git a/bitbake/bin/bitdoc b/bitbake/bin/bitdoc
index 4940f660a6..8043b2bd1c 100755
--- a/bitbake/bin/bitdoc
+++ b/bitbake/bin/bitdoc
@@ -48,7 +48,7 @@ class HTMLFormatter:
48 From pydoc... almost identical at least 48 From pydoc... almost identical at least
49 """ 49 """
50 while pairs: 50 while pairs:
51 (a,b) = pairs[0] 51 (a, b) = pairs[0]
52 text = join(split(text, a), b) 52 text = join(split(text, a), b)
53 pairs = pairs[1:] 53 pairs = pairs[1:]
54 return text 54 return text
@@ -87,7 +87,7 @@ class HTMLFormatter:
87 87
88 return txt + ",".join(txts) 88 return txt + ",".join(txts)
89 89
90 def groups(self,item): 90 def groups(self, item):
91 """ 91 """
92 Create HTML to link to related groups 92 Create HTML to link to related groups
93 """ 93 """
@@ -99,12 +99,12 @@ class HTMLFormatter:
99 txt = "<p><b>See also:</b><br>" 99 txt = "<p><b>See also:</b><br>"
100 txts = [] 100 txts = []
101 for group in item.groups(): 101 for group in item.groups():
102 txts.append( """<a href="group%s.html">%s</a> """ % (group,group) ) 102 txts.append( """<a href="group%s.html">%s</a> """ % (group, group) )
103 103
104 return txt + ",".join(txts) 104 return txt + ",".join(txts)
105 105
106 106
107 def createKeySite(self,item): 107 def createKeySite(self, item):
108 """ 108 """
109 Create a site for a key. It contains the header/navigator, a heading, 109 Create a site for a key. It contains the header/navigator, a heading,
110 the description, links to related keys and to the groups. 110 the description, links to related keys and to the groups.
@@ -149,8 +149,7 @@ class HTMLFormatter:
149 """ 149 """
150 150
151 groups = "" 151 groups = ""
152 sorted_groups = doc.groups() 152 sorted_groups = sorted(doc.groups())
153 sorted_groups.sort()
154 for group in sorted_groups: 153 for group in sorted_groups:
155 groups += """<a href="group%s.html">%s</a><br>""" % (group, group) 154 groups += """<a href="group%s.html">%s</a><br>""" % (group, group)
156 155
@@ -185,8 +184,7 @@ class HTMLFormatter:
185 Create Overview of all avilable keys 184 Create Overview of all avilable keys
186 """ 185 """
187 keys = "" 186 keys = ""
188 sorted_keys = doc.doc_keys() 187 sorted_keys = sorted(doc.doc_keys())
189 sorted_keys.sort()
190 for key in sorted_keys: 188 for key in sorted_keys:
191 keys += """<a href="key%s.html">%s</a><br>""" % (key, key) 189 keys += """<a href="key%s.html">%s</a><br>""" % (key, key)
192 190
@@ -214,7 +212,7 @@ class HTMLFormatter:
214 description += "<h2 Description of Grozp %s</h2>" % gr 212 description += "<h2 Description of Grozp %s</h2>" % gr
215 description += _description 213 description += _description
216 214
217 items.sort(lambda x,y:cmp(x.name(),y.name())) 215 items.sort(lambda x, y:cmp(x.name(), y.name()))
218 for group in items: 216 for group in items:
219 groups += """<a href="key%s.html">%s</a><br>""" % (group.name(), group.name()) 217 groups += """<a href="key%s.html">%s</a><br>""" % (group.name(), group.name())
220 218
@@ -343,7 +341,7 @@ class DocumentationItem:
343 def addGroup(self, group): 341 def addGroup(self, group):
344 self._groups.append(group) 342 self._groups.append(group)
345 343
346 def addRelation(self,relation): 344 def addRelation(self, relation):
347 self._related.append(relation) 345 self._related.append(relation)
348 346
349 def sort(self): 347 def sort(self):
@@ -396,7 +394,7 @@ class Documentation:
396 """ 394 """
397 return self.__groups.keys() 395 return self.__groups.keys()
398 396
399 def group_content(self,group_name): 397 def group_content(self, group_name):
400 """ 398 """
401 Return a list of keys/names that are in a specefic 399 Return a list of keys/names that are in a specefic
402 group or the empty list 400 group or the empty list
@@ -412,7 +410,7 @@ def parse_cmdline(args):
412 Parse the CMD line and return the result as a n-tuple 410 Parse the CMD line and return the result as a n-tuple
413 """ 411 """
414 412
415 parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__,__version__)) 413 parser = optparse.OptionParser( version = "Bitbake Documentation Tool Core version %s, %%prog version %s" % (bb.__version__, __version__))
416 usage = """%prog [options] 414 usage = """%prog [options]
417 415
418Create a set of html pages (documentation) for a bitbake.conf.... 416Create a set of html pages (documentation) for a bitbake.conf....
@@ -428,7 +426,7 @@ Create a set of html pages (documentation) for a bitbake.conf....
428 parser.add_option( "-D", "--debug", help = "Increase the debug level", 426 parser.add_option( "-D", "--debug", help = "Increase the debug level",
429 action = "count", dest = "debug", default = 0 ) 427 action = "count", dest = "debug", default = 0 )
430 428
431 parser.add_option( "-v","--verbose", help = "output more chit-char to the terminal", 429 parser.add_option( "-v", "--verbose", help = "output more chit-char to the terminal",
432 action = "store_true", dest = "verbose", default = False ) 430 action = "store_true", dest = "verbose", default = False )
433 431
434 options, args = parser.parse_args( sys.argv ) 432 options, args = parser.parse_args( sys.argv )
@@ -443,7 +441,7 @@ def main():
443 The main Method 441 The main Method
444 """ 442 """
445 443
446 (config_file,output_dir) = parse_cmdline( sys.argv ) 444 (config_file, output_dir) = parse_cmdline( sys.argv )
447 445
448 # right to let us load the file now 446 # right to let us load the file now
449 try: 447 try:
diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py
index 23a2cae2b4..6917ec378a 100644
--- a/bitbake/lib/bb/COW.py
+++ b/bitbake/lib/bb/COW.py
@@ -82,7 +82,7 @@ class COWDictMeta(COWMeta):
82 print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__) 82 print("Warning: Doing a copy because %s is a mutable type." % key, file=cls.__warn__)
83 try: 83 try:
84 value = value.copy() 84 value = value.copy()
85 except AttributeError, e: 85 except AttributeError as e:
86 value = copy.copy(value) 86 value = copy.copy(value)
87 setattr(cls, nkey, value) 87 setattr(cls, nkey, value)
88 return value 88 return value
@@ -106,7 +106,7 @@ class COWDictMeta(COWMeta):
106 raise AttributeError("key %s does not exist." % key) 106 raise AttributeError("key %s does not exist." % key)
107 107
108 return value 108 return value
109 except AttributeError, e: 109 except AttributeError as e:
110 if not default is cls.__getmarker__: 110 if not default is cls.__getmarker__:
111 return default 111 return default
112 112
@@ -239,7 +239,7 @@ if __name__ == "__main__":
239 239
240 try: 240 try:
241 b['dict2'] 241 b['dict2']
242 except KeyError, e: 242 except KeyError as e:
243 print("Okay!") 243 print("Okay!")
244 244
245 a['set'] = COWSetBase() 245 a['set'] = COWSetBase()
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 2b3dfb0cb4..6884e9a554 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -173,7 +173,7 @@ class BBCooker:
173 except bb.build.FuncFailed: 173 except bb.build.FuncFailed:
174 bb.msg.error(bb.msg.domain.Build, "task stack execution failed") 174 bb.msg.error(bb.msg.domain.Build, "task stack execution failed")
175 raise 175 raise
176 except bb.build.EventException, e: 176 except bb.build.EventException as e:
177 event = e.args[1] 177 event = e.args[1]
178 bb.msg.error(bb.msg.domain.Build, "%s event exception, aborting" % bb.event.getName(event)) 178 bb.msg.error(bb.msg.domain.Build, "%s event exception, aborting" % bb.event.getName(event))
179 raise 179 raise
@@ -259,10 +259,10 @@ class BBCooker:
259 if fn: 259 if fn:
260 try: 260 try:
261 envdata = self.bb_cache.loadDataFull(fn, self.configuration.data) 261 envdata = self.bb_cache.loadDataFull(fn, self.configuration.data)
262 except IOError, e: 262 except IOError as e:
263 bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e)) 263 bb.msg.error(bb.msg.domain.Parsing, "Unable to read %s: %s" % (fn, e))
264 raise 264 raise
265 except Exception, e: 265 except Exception as e:
266 bb.msg.error(bb.msg.domain.Parsing, "%s" % e) 266 bb.msg.error(bb.msg.domain.Parsing, "%s" % e)
267 raise 267 raise
268 268
@@ -272,7 +272,7 @@ class BBCooker:
272 with closing(StringIO()) as env: 272 with closing(StringIO()) as env:
273 data.emit_env(env, envdata, True) 273 data.emit_env(env, envdata, True)
274 bb.msg.plain(env.getvalue()) 274 bb.msg.plain(env.getvalue())
275 except Exception, e: 275 except Exception as e:
276 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e) 276 bb.msg.fatal(bb.msg.domain.Parsing, "%s" % e)
277 277
278 # emit the metadata which isnt valid shell 278 # emit the metadata which isnt valid shell
@@ -499,7 +499,7 @@ class BBCooker:
499 """Drop off into a shell""" 499 """Drop off into a shell"""
500 try: 500 try:
501 from bb import shell 501 from bb import shell
502 except ImportError, details: 502 except ImportError as details:
503 bb.msg.fatal(bb.msg.domain.Parsing, "Sorry, shell not available (%s)" % details ) 503 bb.msg.fatal(bb.msg.domain.Parsing, "Sorry, shell not available (%s)" % details )
504 else: 504 else:
505 shell.start( self ) 505 shell.start( self )
@@ -569,9 +569,9 @@ class BBCooker:
569 bb.event.fire(bb.event.ConfigParsed(), self.configuration.data) 569 bb.event.fire(bb.event.ConfigParsed(), self.configuration.data)
570 570
571 571
572 except IOError, e: 572 except IOError as e:
573 bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (files, str(e))) 573 bb.msg.fatal(bb.msg.domain.Parsing, "Error when parsing %s: %s" % (files, str(e)))
574 except bb.parse.ParseError, details: 574 except bb.parse.ParseError as details:
575 bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (files, details) ) 575 bb.msg.fatal(bb.msg.domain.Parsing, "Unable to parse %s (%s)" % (files, details) )
576 576
577 def handleCollections( self, collections ): 577 def handleCollections( self, collections ):
@@ -978,7 +978,7 @@ class CookerParser:
978 self.skipped += skipped 978 self.skipped += skipped
979 self.virtuals += virtuals 979 self.virtuals += virtuals
980 980
981 except IOError, e: 981 except IOError as e:
982 self.error += 1 982 self.error += 1
983 cooker.bb_cache.remove(f) 983 cooker.bb_cache.remove(f)
984 bb.msg.error(bb.msg.domain.Collection, "opening %s: %s" % (f, e)) 984 bb.msg.error(bb.msg.domain.Collection, "opening %s: %s" % (f, e))
@@ -987,7 +987,7 @@ class CookerParser:
987 cooker.bb_cache.remove(f) 987 cooker.bb_cache.remove(f)
988 cooker.bb_cache.sync() 988 cooker.bb_cache.sync()
989 raise 989 raise
990 except Exception, e: 990 except Exception as e:
991 self.error += 1 991 self.error += 1
992 cooker.bb_cache.remove(f) 992 cooker.bb_cache.remove(f)
993 bb.msg.error(bb.msg.domain.Collection, "%s while parsing %s" % (e, f)) 993 bb.msg.error(bb.msg.domain.Collection, "%s while parsing %s" % (e, f))
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py
index e87223ad6b..651fea8873 100644
--- a/bitbake/lib/bb/fetch/__init__.py
+++ b/bitbake/lib/bb/fetch/__init__.py
@@ -409,7 +409,7 @@ def runfetchcmd(cmd, d, quiet = False):
409 stdout_handle = os.popen(cmd + " 2>&1", "r") 409 stdout_handle = os.popen(cmd + " 2>&1", "r")
410 output = "" 410 output = ""
411 411
412 while 1: 412 while True:
413 line = stdout_handle.readline() 413 line = stdout_handle.readline()
414 if not line: 414 if not line:
415 break 415 break
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 4eabe5f2a1..02d682d88f 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -23,7 +23,7 @@
23 23
24import bb, re, string 24import bb, re, string
25from bb import methodpool 25from bb import methodpool
26from itertools import chain 26import itertools
27 27
28__word__ = re.compile(r"\S+") 28__word__ = re.compile(r"\S+")
29__parsed_methods__ = bb.methodpool.get_parsed_dict() 29__parsed_methods__ = bb.methodpool.get_parsed_dict()
@@ -31,7 +31,8 @@ _bbversions_re = re.compile(r"\[(?P<from>[0-9]+)-(?P<to>[0-9]+)\]")
31 31
32class StatementGroup(list): 32class StatementGroup(list):
33 def eval(self, data): 33 def eval(self, data):
34 map(lambda x: x.eval(data), self) 34 for statement in self:
35 statement.eval(data)
35 36
36class AstNode(object): 37class AstNode(object):
37 pass 38 pass
@@ -341,7 +342,7 @@ def _expand_versions(versions):
341 versions = iter(versions) 342 versions = iter(versions)
342 while True: 343 while True:
343 try: 344 try:
344 version = versions.next() 345 version = next(versions)
345 except StopIteration: 346 except StopIteration:
346 break 347 break
347 348
@@ -351,7 +352,7 @@ def _expand_versions(versions):
351 else: 352 else:
352 newversions = expand_one(version, int(range_ver.group("from")), 353 newversions = expand_one(version, int(range_ver.group("from")),
353 int(range_ver.group("to"))) 354 int(range_ver.group("to")))
354 versions = chain(newversions, versions) 355 versions = itertools.chain(newversions, versions)
355 356
356def multi_finalize(fn, d): 357def multi_finalize(fn, d):
357 safe_d = d 358 safe_d = d
@@ -417,7 +418,7 @@ def multi_finalize(fn, d):
417 safe_d.setVar("BBCLASSEXTEND", extended) 418 safe_d.setVar("BBCLASSEXTEND", extended)
418 _create_variants(datastores, extended.split(), extendfunc) 419 _create_variants(datastores, extended.split(), extendfunc)
419 420
420 for variant, variant_d in datastores.items(): 421 for variant, variant_d in datastores.iteritems():
421 if variant: 422 if variant:
422 try: 423 try:
423 finalize(fn, variant_d) 424 finalize(fn, variant_d)
@@ -425,7 +426,7 @@ def multi_finalize(fn, d):
425 bb.data.setVar("__SKIPPED", True, variant_d) 426 bb.data.setVar("__SKIPPED", True, variant_d)
426 427
427 if len(datastores) > 1: 428 if len(datastores) > 1:
428 variants = filter(None, datastores.keys()) 429 variants = filter(None, datastores.iterkeys())
429 safe_d.setVar("__VARIANTS", " ".join(variants)) 430 safe_d.setVar("__VARIANTS", " ".join(variants))
430 431
431 datastores[""] = d 432 datastores[""] = d
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 93fff5d27b..a4aea6c004 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -928,7 +928,7 @@ class RunQueue:
928 while True: 928 while True:
929 task = None 929 task = None
930 if self.stats.active < self.number_tasks: 930 if self.stats.active < self.number_tasks:
931 task = self.sched.next() 931 task = next(self.sched)
932 if task is not None: 932 if task is not None:
933 fn = self.taskData.fn_index[self.runq_fnid[task]] 933 fn = self.taskData.fn_index[self.runq_fnid[task]]
934 934
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py
index aeead679b2..f9ca9d5bd3 100644
--- a/bitbake/lib/bb/shell.py
+++ b/bitbake/lib/bb/shell.py
@@ -53,6 +53,7 @@ PROBLEMS:
53########################################################################## 53##########################################################################
54 54
55from __future__ import print_function 55from __future__ import print_function
56from functools import reduce
56try: 57try:
57 set 58 set
58except NameError: 59except NameError:
@@ -178,12 +179,12 @@ class BitBakeShellCommands:
178 print("ERROR: No Provider") 179 print("ERROR: No Provider")
179 last_exception = Providers.NoProvider 180 last_exception = Providers.NoProvider
180 181
181 except runqueue.TaskFailure, fnids: 182 except runqueue.TaskFailure as fnids:
182 for fnid in fnids: 183 for fnid in fnids:
183 print("ERROR: '%s' failed" % td.fn_index[fnid]) 184 print("ERROR: '%s' failed" % td.fn_index[fnid])
184 last_exception = runqueue.TaskFailure 185 last_exception = runqueue.TaskFailure
185 186
186 except build.EventException, e: 187 except build.EventException as e:
187 print("ERROR: Couldn't build '%s'" % names) 188 print("ERROR: Couldn't build '%s'" % names)
188 last_exception = e 189 last_exception = e
189 190
@@ -246,7 +247,7 @@ class BitBakeShellCommands:
246 cooker.buildFile(bf, cmd) 247 cooker.buildFile(bf, cmd)
247 except parse.ParseError: 248 except parse.ParseError:
248 print("ERROR: Unable to open or parse '%s'" % bf) 249 print("ERROR: Unable to open or parse '%s'" % bf)
249 except build.EventException, e: 250 except build.EventException as e:
250 print("ERROR: Couldn't build '%s'" % name) 251 print("ERROR: Couldn't build '%s'" % name)
251 last_exception = e 252 last_exception = e
252 253
@@ -644,7 +645,7 @@ def columnize( alist, width = 80 ):
644 return reduce(lambda line, word, width=width: '%s%s%s' % 645 return reduce(lambda line, word, width=width: '%s%s%s' %
645 (line, 646 (line,
646 ' \n'[(len(line[line.rfind('\n')+1:]) 647 ' \n'[(len(line[line.rfind('\n')+1:])
647 + len(word.split('\n',1)[0] 648 + len(word.split('\n', 1)[0]
648 ) >= width)], 649 ) >= width)],
649 word), 650 word),
650 alist 651 alist
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index bfdcc5b495..f81759abf8 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -123,7 +123,7 @@ def init(server, eventHandler):
123 x = event.sofar 123 x = event.sofar
124 y = event.total 124 y = event.total
125 if os.isatty(sys.stdout.fileno()): 125 if os.isatty(sys.stdout.fileno()):
126 sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100//y ) ) 126 sys.stdout.write("\rNOTE: Handling BitBake files: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100//y ) )
127 sys.stdout.flush() 127 sys.stdout.flush()
128 else: 128 else:
129 if x == 1: 129 if x == 1:
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py
index e3bca2af83..81dcb1998c 100644
--- a/bitbake/lib/bb/ui/ncurses.py
+++ b/bitbake/lib/bb/ui/ncurses.py
@@ -266,7 +266,7 @@ class NCursesUI:
266 mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked." 266 mw.appendText("Parsing finished. %d cached, %d parsed, %d skipped, %d masked."
267 % ( event.cached, event.parsed, event.skipped, event.masked )) 267 % ( event.cached, event.parsed, event.skipped, event.masked ))
268 else: 268 else:
269 mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( parsespin.next(), x, y, x*100/y ) ) 269 mw.setStatus("Parsing: %s (%04d/%04d) [%2d %%]" % ( next(parsespin), x, y, x*100/y ) )
270# if isinstance(event, bb.build.TaskFailed): 270# if isinstance(event, bb.build.TaskFailed):
271# if event.logfile: 271# if event.logfile:
272# if data.getVar("BBINCLUDELOGS", d): 272# if data.getVar("BBINCLUDELOGS", d):
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index a7fb44d7d2..c0cc9c6ea2 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -326,7 +326,7 @@ def better_exec(code, context, text, realfile):
326 """ 326 """
327 import bb.parse 327 import bb.parse
328 try: 328 try:
329 exec code in _context, context 329 exec(code, _context, context)
330 except: 330 except:
331 (t, value, tb) = sys.exc_info() 331 (t, value, tb) = sys.exc_info()
332 332
@@ -349,7 +349,7 @@ def better_exec(code, context, text, realfile):
349 raise 349 raise
350 350
351def simple_exec(code, context): 351def simple_exec(code, context):
352 exec code in _context, context 352 exec(code, _context, context)
353 353
354def better_eval(source, locals): 354def better_eval(source, locals):
355 return eval(source, _context, locals) 355 return eval(source, _context, locals)