本文整理汇总了Python中pydevd_vars.makeValidXmlValue函数的典型用法代码示例。如果您正苦于以下问题:Python makeValidXmlValue函数的具体用法?Python makeValidXmlValue怎么用?Python makeValidXmlValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeValidXmlValue函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: makeThreadSuspendMessage
def makeThreadSuspendMessage(self, thread_id, frame, stop_reason, message):
""" <xml>
<thread id="id" stop_reason="reason">
<frame id="id" name="functionName " file="file" line="line">
<var variable stuffff....
</frame>
</thread>
"""
try:
cmdTextList = ["<xml>"]
if message:
message = pydevd_vars.makeValidXmlValue(str(message))
cmdTextList.append('<thread id="%s" stop_reason="%s" message="%s">' % (thread_id, stop_reason, message))
curFrame = frame
try:
while curFrame:
#print cmdText
myId = str(id(curFrame))
#print "id is ", myId
if curFrame.f_code is None:
break #Iron Python sometimes does not have it!
myName = curFrame.f_code.co_name #method name (if in method) or ? if global
if myName is None:
break #Iron Python sometimes does not have it!
#print "name is ", myName
filename, base = pydevd_file_utils.GetFilenameAndBase(curFrame)
myFile = pydevd_file_utils.NormFileToClient(filename)
#print "file is ", myFile
#myFile = inspect.getsourcefile(curFrame) or inspect.getfile(frame)
myLine = str(curFrame.f_lineno)
#print "line is ", myLine
#the variables are all gotten 'on-demand'
#variables = pydevd_vars.frameVarsToXML(curFrame.f_locals)
variables = ''
cmdTextList.append('<frame id="%s" name="%s" ' % (myId , pydevd_vars.makeValidXmlValue(myName)))
cmdTextList.append('file="%s" line="%s">"' % (quote(myFile, '/>_= \t'), myLine))
cmdTextList.append(variables)
cmdTextList.append("</frame>")
curFrame = curFrame.f_back
except :
traceback.print_exc()
cmdTextList.append("</thread></xml>")
cmdText = ''.join(cmdTextList)
return NetCommand(CMD_THREAD_SUSPEND, 0, cmdText)
except:
return self.makeErrorMessage(0, GetExceptionTracebackStr())
示例2: create_signature_message
def create_signature_message(signature):
cmdTextList = ["<xml>"]
cmdTextList.append('<call_signature file="%s" name="%s">' % (pydevd_vars.makeValidXmlValue(signature.file), pydevd_vars.makeValidXmlValue(signature.name)))
for arg in signature.args:
cmdTextList.append('<arg name="%s" type="%s"></arg>' % (pydevd_vars.makeValidXmlValue(arg[0]), pydevd_vars.makeValidXmlValue(arg[1])))
cmdTextList.append("</call_signature></xml>")
cmdText = ''.join(cmdTextList)
return NetCommand(CMD_SIGNATURE_CALL_TRACE, 0, cmdText)
示例3: makeSendCurrExceptionTraceMessage
def makeSendCurrExceptionTraceMessage(self, seq, thread_id, curr_frame_id, exc_type, exc_desc, trace_obj):
try:
while trace_obj.tb_next is not None:
trace_obj = trace_obj.tb_next
payload = str(curr_frame_id) + '\t' + pydevd_vars.makeValidXmlValue(str(exc_type)) + "\t" + \
pydevd_vars.makeValidXmlValue(str(exc_desc)) + "\t" + \
self.makeThreadSuspendStr(thread_id, trace_obj.tb_frame, CMD_SEND_CURR_EXCEPTION_TRACE)
return NetCommand(CMD_SEND_CURR_EXCEPTION_TRACE, seq, payload)
except Exception:
return self.makeErrorMessage(seq, GetExceptionTracebackStr())
示例4: create_signature_message
def create_signature_message(signature, return_info=None):
cmdTextList = ["<xml>"]
cmdTextList.append('<call_signature file="%s" name="%s">' % (pydevd_vars.makeValidXmlValue(signature.file), pydevd_vars.makeValidXmlValue(signature.name)))
if return_info:
cmdTextList.append('<return type="%s"></return>' % pydevd_vars.makeValidXmlValue(return_info))
else:
for arg in signature.args:
cmdTextList.append('<arg name="%s" type="%s"></arg>' % (pydevd_vars.makeValidXmlValue(arg[0]), pydevd_vars.makeValidXmlValue(arg[1])))
cmdTextList.append("</call_signature></xml>")
cmdText = ''.join(cmdTextList)
# myfile = open('/home/user/txt', 'a')
# myfile.writelines(cmdText + '\n=====\n')
return NetCommand(CMD_SIGNATURE_CALL_TRACE, 0, cmdText)
示例5: makeThreadSuspendMessage
def makeThreadSuspendMessage(self, thread_id, frame, stop_reason):
""" <xml>
<thread id="id" stop_reason="reason">
<frame id="id" name="functionName " file="file" line="line">
<var variable stuffff....
</frame>
</thread>
"""
try:
cmdTextList = ["<xml>"]
cmdTextList.append('<thread id="%s" stop_reason="%s">' % (thread_id, stop_reason))
curFrame = frame
while curFrame:
#print cmdText
myId = str(id(curFrame))
#print "id is ", myId
if curFrame.f_code is None:
break #Iron Python sometimes does not have it!
myName = curFrame.f_code.co_name #method name (if in method) or ? if global
if myName is None:
break #Iron Python sometimes does not have it!
#print "name is ", myName
myFile = pydevd_file_utils.NormFileToClient(curFrame.f_code.co_filename)
if file_system_encoding.lower() != "utf-8" and hasattr(myFile, "decode"):
# myFile is a byte string encoded using the file system encoding
# convert it to utf8
myFile = myFile.decode(file_system_encoding).encode("utf-8")
#print "file is ", myFile
#myFile = inspect.getsourcefile(curFrame) or inspect.getfile(frame)
myLine = str(curFrame.f_lineno)
#print "line is ", myLine
#the variables are all gotten 'on-demand'
#variables = pydevd_vars.frameVarsToXML(curFrame)
variables = ''
cmdTextList.append('<frame id="%s" name="%s" ' % (myId , pydevd_vars.makeValidXmlValue(myName)))
cmdTextList.append('file="%s" line="%s">"' % (quote(myFile, '/>_= \t'), myLine))
cmdTextList.append(variables)
cmdTextList.append("</frame>")
curFrame = curFrame.f_back
cmdTextList.append("</thread></xml>")
cmdText = ''.join(cmdTextList)
return NetCommand(CMD_THREAD_SUSPEND, 0, cmdText)
except:
return self.makeErrorMessage(0, GetExceptionTracebackStr())
示例6: get_text_list_for_frame
def get_text_list_for_frame(frame):
# partial copy-paste from makeThreadSuspendStr
curFrame = frame
cmdTextList = []
try:
while curFrame:
#print cmdText
myId = str(id(curFrame))
#print "id is ", myId
if curFrame.f_code is None:
break #Iron Python sometimes does not have it!
myName = curFrame.f_code.co_name #method name (if in method) or ? if global
if myName is None:
break #Iron Python sometimes does not have it!
#print "name is ", myName
filename, base = pydevd_file_utils.GetFilenameAndBase(curFrame)
myFile = pydevd_file_utils.NormFileToClient(filename)
if file_system_encoding.lower() != "utf-8" and hasattr(myFile, "decode"):
# myFile is a byte string encoded using the file system encoding
# convert it to utf8
myFile = myFile.decode(file_system_encoding).encode("utf-8")
#print "file is ", myFile
#myFile = inspect.getsourcefile(curFrame) or inspect.getfile(frame)
myLine = str(curFrame.f_lineno)
#print "line is ", myLine
#the variables are all gotten 'on-demand'
#variables = pydevd_vars.frameVarsToXML(curFrame.f_locals)
variables = ''
cmdTextList.append('<frame id="%s" name="%s" ' % (myId , pydevd_vars.makeValidXmlValue(myName)))
cmdTextList.append('file="%s" line="%s">"' % (quote(myFile, '/>_= \t'), myLine))
cmdTextList.append(variables)
cmdTextList.append("</frame>")
curFrame = curFrame.f_back
except :
traceback.print_exc()
return cmdTextList
示例7: makeIoMessage
def makeIoMessage(self, v, ctx, dbg=None):
'''
@param v: the message to pass to the debug server
@param ctx: 1 for stdio 2 for stderr
@param dbg: If not none, add to the writer
'''
try:
if len(v) > MAX_IO_MSG_SIZE:
v = v[0:MAX_IO_MSG_SIZE]
v += '...'
v = pydevd_vars.makeValidXmlValue(urllib.quote(v, '/>_= \t'))
net = NetCommand(str(CMD_WRITE_TO_CONSOLE), 0, '<xml><io s="%s" ctx="%s"/></xml>' % (v, ctx))
if dbg:
dbg.writer.addCommand(net)
except:
return self.makeErrorMessage(0, GetExceptionTracebackStr())
示例8: send_message
def send_message(event_class, time, name, thread_id, type, event, file, line, frame, lock_id=0, parent=None):
dbg = GlobalDebuggerHolder.globalDbg
cmdTextList = ['<xml>']
cmdTextList.append('<' + event_class)
cmdTextList.append(' time="%s"' % pydevd_vars.makeValidXmlValue(str(time)))
cmdTextList.append(' name="%s"' % pydevd_vars.makeValidXmlValue(name))
cmdTextList.append(' thread_id="%s"' % pydevd_vars.makeValidXmlValue(thread_id))
cmdTextList.append(' type="%s"' % pydevd_vars.makeValidXmlValue(type))
if type == "lock":
cmdTextList.append(' lock_id="%s"' % pydevd_vars.makeValidXmlValue(str(lock_id)))
if parent is not None:
cmdTextList.append(' parent="%s"' % pydevd_vars.makeValidXmlValue(parent))
cmdTextList.append(' event="%s"' % pydevd_vars.makeValidXmlValue(event))
cmdTextList.append(' file="%s"' % pydevd_vars.makeValidXmlValue(file))
cmdTextList.append(' line="%s"' % pydevd_vars.makeValidXmlValue(str(line)))
cmdTextList.append('></' + event_class + '>')
cmdTextList += get_text_list_for_frame(frame)
cmdTextList.append('</xml>')
text = ''.join(cmdTextList)
if dbg.writer is not None:
dbg.writer.addCommand(NetCommand(145, 0, text))
示例9: threadToXML
def threadToXML(self, thread):
""" thread information as XML """
name = pydevd_vars.makeValidXmlValue(thread.getName())
cmdText = '<thread name="%s" id="%s" />' % (urllib.quote(name), GetThreadId(thread))
return cmdText
示例10: makeValid
def makeValid(s):
return pydevd_vars.makeValidXmlValue(pydevd_vars.quote(s, '/>_= \t'))