MCPcopy Create free account
hub / github.com/SpartanJ/eepp / extract_includes_from_file

Function extract_includes_from_file

projects/scripts/find_missing_includes.py:9–25  ·  view source on GitHub ↗

Helper function to read a file and return a set of its includes.

(filepath)

Source from the content-addressed store, hash-verified

7
8
9def extract_includes_from_file(filepath):
10 """Helper function to read a file and return a set of its includes."""
11 includes = set()
12 if not os.path.exists(filepath):
13 return includes
14
15 try:
16 with open(filepath, "r", encoding="utf-8-sig") as f:
17 for line in f:
18 match = INCLUDE_REGEX.search(line)
19 if match:
20 # Add the exact path inside the quotes/brackets to the set
21 includes.add(match.group(1))
22 except Exception as e:
23 print(f"Error reading {filepath}: {e}")
24
25 return includes
26
27
28def find_missing_includes():

Callers 1

find_missing_includesFunction · 0.85

Calls 4

searchMethod · 0.80
groupMethod · 0.80
existsMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected