(filename)
| 133 | |
| 134 | |
| 135 | def validate_py_syntax(filename): |
| 136 | with open(filename, 'r', encoding='utf-8') as f: |
| 137 | # Setting encoding explicitly to resolve coding issue on windows |
| 138 | content = f.read() |
| 139 | try: |
| 140 | ast.parse(content) |
| 141 | except SyntaxError as e: |
| 142 | raise SyntaxError('There are syntax errors in config ' |
| 143 | f'file {filename}: {e}') |
| 144 | |
| 145 | |
| 146 | # following code borrows implementation from huggingface/transformers |
no test coverage detected
searching dependent graphs…