mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Debugger refactoring: get rid of "import *" statements
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
from _pydev_bundle.pydev_imports import xmlrpclib, _queue, Exec
|
||||
from _pydev_bundle._pydev_calltip_util import get_description
|
||||
from _pydev_imps._pydev_saved_modules import thread
|
||||
from _pydevd_bundle import pydevd_vars
|
||||
from _pydevd_bundle import pydevd_xml
|
||||
from _pydevd_bundle.pydevd_constants import IS_JYTHON
|
||||
from _pydevd_bundle.pydevd_utils import * # @UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_utils import to_string
|
||||
|
||||
|
||||
# =======================================================================================================================
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _pydevd_bundle.pydevd_constants import *
|
||||
from _pydevd_bundle.pydevd_constants import dict_iter_values, IS_PY24
|
||||
from _pydevd_bundle import pydevd_tracing
|
||||
import sys
|
||||
from _pydev_bundle import pydev_log
|
||||
|
||||
@@ -64,7 +64,7 @@ from _pydev_imps._pydev_saved_modules import thread
|
||||
from _pydev_imps._pydev_saved_modules import threading
|
||||
from _pydev_imps._pydev_saved_modules import socket
|
||||
from socket import socket, AF_INET, SOCK_STREAM, SHUT_RD, SHUT_WR
|
||||
from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_constants import DebugInfoHolder, dict_contains, get_thread_id, IS_JYTHON, IS_PY2, IS_PY3K, STATE_RUN
|
||||
|
||||
try:
|
||||
from urllib import quote_plus, unquote, unquote_plus
|
||||
@@ -72,9 +72,11 @@ except:
|
||||
from urllib.parse import quote_plus, unquote, unquote_plus #@Reimport @UnresolvedImport
|
||||
import pydevconsole
|
||||
from _pydevd_bundle import pydevd_vars
|
||||
from _pydevd_bundle import pydevd_xml
|
||||
from _pydevd_bundle import pydevd_tracing
|
||||
from _pydevd_bundle import pydevd_vm_type
|
||||
import pydevd_file_utils
|
||||
import sys
|
||||
import traceback
|
||||
from _pydevd_bundle.pydevd_utils import quote_smart as quote, compare_object_attrs, cmp_to_key, to_string
|
||||
from _pydev_bundle import pydev_log
|
||||
@@ -542,7 +544,7 @@ class NetCommandFactory:
|
||||
|
||||
def _thread_to_xml(self, thread):
|
||||
""" thread information as XML """
|
||||
name = pydevd_vars.make_valid_xml_value(thread.getName())
|
||||
name = pydevd_xml.make_valid_xml_value(thread.getName())
|
||||
cmdText = '<thread name="%s" id="%s" />' % (quote(name), get_thread_id(thread))
|
||||
return cmdText
|
||||
|
||||
@@ -558,7 +560,7 @@ class NetCommandFactory:
|
||||
|
||||
|
||||
def make_custom_frame_created_message(self, frameId, frameDescription):
|
||||
frameDescription = pydevd_vars.make_valid_xml_value(frameDescription)
|
||||
frameDescription = pydevd_xml.make_valid_xml_value(frameDescription)
|
||||
cmdText = '<xml><thread name="%s" id="%s"/></xml>' % (frameDescription, frameId)
|
||||
return NetCommand(CMD_THREAD_CREATE, 0, cmdText)
|
||||
|
||||
@@ -593,7 +595,7 @@ class NetCommandFactory:
|
||||
v = v[0:MAX_IO_MSG_SIZE]
|
||||
v += '...'
|
||||
|
||||
v = pydevd_vars.make_valid_xml_value(quote(v, '/>_= \t'))
|
||||
v = pydevd_xml.make_valid_xml_value(quote(v, '/>_= \t'))
|
||||
net = NetCommand(str(CMD_WRITE_TO_CONSOLE), 0, '<xml><io s="%s" ctx="%s"/></xml>' % (v, ctx))
|
||||
except:
|
||||
net = self.make_error_message(0, get_exception_traceback_str())
|
||||
@@ -625,7 +627,7 @@ class NetCommandFactory:
|
||||
"""
|
||||
cmd_text_list = ["<xml>"]
|
||||
append = cmd_text_list.append
|
||||
make_valid_xml_value = pydevd_vars.make_valid_xml_value
|
||||
make_valid_xml_value = pydevd_xml.make_valid_xml_value
|
||||
|
||||
if message:
|
||||
message = make_valid_xml_value(message)
|
||||
@@ -663,7 +665,7 @@ class NetCommandFactory:
|
||||
#print "line is ", myLine
|
||||
|
||||
#the variables are all gotten 'on-demand'
|
||||
#variables = pydevd_vars.frame_vars_to_xml(curr_frame.f_locals)
|
||||
#variables = pydevd_xml.frame_vars_to_xml(curr_frame.f_locals)
|
||||
|
||||
variables = ''
|
||||
append('<frame id="%s" name="%s" ' % (my_id , make_valid_xml_value(my_name)))
|
||||
@@ -744,8 +746,8 @@ class NetCommandFactory:
|
||||
while trace_obj.tb_next is not None:
|
||||
trace_obj = trace_obj.tb_next
|
||||
|
||||
exc_type = pydevd_vars.make_valid_xml_value(str(exc_type)).replace('\t', ' ') or 'exception: type unknown'
|
||||
exc_desc = pydevd_vars.make_valid_xml_value(str(exc_desc)).replace('\t', ' ') or 'exception: no description'
|
||||
exc_type = pydevd_xml.make_valid_xml_value(str(exc_type)).replace('\t', ' ') or 'exception: type unknown'
|
||||
exc_desc = pydevd_xml.make_valid_xml_value(str(exc_desc)).replace('\t', ' ') or 'exception: no description'
|
||||
|
||||
payload = str(curr_frame_id) + '\t' + exc_type + "\t" + exc_desc + "\t" + \
|
||||
self.make_thread_suspend_str(thread_id, trace_obj.tb_frame, CMD_SEND_CURR_EXCEPTION_TRACE, '')
|
||||
@@ -974,7 +976,7 @@ class InternalGetVariable(InternalThreadCommand):
|
||||
keys = sorted(keys, cmp=compare_object_attrs) #Jython 2.1 does not have it (and all must be compared as strings).
|
||||
|
||||
for k in keys:
|
||||
xml += pydevd_vars.var_to_xml(valDict[k], to_string(k))
|
||||
xml += pydevd_xml.var_to_xml(valDict[k], to_string(k))
|
||||
|
||||
xml += "</xml>"
|
||||
cmd = dbg.cmd_factory.make_get_variable_message(self.sequence, xml)
|
||||
@@ -1030,7 +1032,7 @@ class InternalChangeVariable(InternalThreadCommand):
|
||||
try:
|
||||
result = pydevd_vars.change_attr_expression(self.thread_id, self.frame_id, self.attr, self.expression, dbg)
|
||||
xml = "<xml>"
|
||||
xml += pydevd_vars.var_to_xml(result, "")
|
||||
xml += pydevd_xml.var_to_xml(result, "")
|
||||
xml += "</xml>"
|
||||
cmd = dbg.cmd_factory.make_variable_changed_message(self.sequence, xml)
|
||||
dbg.writer.add_command(cmd)
|
||||
@@ -1055,7 +1057,7 @@ class InternalGetFrame(InternalThreadCommand):
|
||||
frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
|
||||
if frame is not None:
|
||||
xml = "<xml>"
|
||||
xml += pydevd_vars.frame_vars_to_xml(frame.f_locals)
|
||||
xml += pydevd_xml.frame_vars_to_xml(frame.f_locals)
|
||||
del frame
|
||||
xml += "</xml>"
|
||||
cmd = dbg.cmd_factory.make_get_frame_message(self.sequence, xml)
|
||||
@@ -1092,7 +1094,7 @@ class InternalEvaluateExpression(InternalThreadCommand):
|
||||
if self.temp_name != "":
|
||||
pydevd_vars.change_attr_expression(self.thread_id, self.frame_id, self.temp_name, self.expression, dbg, result)
|
||||
xml = "<xml>"
|
||||
xml += pydevd_vars.var_to_xml(result, self.expression, self.doTrim)
|
||||
xml += pydevd_xml.var_to_xml(result, self.expression, self.doTrim)
|
||||
xml += "</xml>"
|
||||
cmd = dbg.cmd_factory.make_evaluate_expression_message(self.sequence, xml)
|
||||
dbg.writer.add_command(cmd)
|
||||
@@ -1163,7 +1165,7 @@ class InternalGetDescription(InternalThreadCommand):
|
||||
try:
|
||||
frame = pydevd_vars.find_frame(self.thread_id, self.frame_id)
|
||||
description = pydevd_console.get_description(frame, self.thread_id, self.frame_id, self.expression)
|
||||
description = pydevd_vars.make_valid_xml_value(quote(description, '/>_= \t'))
|
||||
description = pydevd_xml.make_valid_xml_value(quote(description, '/>_= \t'))
|
||||
description_xml = '<xml><var name="" type="" value="%s"/></xml>' % description
|
||||
cmd = dbg.cmd_factory.make_get_description_message(self.sequence, description_xml)
|
||||
dbg.writer.add_command(cmd)
|
||||
@@ -1188,7 +1190,7 @@ class InternalGetBreakpointException(InternalThreadCommand):
|
||||
try:
|
||||
callstack = "<xml>"
|
||||
|
||||
makeValid = pydevd_vars.make_valid_xml_value
|
||||
makeValid = pydevd_xml.make_valid_xml_value
|
||||
|
||||
for filename, line, methodname, methodobj in self.stacktrace:
|
||||
if file_system_encoding.lower() != "utf-8" and hasattr(filename, "decode"):
|
||||
@@ -1374,7 +1376,7 @@ class InternalConsoleExec(InternalThreadCommand):
|
||||
|
||||
result = pydevconsole.console_exec(self.thread_id, self.frame_id, self.expression, dbg)
|
||||
xml = "<xml>"
|
||||
xml += pydevd_vars.var_to_xml(result, "")
|
||||
xml += pydevd_xml.var_to_xml(result, "")
|
||||
xml += "</xml>"
|
||||
cmd = dbg.cmd_factory.make_evaluate_expression_message(self.sequence, xml)
|
||||
dbg.writer.add_command(cmd)
|
||||
|
||||
@@ -11,7 +11,7 @@ from _pydev_bundle.pydev_override import overrides
|
||||
from _pydevd_bundle import pydevd_save_locals
|
||||
from _pydevd_bundle.pydevd_io import IOBuf
|
||||
from _pydevd_bundle.pydevd_tracing import get_exception_traceback_str
|
||||
from _pydevd_bundle.pydevd_vars import make_valid_xml_value
|
||||
from _pydevd_bundle.pydevd_xml import make_valid_xml_value
|
||||
|
||||
CONSOLE_OUTPUT = "output"
|
||||
CONSOLE_ERROR = "error"
|
||||
|
||||
@@ -138,8 +138,6 @@ if USE_LIB_COPY:
|
||||
protect_libraries_from_patching()
|
||||
|
||||
|
||||
from _pydev_imps._pydev_saved_modules import threading
|
||||
|
||||
from _pydev_imps._pydev_saved_modules import thread
|
||||
_nextThreadIdLock = thread.allocate_lock()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_constants import dict_pop, get_thread_id, Null
|
||||
from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame
|
||||
from _pydev_imps._pydev_saved_modules import thread
|
||||
threadingCurrentThread = threading.currentThread
|
||||
from _pydev_imps._pydev_saved_modules import thread, threading
|
||||
import sys
|
||||
|
||||
DEBUG = False
|
||||
|
||||
@@ -63,7 +63,7 @@ class CustomFrame:
|
||||
def add_custom_frame(frame, name, thread_id):
|
||||
CustomFramesContainer.custom_frames_lock.acquire()
|
||||
try:
|
||||
curr_thread_id = get_thread_id(threadingCurrentThread())
|
||||
curr_thread_id = get_thread_id(threading.currentThread())
|
||||
next_id = CustomFramesContainer._next_frame_id = CustomFramesContainer._next_frame_id + 1
|
||||
|
||||
# Note: the frame id kept contains an id and thread information on the thread where the frame was added
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'''For debug purpose we are replacing actual builtin property by the debug property
|
||||
'''
|
||||
from _pydevd_bundle.pydevd_comm import get_global_debugger
|
||||
from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_constants import DebugInfoHolder, IS_PY3K
|
||||
from _pydevd_bundle import pydevd_tracing
|
||||
|
||||
#=======================================================================================================================
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_constants import get_frame
|
||||
from _pydev_imps._pydev_saved_modules import thread
|
||||
|
||||
try:
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
resolution/conversion to XML.
|
||||
"""
|
||||
import pickle
|
||||
from _pydevd_bundle.pydevd_constants import * # @UnusedWildImport
|
||||
from types import * # @UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_constants import dict_contains, get_frame, get_thread_id
|
||||
|
||||
from _pydevd_bundle.pydevd_custom_frames import get_custom_frame
|
||||
from _pydevd_bundle.pydevd_xml import *
|
||||
from _pydevd_bundle.pydevd_xml import ExceptionOnEvaluate, get_type, var_to_xml
|
||||
from _pydev_imps._pydev_saved_modules import thread
|
||||
|
||||
try:
|
||||
|
||||
@@ -2,7 +2,7 @@ from _pydev_bundle import pydev_log
|
||||
import traceback
|
||||
from _pydevd_bundle import pydevd_resolver
|
||||
import sys
|
||||
from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_constants import dict_keys, IS_PY3K, MAXIMUM_VARIABLE_REPRESENTATION_SIZE, RETURN_VALUES_DICT
|
||||
|
||||
from _pydev_bundle.pydev_imports import quote
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
'''
|
||||
Entry point module to run a file in the interactive console.
|
||||
'''
|
||||
from pydevconsole import *
|
||||
import os
|
||||
import sys
|
||||
from pydevconsole import do_exit, InterpreterInterface, process_exec_queue, start_console_server
|
||||
from _pydev_bundle.pydev_console_utils import BaseStdIn
|
||||
from _pydev_imps._pydev_saved_modules import threading
|
||||
|
||||
from _pydev_bundle import pydev_imports
|
||||
from _pydevd_bundle.pydevd_utils import save_main_module
|
||||
|
||||
@@ -41,12 +41,11 @@
|
||||
|
||||
|
||||
|
||||
from _pydevd_bundle.pydevd_constants import * #@UnusedWildImport
|
||||
from _pydevd_bundle.pydevd_constants import IS_PY2, IS_PY3K
|
||||
from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
|
||||
import os.path
|
||||
import sys
|
||||
import traceback
|
||||
import types
|
||||
|
||||
os_normcase = os.path.normcase
|
||||
basename = os.path.basename
|
||||
|
||||
Reference in New Issue
Block a user