MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _is_cpp_header

Function _is_cpp_header

graphify/extract.py:12501–12510  ·  view source on GitHub ↗

Whether a `.h` file is C++ rather than plain C (#1547). Mirrors `_is_objc_header`: sniffs for a C++-only token. Used only to reroute a `.h` from extract_c to extract_cpp when no ObjC marker is present (ObjC has priority). Conservative by construction — a plain C header matches nothing

(path: Path, head: bytes | None = None)

Source from the content-addressed store, hash-verified

12499
12500
12501def _is_cpp_header(path: Path, head: bytes | None = None) -> bool:
12502 """Whether a `.h` file is C++ rather than plain C (#1547).
12503
12504 Mirrors `_is_objc_header`: sniffs for a C++-only token. Used only to reroute
12505 a `.h` from extract_c to extract_cpp when no ObjC marker is present (ObjC has
12506 priority). Conservative by construction — a plain C header matches nothing
12507 here and keeps its existing extract_c routing.
12508 """
12509 data = _sniff_head(path, head)
12510 return any(marker in data for marker in _CPP_HEADER_MARKERS)
12511
12512
12513def _get_extractor(path: Path, *, sniff_headers: bool = True) -> Any | None:

Calls 1

_sniff_headFunction · 0.85