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

Function function_op

mypyc/primitives/registry.py:162–209  ·  view source on GitHub ↗

Define a C function call op that replaces a function call. This will be automatically generated by matching against the AST. Most arguments are similar to method_op(). Args: name: full name of the function arg_types: positional argument types for which this applies

(
    name: str,
    arg_types: list[RType],
    return_type: RType,
    c_function_name: str,
    error_kind: int,
    var_arg_type: RType | None = None,
    truncated_type: RType | None = None,
    ordering: list[int] | None = None,
    extra_int_constants: list[tuple[int, RType]] | None = None,
    steals: StealsDescription = False,
    is_borrowed: bool = False,
    priority: int = 1,
    experimental: bool = False,
    dependencies: list[Dependency] | None = None,
)

Source from the content-addressed store, hash-verified

160
161
162def function_op(
163 name: str,
164 arg_types: list[RType],
165 return_type: RType,
166 c_function_name: str,
167 error_kind: int,
168 var_arg_type: RType | None = None,
169 truncated_type: RType | None = None,
170 ordering: list[int] | None = None,
171 extra_int_constants: list[tuple[int, RType]] | None = None,
172 steals: StealsDescription = False,
173 is_borrowed: bool = False,
174 priority: int = 1,
175 experimental: bool = False,
176 dependencies: list[Dependency] | None = None,
177) -> PrimitiveDescription:
178 """Define a C function call op that replaces a function call.
179
180 This will be automatically generated by matching against the AST.
181
182 Most arguments are similar to method_op().
183
184 Args:
185 name: full name of the function
186 arg_types: positional argument types for which this applies
187 """
188 if extra_int_constants is None:
189 extra_int_constants = []
190 ops = function_ops.setdefault(name, [])
191 desc = PrimitiveDescription(
192 name,
193 arg_types,
194 return_type,
195 var_arg_type=var_arg_type,
196 truncated_type=truncated_type,
197 c_function_name=c_function_name,
198 error_kind=error_kind,
199 steals=steals,
200 is_borrowed=is_borrowed,
201 ordering=ordering,
202 extra_int_constants=extra_int_constants,
203 priority=priority,
204 is_pure=False,
205 experimental=experimental,
206 dependencies=dependencies,
207 )
208 ops.append(desc)
209 return desc
210
211
212def binary_op(

Callers 15

generic_ops.pyFile · 0.90
int_ops.pyFile · 0.90
dict_ops.pyFile · 0.90
librt_time_ops.pyFile · 0.90
librt_vecs_ops.pyFile · 0.90
str_ops.pyFile · 0.90
list_ops.pyFile · 0.90
weakref_ops.pyFile · 0.90
misc_ops.pyFile · 0.90
bytearray_ops.pyFile · 0.90
bytes_ops.pyFile · 0.90

Calls 3

setdefaultMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…