MCPcopy
hub / github.com/sublimelsp/LSP / set

Method set

plugin/core/collections.py:75–91  ·  view source on GitHub ↗

Set a value in the dictionary. :param path: The path, e.g. foo.bar.baz :param value: The value

(self, path: str, value: Any)

Source from the content-addressed store, hash-verified

73 return
74
75 def set(self, path: str, value: Any) -> None:
76 """
77 Set a value in the dictionary.
78
79 :param path: The path, e.g. foo.bar.baz
80 :param value: The value
81 """
82 current = self._d
83 keys = path.split('.')
84 for i in range(len(keys) - 1):
85 key = keys[i]
86 next_current = current.get(key)
87 if not isinstance(next_current, dict):
88 next_current = {}
89 current[key] = next_current
90 current = next_current
91 current[keys[-1]] = value
92
93 def remove(self, path: str) -> None:
94 """

Callers 15

test_set_and_getMethod · 0.95
test_removeMethod · 0.95
test_updateMethod · 0.95
test_as_dictMethod · 0.95
runMethod · 0.80
_cleanupMethod · 0.80
set_uriMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls 1

getMethod · 0.45