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

Method convert_field

Lib/string/__init__.py:283–293  ·  view source on GitHub ↗
(self, value, conversion)

Source from the content-addressed store, hash-verified

281
282
283 def convert_field(self, value, conversion):
284 # do any conversion on the resulting object
285 if conversion is None:
286 return value
287 elif conversion == 's':
288 return str(value)
289 elif conversion == 'r':
290 return repr(value)
291 elif conversion == 'a':
292 return ascii(value)
293 raise ValueError("Unknown conversion specifier {0!s}".format(conversion))
294
295
296 # returns an iterable that contains tuples of the form:

Callers 1

_vformatMethod · 0.95

Calls 4

strFunction · 0.85
reprFunction · 0.85
asciiFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected