MCPcopy Create free account
hub / github.com/ipython/traitlets / get_value

Method get_value

traitlets/config/loader.py:173–194  ·  view source on GitHub ↗

construct the value from the initial one after applying any insert / extend / update changes

(self, initial: t.Any)

Source from the content-addressed store, hash-verified

171 self.update({obj})
172
173 def get_value(self, initial: t.Any) -> t.Any:
174 """construct the value from the initial one
175
176 after applying any insert / extend / update changes
177 """
178 if self._value is not None:
179 return self._value # type:ignore[unreachable]
180 value = copy.deepcopy(initial)
181 if isinstance(value, list):
182 for idx, obj in self._inserts:
183 value.insert(idx, obj)
184 value[:0] = self._prepend
185 value.extend(self._extend)
186
187 elif isinstance(value, dict):
188 if self._update:
189 value.update(self._update)
190 elif isinstance(value, set):
191 if self._update:
192 value.update(self._update)
193 self._value = value
194 return value
195
196 def to_dict(self) -> dict[str, t.Any]:
197 """return JSONable dict form of my data

Callers 1

merge_intoMethod · 0.95

Calls 3

insertMethod · 0.80
extendMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected