From 05728ff2bb897376181086815c87c0c7261dbcc3 Mon Sep 17 00:00:00 2001 From: Pavel Minaev Date: Thu, 28 Mar 2024 13:29:32 -0700 Subject: [PATCH] Light up all sequence datatypes. --- src/debugpy/server/inspect/__init__.py | 8 ++++---- src/debugpy/server/inspect/stdlib.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/debugpy/server/inspect/__init__.py b/src/debugpy/server/inspect/__init__.py index fed29fb5..10d6a4cb 100644 --- a/src/debugpy/server/inspect/__init__.py +++ b/src/debugpy/server/inspect/__init__.py @@ -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) \ No newline at end of file diff --git a/src/debugpy/server/inspect/stdlib.py b/src/debugpy/server/inspect/stdlib.py index 6cf79348..98be5270 100644 --- a/src/debugpy/server/inspect/stdlib.py +++ b/src/debugpy/server/inspect/stdlib.py @@ -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):