mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
Light up all sequence datatypes.
This commit is contained in:
parent
117704df3d
commit
05728ff2bb
2 changed files with 8 additions and 8 deletions
|
|
@ -16,7 +16,7 @@ class ChildObject:
|
|||
def __init__(self, value: object):
|
||||
self.value = value
|
||||
|
||||
def expr(self, obj: object) -> str:
|
||||
def expr(self, parent_expr: str) -> str:
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
|
@ -27,8 +27,8 @@ class ChildAttribute(ChildObject):
|
|||
super().__init__(value)
|
||||
self.name = name
|
||||
|
||||
def expr(self, obj_expr: str) -> str:
|
||||
return f"({obj_expr}).{self.name}"
|
||||
def expr(self, parent_expr: str) -> str:
|
||||
return f"({parent_expr}).{self.name}"
|
||||
|
||||
|
||||
class ObjectInspector:
|
||||
|
|
@ -84,7 +84,7 @@ def inspect(obj: object) -> ObjectInspector:
|
|||
return stdlib.ListInspector(obj)
|
||||
case {}:
|
||||
return stdlib.MappingInspector(obj)
|
||||
case []:
|
||||
case [*_] | set() | frozenset() | str() | bytes() | bytearray():
|
||||
return stdlib.SequenceInspector(obj)
|
||||
case _:
|
||||
return ObjectInspector(obj)
|
||||
|
|
@ -18,8 +18,8 @@ class ChildLen(ChildObject):
|
|||
def __init__(self, parent: object):
|
||||
super().__init__(len(parent))
|
||||
|
||||
def expr(self, obj_expr: str) -> str:
|
||||
return f"len({obj_expr})"
|
||||
def expr(self, parent_expr: str) -> str:
|
||||
return f"len({parent_expr})"
|
||||
|
||||
|
||||
class ChildItem(ChildObject):
|
||||
|
|
@ -34,8 +34,8 @@ class ChildItem(ChildObject):
|
|||
key_repr = "".join(inspect(self.key).repr())
|
||||
return f"[{key_repr}]"
|
||||
|
||||
def expr(self, obj_expr: str) -> str:
|
||||
return f"({obj_expr}){self.name}"
|
||||
def expr(self, parent_expr: str) -> str:
|
||||
return f"({parent_expr}){self.name}"
|
||||
|
||||
|
||||
class SequenceInspector(ObjectInspector):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue