MCPcopy
hub / github.com/aws/aws-cli / _path_get

Method _path_get

awscli/botocore/paginate.py:146–161  ·  view source on GitHub ↗

Return the nested data at the given path. For instance: data = {'foo': ['bar', 'baz']} path = ['foo', 0] ==> 'bar'

(self, data, path)

Source from the content-addressed store, hash-verified

144 return token
145
146 def _path_get(self, data, path):
147 """Return the nested data at the given path.
148
149 For instance:
150 data = {'foo': ['bar', 'baz']}
151 path = ['foo', 0]
152 ==> 'bar'
153 """
154 # jmespath isn't used here because it would be difficult to actually
155 # create the jmespath query when taking all of the unknowns of key
156 # structure into account. Gross though this is, it is simple and not
157 # very error prone.
158 d = data
159 for step in path:
160 d = d[step]
161 return d
162
163 def _path_set(self, data, path, value):
164 """Set the value of a key in the given data.

Callers 2

_decodeMethod · 0.95
_path_setMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected