MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / query_files

Function query_files

scripts/copyright.py:56–73  ·  view source on GitHub ↗
(files)

Source from the content-addressed store, hash-verified

54
55# Query files for the presence of a valid year in the header
56def query_files(files):
57 failed_queries = {}
58 queries = {}
59
60 for filename in files:
61 with io.open(filename, "r+", encoding="utf-8") as f:
62 queries[filename] = None
63 file_contents = f.read()
64 for query in COPYRIGHT_PATTERNS:
65 try:
66 matches = re.findall(query, file_contents)
67 if len(matches) > 0:
68 queries[filename] = matches
69 break # Stop searching after the first match
70 except re.error as error:
71 failed_queries[filename] = error
72
73 return queries, failed_queries
74
75# Check the files for the presence of a valid year in the header
76def check_files(check_files):

Callers 2

check_filesFunction · 0.85
fixFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected