MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / get_var_scope

Function get_var_scope

_pydevd_bundle/pydevd_resolver.py:796–830  ·  view source on GitHub ↗
(attr_name, attr_value, evaluate_name, handle_return_values)

Source from the content-addressed store, hash-verified

794
795
796def get_var_scope(attr_name, attr_value, evaluate_name, handle_return_values):
797 if attr_name.startswith("'"):
798 if attr_name.endswith("'"):
799 # i.e.: strings denote that it is a regular value in some container.
800 return ""
801 else:
802 i = attr_name.find("__' (")
803 if i >= 0:
804 # Handle attr_name such as: >>'__name__' (1732494379184)<<
805 attr_name = attr_name[1 : i + 2]
806
807 if handle_return_values and attr_name == RETURN_VALUES_DICT:
808 return ""
809
810 elif attr_name == GENERATED_LEN_ATTR_NAME:
811 return ""
812
813 if attr_name.startswith("__") and attr_name.endswith("__"):
814 return DAPGrouper.SCOPE_SPECIAL_VARS
815
816 if attr_name.startswith("_") or attr_name.endswith("__"):
817 return DAPGrouper.SCOPE_PROTECTED_VARS
818
819 try:
820 if inspect.isroutine(attr_value) or isinstance(attr_value, MethodWrapperType):
821 return DAPGrouper.SCOPE_FUNCTION_VARS
822
823 elif inspect.isclass(attr_value):
824 return DAPGrouper.SCOPE_CLASS_VARS
825 except:
826 # It's possible that isinstance throws an exception when dealing with user-code.
827 if DebugInfoHolder.DEBUG_TRACE_LEVEL > 0:
828 pydev_log.exception()
829
830 return ""

Callers 2

var_to_xmlFunction · 0.90
_group_entriesMethod · 0.90

Calls 3

isroutineMethod · 0.80
exceptionMethod · 0.80
findMethod · 0.45

Tested by

no test coverage detected