def _full_index_format(self, fullpath, status, new_key, previous_hash=None): st = os.stat(fullpath) obj = {'ctime': st.st_ctime, 'mtime': st.st_mtime, 'status': status, 'hash': new_key, 'size': get_file_size(fullpath)} if previous_hash: obj['previous_hash'] = previous_hash if self._mutability != Mutability.MUTABLE.value and os.path.isfile(fullpath): set_read_only(fullpath) return obj
def _get_amount_and_size_of_workspace_files(self, full_metadata_path, ws_path): full_path = os.path.join(full_metadata_path, 'MANIFEST.yaml') metadata_file = yaml_load(full_path) amount = 0 workspace_size = 0 for values in metadata_file.values(): for file_name in values: if os.path.exists(normalize_path(os.path.join(ws_path, str(file_name)))): amount += 1 workspace_size += get_file_size(normalize_path(os.path.join(ws_path, str(file_name)))) return amount, workspace_size