MCPcopy Index your code
hub / github.com/python/cpython / cast

Function cast

Lib/typing.py:2369–2377  ·  view source on GitHub ↗

Cast a value to a type. This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don't check anything (we want this to be as fast as possible).

(typ, val)

Source from the content-addressed store, hash-verified

2367
2368
2369def cast(typ, val):
2370 """Cast a value to a type.
2371
2372 This returns the value unchanged. To the type checker this
2373 signals that the return value has the designated type, but at
2374 runtime we intentionally don't check anything (we want this
2375 to be as fast as possible).
2376 """
2377 return val
2378
2379
2380def assert_type(val, typ, /):

Callers 11

test_basicsMethod · 0.90
test_errorsMethod · 0.90
__init__Method · 0.90
resolveFunction · 0.90
inst_headerMethod · 0.90
inputsMethod · 0.90
uopsMethod · 0.90
import_fileFunction · 0.90
loggerFunction · 0.90
memoizeFunction · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by 3

test_basicsMethod · 0.72
test_errorsMethod · 0.72
import_fileFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…