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

Method add_include

Tools/clinic/libclinic/codegen.py:282–298  ·  view source on GitHub ↗
(self, name: str, reason: str,
                    *, condition: str | None = None)

Source from the content-addressed store, hash-verified

280 return True
281
282 def add_include(self, name: str, reason: str,
283 *, condition: str | None = None) -> None:
284 try:
285 existing = self._includes[name]
286 except KeyError:
287 pass
288 else:
289 if existing.condition and not condition:
290 # If the previous include has a condition and the new one is
291 # unconditional, override the include.
292 pass
293 else:
294 # Already included, do nothing. Only mention a single reason,
295 # no need to list all of them.
296 return
297
298 self._includes[name] = Include(name, reason, condition)
299
300 def get_includes(self) -> list[Include]:
301 return sorted(self._includes.values(),

Callers 13

declare_parserFunction · 0.45
__init__Method · 0.45
parse_pos_onlyMethod · 0.45
parse_var_keywordMethod · 0.45
parse_generalMethod · 0.45
copy_includesMethod · 0.45
handle_new_or_initMethod · 0.45
use_converterMethod · 0.45
use_converterMethod · 0.45
parse_argMethod · 0.45
use_converterMethod · 0.45
parse_varargMethod · 0.45

Calls 1

IncludeClass · 0.85

Tested by

no test coverage detected