mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Reformat and clean up imports.
This commit is contained in:
parent
1fa0668fcc
commit
835ffe276b
6 changed files with 14 additions and 13 deletions
|
|
@ -321,7 +321,7 @@ wait_for_client = wait_for_client()
|
|||
|
||||
def is_client_connected():
|
||||
return Adapter.connected_event.is_set()
|
||||
|
||||
|
||||
|
||||
def breakpoint():
|
||||
ensure_logging()
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ def set_address(mode):
|
|||
port = int(port)
|
||||
except Exception:
|
||||
port = -1
|
||||
if not (0 <= port < 2 ** 16):
|
||||
if not (0 <= port < 2**16):
|
||||
raise ValueError("invalid port number")
|
||||
|
||||
options.mode = mode
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class ObjectInspector:
|
|||
def children(self) -> Iterable[ChildObject]:
|
||||
yield from self.named_children()
|
||||
yield from self.indexed_children()
|
||||
|
||||
|
||||
def indexed_children_count(self) -> int:
|
||||
try:
|
||||
return len(self.obj)
|
||||
|
|
@ -93,7 +93,7 @@ class ObjectInspector:
|
|||
|
||||
def indexed_children(self) -> Iterable[IndexedChildObject]:
|
||||
return ()
|
||||
|
||||
|
||||
def named_children_count(self) -> int:
|
||||
return len(tuple(self.named_children()))
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ from collections.abc import Iterable
|
|||
from itertools import count
|
||||
|
||||
from debugpy.common import log
|
||||
from debugpy.server.inspect import ObjectInspector, IndexedChildObject, LenChildObject
|
||||
from debugpy.server.inspect import ObjectInspector, IndexedChildObject
|
||||
from debugpy.server.safe_repr import SafeRepr
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ class Thread:
|
|||
)
|
||||
self.is_known_to_adapter = True
|
||||
return True
|
||||
|
||||
|
||||
def stack_trace_len(self) -> int:
|
||||
"""
|
||||
Returns the total count of frames in this thread's stack.
|
||||
|
|
@ -327,7 +327,7 @@ class StackFrame:
|
|||
result += ", internal=True"
|
||||
result += ")"
|
||||
return result
|
||||
|
||||
|
||||
@property
|
||||
def line(self) -> int:
|
||||
return self.python_frame.f_lineno
|
||||
|
|
@ -359,8 +359,10 @@ class StackFrame:
|
|||
Scope(self, "global", self.python_frame.f_globals),
|
||||
]
|
||||
return self._scopes
|
||||
|
||||
def evaluate(self, source: str, mode: Literal["eval", "exec", "single"] = "eval") -> object:
|
||||
|
||||
def evaluate(
|
||||
self, source: str, mode: Literal["eval", "exec", "single"] = "eval"
|
||||
) -> object:
|
||||
code = compile(source, "<string>", mode)
|
||||
return eval(code, self.python_frame.f_globals, self.python_frame.f_locals)
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Log:
|
|||
self.error = lambda *args, **kwargs: log.error("{0}", *args, **kwargs)
|
||||
self.exception = lambda *args, **kwargs: log.exception("{0}", *args, **kwargs)
|
||||
|
||||
#self.debug = nop # TODO: improve logging performance enough to enable this.
|
||||
# self.debug = nop # TODO: improve logging performance enough to enable this.
|
||||
|
||||
|
||||
log = Log()
|
||||
|
|
@ -442,9 +442,7 @@ class Tracer:
|
|||
)
|
||||
self._process_exception(exc, thread, "reraise")
|
||||
|
||||
def _sys_excepthook(
|
||||
self, exc_type: type, exc: BaseException, tb: TracebackType
|
||||
):
|
||||
def _sys_excepthook(self, exc_type: type, exc: BaseException, tb: TracebackType):
|
||||
thread = self._this_thread()
|
||||
if thread is None or not thread.is_traced:
|
||||
return
|
||||
|
|
@ -522,5 +520,6 @@ class Tracer:
|
|||
f"sys.monitoring event: EXCEPTION_HANDLED({code}, {ip}, {type(exc).__qualname__})"
|
||||
)
|
||||
|
||||
|
||||
tracer = Tracer()
|
||||
del Tracer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue