MCPcopy Create free account
hub / github.com/FastLED/FastLED / check_has_include

Function check_has_include

ci/fix_has_include.py:100–112  ·  view source on GitHub ↗

Check if file includes the specified header.

(file_path: Path, include_path: str)

Source from the content-addressed store, hash-verified

98
99
100def check_has_include(file_path: Path, include_path: str) -> bool:
101 """Check if file includes the specified header."""
102 try:
103 content = file_path.read_text(encoding="utf-8", errors="ignore")
104 # Match #include "fl/stl/has_include.h" or #include <fl/stl/compiler_control.h>
105 pattern = rf'^\s*#\s*include\s+[<"].*{re.escape(include_path)}[">]'
106 return bool(re.search(pattern, content, re.MULTILINE))
107 except KeyboardInterrupt:
108 _thread.interrupt_main()
109 raise
110 except Exception as e:
111 print(f"Warning: Could not read {file_path}: {e}", file=sys.stderr)
112 return False
113
114
115def find_insertion_point(content: str) -> tuple[int, str]:

Callers 2

mainFunction · 0.90
mainFunction · 0.85

Calls 1

printFunction · 0.50

Tested by

no test coverage detected