(files)
| 54 | |
| 55 | # Query files for the presence of a valid year in the header |
| 56 | def 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 |
| 76 | def check_files(check_files): |
no outgoing calls
no test coverage detected