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

Function main

ci/lint_python/sys_path_checker.py:106–138  ·  view source on GitHub ↗
(argv: list[str] | None = None)

Source from the content-addressed store, hash-verified

104
105
106def main(argv: list[str] | None = None) -> int:
107 parser = argparse.ArgumentParser(
108 description="Check Python files for sys.path modification calls.",
109 )
110 parser.add_argument(
111 "paths",
112 nargs="+",
113 help="Files or directories to check",
114 )
115 parser.add_argument(
116 "--exclude",
117 nargs="*",
118 default=[],
119 help="Substrings to exclude from file paths",
120 )
121 args = parser.parse_args(argv)
122
123 files = collect_python_files(args.paths, args.exclude)
124
125 total_violations = 0
126 for path in files:
127 try:
128 source = path.read_text(encoding="utf-8", errors="replace")
129 except OSError:
130 continue
131 if not _SYS_PATH_RE.search(source):
132 continue
133 violations = check_file(str(path), source)
134 for line_no, message in violations:
135 print(f"{path}:{line_no}: {message}")
136 total_violations += 1
137
138 return 1 if total_violations > 0 else 0
139
140
141if __name__ == "__main__":

Callers 1

Calls 4

parse_argsMethod · 0.80
collect_python_filesFunction · 0.70
check_fileFunction · 0.70
printFunction · 0.50

Tested by

no test coverage detected