(self, items:Result)
| 76 | return output |
| 77 | |
| 78 | def convert_to_json(self, items:Result): |
| 79 | self._create_directory(self._output_dir) |
| 80 | data = [] |
| 81 | file_name = os.path.join(self._output_dir, Hashing.get_md5(''.join([str(i.criterial) for i in items])))+".json" |
| 82 | for item in items: |
| 83 | information = {item.value:[]} |
| 84 | |
| 85 | headers = item.results.headers |
| 86 | for row in item.results.rows: |
| 87 | for index, value in enumerate(row): |
| 88 | information[item.value].append({headers[index]:value}) |
| 89 | |
| 90 | data.append(information) |
| 91 | |
| 92 | with open(file_name, "w") as outfile: |
| 93 | outfile.write(json.dumps(data, indent=4)) |
| 94 | |
| 95 | return file_name |
| 96 | |
| 97 | def convert_to_csv(self, items:QueryResult) -> str: |
| 98 | try: |
no test coverage detected