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

Class HeaderDep

mypyc/ir/deps.py:76–102  ·  view source on GitHub ↗

Defines a C header file that a primitive may require. The header gets explicitly #included if the dependency is used. include_dirs are passed to the C compiler when the generated extension is compiled separately and needs to include the header.

Source from the content-addressed store, hash-verified

74
75
76class HeaderDep:
77 """Defines a C header file that a primitive may require.
78
79 The header gets explicitly #included if the dependency is used.
80 include_dirs are passed to the C compiler when the generated extension
81 is compiled separately and needs to include the header.
82 """
83
84 def __init__(
85 self, path: str, *, include_dirs: list[str] | None = None, internal: bool = True
86 ) -> None:
87 # Relative path from mypyc/lib-rt, e.g. 'strings/librt_strings.h'
88 self.path: Final = path
89 self.include_dirs: Final = include_dirs or []
90 self.internal: Final = internal
91
92 def __repr__(self) -> str:
93 return f"HeaderDep(path={self.path!r})"
94
95 def __eq__(self, other: object) -> bool:
96 return isinstance(other, HeaderDep) and self.path == other.path
97
98 def __hash__(self) -> int:
99 return hash(("HeaderDep", self.path))
100
101 def get_header(self) -> str:
102 return self.path
103
104
105Dependency = Capsule | SourceDep | HeaderDep

Callers 2

deserializeMethod · 0.90
external_depMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…