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

Class ParseArgsCodeGen

Tools/clinic/libclinic/parse_args.py:193–1003  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191
192
193class ParseArgsCodeGen:
194 func: Function
195 codegen: CodeGen
196 limited_capi: bool = False
197
198 # Function parameters
199 parameters: list[Parameter]
200 self_parameter_converter: self_converter
201 converters: list[CConverter]
202
203 # Is 'defining_class' used for the first parameter?
204 requires_defining_class: bool
205
206 # Use METH_FASTCALL calling convention?
207 fastcall: bool
208
209 # Declaration of the return variable (ex: "int return_value;")
210 return_value_declaration: str
211
212 # Calling convention (ex: "METH_NOARGS")
213 flags: str
214
215 # Variables declarations
216 declarations: str
217
218 pos_only: int = 0
219 min_pos: int = 0
220 max_pos: int = 0
221 min_kw_only: int = 0
222 varpos: Parameter | None = None
223 var_keyword: Parameter | None = None
224
225 docstring_prototype: str
226 docstring_definition: str
227 impl_prototype: str | None
228 impl_definition: str
229 methoddef_define: str
230 parser_prototype: str
231 parser_definition: str
232 cpp_if: str
233 cpp_endif: str
234 methoddef_ifndef: str
235
236 parser_body_fields: tuple[str, ...]
237
238 def __init__(self, func: Function, codegen: CodeGen) -> None:
239 self.func = func
240 self.codegen = codegen
241
242 self.parameters = list(self.func.parameters.values())
243 self_parameter = self.parameters.pop(0)
244 if not isinstance(self_parameter.converter, self_converter):
245 raise ValueError("the first parameter must use self_converter")
246 self.self_parameter_converter = self_parameter.converter
247
248 self.requires_defining_class = False
249 if self.parameters and isinstance(self.parameters[0].converter, defining_class_converter):
250 self.requires_defining_class = True

Callers 1

output_templatesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…