mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Review feedback
This commit is contained in:
parent
1093a33810
commit
ffe77781d3
5 changed files with 8 additions and 8 deletions
|
|
@ -201,7 +201,7 @@ class PluginManager(object):
|
|||
|
||||
def change_variable(self, frame, attr, expression, scope=None):
|
||||
for plugin in self.active_plugins:
|
||||
ret = plugin.change_variable(frame, attr, expression, self.EMPTY_SENTINEL)
|
||||
ret = plugin.change_variable(frame, attr, expression, self.EMPTY_SENTINEL, scope)
|
||||
if ret is not self.EMPTY_SENTINEL:
|
||||
return ret
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from _pydevd_bundle import pydevd_vars
|
|||
from _pydev_bundle.pydev_imports import Exec
|
||||
from _pydevd_bundle.pydevd_frame_utils import FramesList
|
||||
from _pydevd_bundle.pydevd_utils import ScopeRequest, DAPGrouper, Timer
|
||||
from typing import Optional, Union
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class _AbstractVariable(object):
|
||||
|
|
@ -200,7 +200,7 @@ class _ObjectVariable(_AbstractVariable):
|
|||
|
||||
return children_variables
|
||||
|
||||
def change_variable(self, name, value, py_db, fmt=None, scope: Union[ScopeRequest, None]=None):
|
||||
def change_variable(self, name, value, py_db, fmt=None, scope: Optional[ScopeRequest]=None):
|
||||
children_variable = self.get_child_variable_named(name)
|
||||
if children_variable is None:
|
||||
return None
|
||||
|
|
@ -255,7 +255,7 @@ class _FrameVariable(_AbstractVariable):
|
|||
self._register_variable = register_variable
|
||||
self._register_variable(self)
|
||||
|
||||
def change_variable(self, name, value, py_db, fmt=None, scope: Union[ScopeRequest, None]=None):
|
||||
def change_variable(self, name, value, py_db, fmt=None, scope: Optional[ScopeRequest]=None):
|
||||
frame = self.frame
|
||||
pydevd_vars.change_attr_expression(frame, name, value, py_db, scope=scope)
|
||||
return self.get_child_variable_named(name, fmt=fmt, scope=scope)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import inspect
|
|||
from _pydevd_bundle.pydevd_daemon_thread import PyDBDaemonThread
|
||||
from _pydevd_bundle.pydevd_save_locals import update_globals_and_locals
|
||||
from functools import lru_cache
|
||||
from typing import Union
|
||||
from typing import Optional
|
||||
|
||||
SENTINEL_VALUE = []
|
||||
|
||||
|
|
@ -596,7 +596,7 @@ def evaluate_expression(py_db, frame, expression, is_exec):
|
|||
del frame
|
||||
|
||||
|
||||
def change_attr_expression(frame, attr, expression, dbg, value=SENTINEL_VALUE, /, scope: Union[ScopeRequest, None]=None):
|
||||
def change_attr_expression(frame, attr, expression, dbg, value=SENTINEL_VALUE, /, scope: Optional[ScopeRequest]=None):
|
||||
"""Changes some attribute in a given frame."""
|
||||
if frame is None:
|
||||
return
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ class DjangoTemplateSyntaxErrorFrame(object):
|
|||
def change_variable(frame, attr, expression, default, scope=None):
|
||||
if isinstance(frame, DjangoTemplateFrame):
|
||||
result = eval(expression, frame.f_globals, frame.f_locals)
|
||||
frame._change_variable(attr, result)
|
||||
frame._change_variable(attr, result, scope=scope)
|
||||
return result
|
||||
return default
|
||||
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ class Jinja2TemplateSyntaxErrorFrame(object):
|
|||
def change_variable(frame, attr, expression, default, scope=None):
|
||||
if isinstance(frame, Jinja2TemplateFrame):
|
||||
result = eval(expression, frame.f_globals, frame.f_locals)
|
||||
frame._change_variable(frame.f_back, attr, result)
|
||||
frame._change_variable(frame.f_back, attr, result, scope=scope)
|
||||
return result
|
||||
return default
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue