MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / write

Method write

scripts/dump_data.py:79–98  ·  view source on GitHub ↗
(self, miner_name, container_name, container_data)

Source from the content-addressed store, hash-verified

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(

Callers 8

do_GETMethod · 0.45
runMethod · 0.45
backupFitsWorkerFuncMethod · 0.45
init_user_jargonMethod · 0.45
dump_data.pyFile · 0.45
__write_fileMethod · 0.45
makeFunction · 0.45
effectUsedBy.pyFile · 0.45

Calls 4

__secure_nameMethod · 0.95
__write_fileMethod · 0.95
itemsMethod · 0.80
__grouperMethod · 0.80

Tested by

no test coverage detected