def makeJsonPathFile_LK(self): print(f"[{type(self).__name__}]Running ---> makeJsonPathFile_LK") wb = xlrd.open_workbook(self.lkFileName) sheet = wb.sheet_by_index(0) for x in range(1, sheet.nrows): CommonUtilities.progressBar(x, sheet.nrows) row = CommonUtilities.splitOnComma(sheet.cell_value(x, 0)) left_r, righ_r = self.__getLeftRightElment(row) source_lr = CommonUtilities.getSourceFromPath(left_r) source_rr = CommonUtilities.getSourceFromPath(righ_r) if not left_r in self.dictionary_lk_path.keys( ) and not left_r in self.resources_founded: self.dictionary_lk_path[left_r] = {source_lr: [left_r]} self.resources_founded.append(left_r) self.total_object_linked += 1 self.total_file_linkage += 1 if not righ_r in self.resources_founded: if not source_rr in self.dictionary_lk_path[left_r].keys(): self.dictionary_lk_path[left_r][source_rr] = [] self.dictionary_lk_path[left_r][source_rr].append(righ_r) self.resources_founded.append(righ_r) self.total_file_linkage += 1 CommonUtilities.writeDictToJson(self.dictionary_lk_path, SOURCES_BASE_LK_DICT)
def makeJsonPathFile_EXT(self): print(f"[{type(self).__name__}]Running ---> makeJsonPathFile_EXT") for dir in os.listdir(BASE_SOURCE_DIR): for file in os.listdir(f"{BASE_SOURCE_DIR}/{dir}/"): filename = file.split(".")[0] rs = f"{dir}/{filename}" if not rs in self.resources_founded: self.dictionary_ext_path[rs] = { CommonUtilities.getSourceFromPath(rs): [rs] } self.total_file_external += 1 CommonUtilities.writeDictToJson(self.dictionary_ext_path, SOURCES_BASE_EXT_DICT)