MCPcopy Create free account
hub / github.com/python/cpython / declaration

Method declaration

Tools/clinic/libclinic/converter.py:412–427  ·  view source on GitHub ↗

The C statement to declare this variable.

(self, *, in_parser: bool = False)

Source from the content-addressed store, hash-verified

410 return "".join(prototype)
411
412 def declaration(self, *, in_parser: bool = False) -> str:
413 """
414 The C statement to declare this variable.
415 """
416 declaration = [self.simple_declaration(in_parser=True)]
417 default = self.c_default
418 if not default and self.parameter.group:
419 default = self.c_ignored_default or self.c_init_default
420 if default:
421 declaration.append(" = ")
422 declaration.append(default)
423 declaration.append(";")
424 if self.length:
425 declaration.append('\n')
426 declaration.append(f"Py_ssize_t {self.length_name};")
427 return "".join(declaration)
428
429 def initialize(self) -> str:
430 """

Callers 1

_render_non_selfMethod · 0.95

Calls 3

simple_declarationMethod · 0.95
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected