(self, required_keys)
| 1137 | return 0 |
| 1138 | |
| 1139 | def ReadInputJSON(self, required_keys): |
| 1140 | path = self.args.input_path[0] |
| 1141 | output_path = self.args.output_path[0] |
| 1142 | if not self.Exists(path): |
| 1143 | self.WriteFailureAndRaise('"%s" does not exist' % path, output_path) |
| 1144 | |
| 1145 | try: |
| 1146 | inp = json.loads(self.ReadFile(path)) |
| 1147 | except Exception as e: |
| 1148 | self.WriteFailureAndRaise('Failed to read JSON input from "%s": %s' % |
| 1149 | (path, e), output_path) |
| 1150 | |
| 1151 | for k in required_keys: |
| 1152 | if not k in inp: |
| 1153 | self.WriteFailureAndRaise('input file is missing a "%s" key' % k, |
| 1154 | output_path) |
| 1155 | |
| 1156 | return inp |
| 1157 | |
| 1158 | def WriteFailureAndRaise(self, msg, output_path): |
| 1159 | if output_path: |
no test coverage detected