(self, path)
| 48 | return cls(formatter=formatter, stdout=stdout, stderr=stderr) |
| 49 | |
| 50 | def load(self, path): |
| 51 | try: |
| 52 | file = open(path) # noqa: SIM115, PTH123 |
| 53 | except FileNotFoundError as error: |
| 54 | self.filenotfound_error(path=path, exc_info=sys.exc_info()) |
| 55 | raise _CannotLoadFile() from error |
| 56 | |
| 57 | with file: |
| 58 | try: |
| 59 | return json.load(file) |
| 60 | except JSONDecodeError as error: |
| 61 | self.parsing_error(path=path, exc_info=sys.exc_info()) |
| 62 | raise _CannotLoadFile() from error |
| 63 | |
| 64 | def filenotfound_error(self, **kwargs): |
| 65 | self._stderr.write(self._formatter.filenotfound_error(**kwargs)) |
no test coverage detected