MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / parse_header

Function parse_header

Scripts/parse_headers.py:294–310  ·  view source on GitHub ↗

Parse a single .h file and return a ParsedFile dict.

(filepath: str, public_root: str)

Source from the content-addressed store, hash-verified

292
293
294def parse_header(filepath: str, public_root: str) -> Optional[dict]:
295 """Parse a single .h file and return a ParsedFile dict."""
296 try:
297 with open(filepath, 'r', encoding='utf-8', errors='replace') as f:
298 source = f.read()
299 except Exception as e:
300 print(f"[WARN] Could not read {filepath}: {e}", file=sys.stderr)
301 return None
302
303 rel_path = os.path.relpath(filepath, public_root).replace('\\', '/')
304 result = ParsedFile(
305 file=os.path.basename(filepath),
306 relative_path=rel_path,
307 )
308
309 _parse_file(source, result)
310 return asdict(result)
311
312
313def _parse_file(source: str, result: ParsedFile):

Callers 1

scan_public_headersFunction · 0.85

Calls 2

ParsedFileClass · 0.85
_parse_fileFunction · 0.85

Tested by

no test coverage detected