MCPcopy Index your code
hub / github.com/pyinvoke/invoke / _get

Method _get

invoke/config.py:170–188  ·  view source on GitHub ↗
(self, key: str)

Source from the content-addressed store, hash-verified

168 return self._get(key)
169
170 def _get(self, key: str) -> Any:
171 # Short-circuit if pickling/copying mechanisms are asking if we've got
172 # __setstate__ etc; they'll ask this w/o calling our __init__ first, so
173 # we'd be in a RecursionError-causing catch-22 otherwise.
174 if key in ("__setstate__",):
175 raise AttributeError(key)
176 # At this point we should be able to assume a self._config...
177 value = self._config[key]
178 if isinstance(value, dict):
179 # New object's keypath is simply the key, prepended with our own
180 # keypath if we've got one.
181 keypath = (key,)
182 if hasattr(self, "_keypath"):
183 keypath = self._keypath + keypath
184 # If we have no _root, we must be the root, so it's us. Otherwise,
185 # pass along our handle on the root.
186 root = getattr(self, "_root", self)
187 value = DataProxy.from_data(data=value, root=root, keypath=keypath)
188 return value
189
190 def _set(self, *args: Any, **kwargs: Any) -> None:
191 """

Callers 2

__getattr__Method · 0.95
__getitem__Method · 0.95

Calls 1

from_dataMethod · 0.80

Tested by

no test coverage detected