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

Method get_dictionary

_pydevd_bundle/pydevd_resolver.py:512–533  ·  view source on GitHub ↗
(self, var, fmt={})

Source from the content-addressed store, hash-verified

510 return ret
511
512 def get_dictionary(self, var, fmt={}):
513 l = len(var)
514 d = {}
515
516 format_str = "%0" + str(int(len(str(l - 1)))) + "d"
517 if fmt is not None and fmt.get("hex", False):
518 format_str = "0x%0" + str(int(len(hex(l).lstrip("0x")))) + "x"
519
520 initial_expanded = pydevd_constants.PYDEVD_CONTAINER_INITIAL_EXPANDED_ITEMS
521 for i, item in enumerate(var):
522 d[format_str % i] = item
523
524 if i >= initial_expanded - 1:
525 item = MoreItems(var, initial_expanded)
526 d["more"] = item
527 break
528
529 # in case if the class extends built-in type and has some additional fields
530 additional_fields = defaultResolver.get_dictionary(var)
531 d.update(additional_fields)
532 d[GENERATED_LEN_ATTR_NAME] = len(var)
533 return d
534
535
536# =======================================================================================================================

Callers 1

test_tuple_resolverFunction · 0.95

Calls 4

MoreItemsClass · 0.85
getMethod · 0.45
get_dictionaryMethod · 0.45
updateMethod · 0.45

Tested by 1

test_tuple_resolverFunction · 0.76