MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_field

Method get_field

Lib/string/__init__.py:312–325  ·  view source on GitHub ↗
(self, field_name, args, kwargs)

Source from the content-addressed store, hash-verified

310 # used_args: a set of which args have been used
311 # args, kwargs: as passed in to vformat
312 def get_field(self, field_name, args, kwargs):
313 first, rest = _string.formatter_field_name_split(field_name)
314
315 obj = self.get_value(first, args, kwargs)
316
317 # loop through the rest of the field_name, doing
318 # getattr or getitem as needed
319 for is_attr, i in rest:
320 if is_attr:
321 obj = getattr(obj, i)
322 else:
323 obj = obj[i]
324
325 return obj, first

Callers 1

_vformatMethod · 0.95

Calls 2

get_valueMethod · 0.95
getattrFunction · 0.85

Tested by

no test coverage detected