| from __future__ import print_function |
| from typing import Optional |
| from typing import Sequence |
| def main(argv=None): # type: (Optional[Sequence[str]]) -> int |
| parser = argparse.ArgumentParser() |
| parser.add_argument('filenames', nargs='*', help='JSON filenames to check.') |
| args = parser.parse_args(argv) |
| for filename in args.filenames: |
| json.load(io.open(filename, encoding='UTF-8')) |
| except (ValueError, UnicodeDecodeError) as exc: |
| print('{}: Failed to json decode ({})'.format(filename, exc)) |
| if __name__ == '__main__': |