(self, miner_name, container_name, container_data)
| 77 | return izip_longest(fillvalue=fillvalue, *args) |
| 78 | |
| 79 | def write(self, miner_name, container_name, container_data): |
| 80 | # Create folder structure to path, if not created yet |
| 81 | folder = os.path.join(self.base_folder, self.__secure_name(miner_name)) |
| 82 | if not os.path.exists(folder): |
| 83 | os.makedirs(folder, mode=0o755) |
| 84 | |
| 85 | if type(container_data) == dict: |
| 86 | container_data = OrderedDict(natsort.natsorted(container_data.items())) |
| 87 | |
| 88 | if self.group is None: |
| 89 | filepath = os.path.join(folder, u'{}.json'.format(self.__secure_name(container_name))) |
| 90 | self.__write_file(container_data, filepath) |
| 91 | else: |
| 92 | for i, group in enumerate(PyfaJsonWriter.__grouper(container_data, self.group)): |
| 93 | filepath = os.path.join(folder, u'{}.{}.json'.format(self.__secure_name(container_name), i)) |
| 94 | if type(container_data) in (dict, OrderedDict): |
| 95 | data = dict((k, container_data[k]) for k in group if k is not None) |
| 96 | else: |
| 97 | data = [k for k in group if k is not None] |
| 98 | self.__write_file(data, filepath) |
| 99 | |
| 100 | def __write_file(self, data, filepath): |
| 101 | data_str = json.dumps( |
no test coverage detected