MCPcopy Index your code
hub / github.com/python/mypy / RuntimeArg

Class RuntimeArg

mypyc/ir/func_ir.py:36–74  ·  view source on GitHub ↗

Description of a function argument in IR. Argument kind is one of ARG_* constants defined in mypy.nodes.

Source from the content-addressed store, hash-verified

34
35
36class RuntimeArg:
37 """Description of a function argument in IR.
38
39 Argument kind is one of ARG_* constants defined in mypy.nodes.
40 """
41
42 def __init__(
43 self, name: str, typ: RType, kind: ArgKind = ARG_POS, pos_only: bool = False
44 ) -> None:
45 self.name = name
46 self.type = typ
47 self.kind = kind
48 self.pos_only = pos_only
49
50 @property
51 def optional(self) -> bool:
52 return self.kind.is_optional()
53
54 def __repr__(self) -> str:
55 return "RuntimeArg(name={}, type={}, optional={!r}, pos_only={!r})".format(
56 self.name, self.type, self.optional, self.pos_only
57 )
58
59 def serialize(self) -> JsonDict:
60 return {
61 "name": self.name,
62 "type": self.type.serialize(),
63 "kind": int(self.kind.value),
64 "pos_only": self.pos_only,
65 }
66
67 @classmethod
68 def deserialize(cls, data: JsonDict, ctx: DeserMaps) -> RuntimeArg:
69 return RuntimeArg(
70 data["name"],
71 deserialize_type(data["type"], ctx),
72 ArgKind(data["kind"]),
73 data["pos_only"],
74 )
75
76
77class FuncSignature:

Callers 15

transform_lambda_exprFunction · 0.90
gen_glue_methodFunction · 0.90
gen_glue_propertyFunction · 0.90
gen_glue_property_setterFunction · 0.90
fdef_to_sigMethod · 0.90
add_argumentMethod · 0.90
add_getter_declarationFunction · 0.90
add_setter_declarationFunction · 0.90
prepare_init_methodFunction · 0.90

Calls

no outgoing calls

Tested by 3

test_callMethod · 0.72
test_call_two_argsMethod · 0.72
setUpMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…