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

Method merge_into

traitlets/config/loader.py:117–148  ·  view source on GitHub ↗

Merge with another earlier LazyConfigValue or an earlier container. This is useful when having global system-wide configuration files. Self is expected to have higher precedence. Parameters ---------- other : LazyConfigValue or container Re

(self, other: t.Any)

Source from the content-addressed store, hash-verified

115 self._prepend[:0] = other
116
117 def merge_into(self, other: t.Any) -> t.Any:
118 """
119 Merge with another earlier LazyConfigValue or an earlier container.
120 This is useful when having global system-wide configuration files.
121
122 Self is expected to have higher precedence.
123
124 Parameters
125 ----------
126 other : LazyConfigValue or container
127
128 Returns
129 -------
130 LazyConfigValue
131 if ``other`` is also lazy, a reified container otherwise.
132 """
133 if isinstance(other, LazyConfigValue):
134 other._extend.extend(self._extend)
135 self._extend = other._extend
136
137 self._prepend.extend(other._prepend)
138
139 other._inserts.extend(self._inserts)
140 self._inserts = other._inserts
141
142 if self._update:
143 other.update(self._update)
144 self._update = other._update
145 return self
146 else:
147 # other is a container, reify now.
148 return self.get_value(other)
149
150 def insert(self, index: int, other: t.Any) -> None:
151 if not isinstance(index, int):

Callers 1

mergeMethod · 0.80

Calls 3

get_valueMethod · 0.95
extendMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected