本文整理汇总了Python中pydevd_vars.findFrame函数的典型用法代码示例。如果您正苦于以下问题:Python findFrame函数的具体用法?Python findFrame怎么用?Python findFrame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findFrame函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: doIt
def doIt( self, dbg ):
""" Converts request into completions """
try:
remove_path = None
try:
frame = pydevd_vars.findFrame( self.thread_id, self.frame_id )
if frame is not None:
msg = _pydev_completer.GenerateCompletionsAsXML( frame, self.act_tok )
cmd = dbg.cmdFactory.makeGetCompletionsMessage( self.sequence, msg )
dbg.writer.addCommand( cmd )
else:
cmd = dbg.cmdFactory.makeErrorMessage( self.sequence, "InternalGetCompletions: Frame not found: %s from thread: %s" % ( self.frame_id, self.thread_id ) )
dbg.writer.addCommand( cmd )
finally:
if remove_path is not None:
sys.path.remove( remove_path )
except:
exc = GetExceptionTracebackStr()
sys.stderr.write( '%s\n' % ( exc, ) )
cmd = dbg.cmdFactory.makeErrorMessage( self.sequence, "Error evaluating expression " + exc )
dbg.writer.addCommand( cmd )
示例2: doIt
def doIt(self, dbg):
""" Converts request into completions """
try:
remove_path = None
try:
import _completer
except:
path = os.environ['PYDEV_COMPLETER_PYTHONPATH']
sys.path.append(path)
remove_path = path
import _completer
try:
frame = pydevd_vars.findFrame(self.thread_id, self.frame_id)
if frame is not None:
#Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
#(Names not resolved in generator expression in method)
#See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
updated_globals = {}
updated_globals.update(frame.f_globals)
updated_globals.update(frame.f_locals) #locals later because it has precedence over the actual globals
completer = _completer.Completer(updated_globals, None)
#list(tuple(name, descr, parameters, type))
completions = completer.complete(self.act_tok)
def makeValid(s):
return pydevd_vars.makeValidXmlValue(pydevd_vars.quote(s, '/>_= \t'))
msg = "<xml>"
for comp in completions:
msg += '<comp p0="%s" p1="%s" p2="%s" p3="%s"/>' % (makeValid(comp[0]), makeValid(comp[1]), makeValid(comp[2]), makeValid(comp[3]),)
msg += "</xml>"
cmd = dbg.cmdFactory.makeGetCompletionsMessage(self.sequence, msg)
dbg.writer.addCommand(cmd)
else:
cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "InternalGetCompletions: Frame not found: %s from thread: %s" % (self.frame_id, self.thread_id))
dbg.writer.addCommand(cmd)
finally:
if remove_path is not None:
sys.path.remove(remove_path)
except:
exc = GetExceptionTracebackStr()
sys.stderr.write('%s\n' % (exc,))
cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error evaluating expression " + exc)
dbg.writer.addCommand(cmd)
示例3: doIt
def doIt(self, dbg):
""" Converts request into python variable """
try:
try:
xml = "<xml>"
frame = pydevd_vars.findFrame(self.thread_id, self.frame_id)
xml += pydevd_vars.frameVarsToXML(frame)
del frame
xml += "</xml>"
cmd = dbg.cmdFactory.makeGetFrameMessage(self.sequence, xml)
dbg.writer.addCommand(cmd)
except pydevd_vars.FrameNotFoundError:
#pydevd_vars.dumpFrames(self.thread_id)
#don't print this error: frame not found: means that the client is not synchronized (but that's ok)
cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Frame not found: %s from thread: %s" % (self.frame_id, self.thread_id))
dbg.writer.addCommand(cmd)
except:
cmd = dbg.cmdFactory.makeErrorMessage(self.sequence, "Error resolving frame: %s from thread: %s" % (self.frame_id, self.thread_id))
dbg.writer.addCommand(cmd)
示例4: consoleExec
def consoleExec(thread_id, frame_id, expression):
"""returns 'False' in case expression is partialy correct
"""
frame = pydevd_vars.findFrame(thread_id, frame_id)
expression = str(expression.replace('@[email protected]', '\n'))
#Not using frame.f_globals because of https://sourceforge.net/tracker2/?func=detail&aid=2541355&group_id=85796&atid=577329
#(Names not resolved in generator expression in method)
#See message: http://mail.python.org/pipermail/python-list/2009-January/526522.html
updated_globals = {}
updated_globals.update(frame.f_globals)
updated_globals.update(frame.f_locals) #locals later because it has precedence over the actual globals
if IPYTHON:
return exec_expression(expression, updated_globals, frame.f_locals)
interpreter = ConsoleWriter()
try:
code = compile_command(expression)
except (OverflowError, SyntaxError, ValueError):
# Case 1
interpreter.showsyntaxerror()
return False
if code is None:
# Case 2
return True
#Case 3
try:
Exec(code, updated_globals, frame.f_locals)
except SystemExit:
raise
except:
interpreter.showtraceback()
return False