MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_field

Method get_field

tools/python-3.11.9-amd64/Lib/string.py:296–309  ·  view source on GitHub ↗
(self, field_name, args, kwargs)

Source from the content-addressed store, hash-verified

294 # used_args: a set of which args have been used
295 # args, kwargs: as passed in to vformat
296 def get_field(self, field_name, args, kwargs):
297 first, rest = _string.formatter_field_name_split(field_name)
298
299 obj = self.get_value(first, args, kwargs)
300
301 # loop through the rest of the field_name, doing
302 # getattr or getitem as needed
303 for is_attr, i in rest:
304 if is_attr:
305 obj = getattr(obj, i)
306 else:
307 obj = obj[i]
308
309 return obj, first

Callers 1

_vformatMethod · 0.95

Calls 1

get_valueMethod · 0.95

Tested by

no test coverage detected