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

Method __new__

tools/python-3.11.9-amd64/Lib/enum.py:1280–1299  ·  view source on GitHub ↗

values must already be of type `str`

(cls, *values)

Source from the content-addressed store, hash-verified

1278 """
1279
1280 def __new__(cls, *values):
1281 "values must already be of type `str`"
1282 if len(values) > 3:
1283 raise TypeError('too many arguments for str(): %r' % (values, ))
1284 if len(values) == 1:
1285 # it must be a string
1286 if not isinstance(values[0], str):
1287 raise TypeError('%r is not a string' % (values[0], ))
1288 if len(values) >= 2:
1289 # check that encoding argument is a string
1290 if not isinstance(values[1], str):
1291 raise TypeError('encoding must be a string, not %r' % (values[1], ))
1292 if len(values) == 3:
1293 # check that errors argument is a string
1294 if not isinstance(values[2], str):
1295 raise TypeError('errors must be a string, not %r' % (values[2]))
1296 value = str(*values)
1297 member = str.__new__(cls, value)
1298 member._value_ = value
1299 return member
1300
1301 def _generate_next_value_(name, start, count, last_values):
1302 """

Callers

nothing calls this directly

Calls 2

strFunction · 0.85
__new__Method · 0.45

Tested by

no test coverage detected