MCPcopy Create free account
hub / github.com/microsoft/playwright-python / file_has_license

Function file_has_license

utils/linting/check_file_header.py:37–50  ·  view source on GitHub ↗
(file_path: str)

Source from the content-addressed store, hash-verified

35
36
37def file_has_license(file_path: str) -> None:
38 path = Path(file_path)
39 if not path.name.endswith(".py"):
40 return
41 if not path.exists():
42 raise Exception(f"File {file_path} does not exist")
43 content = path.read_text(encoding="utf-8")
44 if content.strip() == "":
45 return
46 if content.startswith("#!"):
47 # flake8: noqa: E203
48 content = content[content.find("\n") + 1 :]
49 if not content.startswith(LICENSE_HEADER):
50 raise Exception(f"File {file_path} does not have license header")
51
52
53def main() -> None:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected