MCPcopy Index your code
hub / github.com/nodejs/node / init_defaults

Function init_defaults

deps/inspector_protocol/code_generator.py:53–66  ·  view source on GitHub ↗
(config_tuple, path, defaults)

Source from the content-addressed store, hash-verified

51 return json.loads(data, object_hook=json_object_hook)
52
53 def init_defaults(config_tuple, path, defaults):
54 keys = list(config_tuple._fields) # pylint: disable=E1101
55 values = [getattr(config_tuple, k) for k in keys]
56 for i in range(len(keys)):
57 if hasattr(values[i], "_fields"):
58 values[i] = init_defaults(values[i], path + "." + keys[i], defaults)
59 for optional in defaults:
60 if optional.find(path + ".") != 0:
61 continue
62 optional_key = optional[len(path) + 1:]
63 if optional_key.find(".") == -1 and optional_key not in keys:
64 keys.append(optional_key)
65 values.append(defaults[optional])
66 return collections.namedtuple('X', keys)(*values)
67
68 try:
69 cmdline_parser = argparse.ArgumentParser()

Callers 1

read_configFunction · 0.70

Calls 4

findMethod · 0.65
listFunction · 0.50
rangeFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…