def format_attrs(self, result): s = swift_stat(**result) return { "size": s.st_size, "uid": s.st_uid, "gid": s.st_gid, "permissions": s.st_mode, "atime": int(s.st_atime), "mtime": int(s.st_mtime) }
def format_attrs(self, result): """ Helper for formatting getAttr results """ s = swift_stat(**result) return { "size": s.st_size, "uid": s.st_uid, "gid": s.st_gid, "permissions": s.st_mode, "atime": int(s.st_atime), "mtime": int(s.st_mtime) }
def next(self): try: name, f = self.files.popitem(last=False) lstat = swift_stat(**f) longname = ls.lsLine(name, lstat) return (name, longname, { "size": lstat.st_size, "uid": lstat.st_uid, "gid": lstat.st_gid, "permissions": lstat.st_mode, "atime": int(lstat.st_atime), "mtime": int(lstat.st_mtime) }) except KeyError: raise StopIteration
def stat_format(keys, props): st = swift_stat(**props) l = [] for key in keys: if key == 'size': val = st.st_size elif key == 'directory': val = st.st_mode & stat.S_IFDIR == stat.S_IFDIR elif key == 'permissions': val = st.st_mode elif key == 'hardlinks': val = 0 elif key == 'modified': val = int(st.st_mtime) elif key in 'owner': val = 'nobody' elif key in 'group': val = 'nobody' else: # Unknown Value val = '' l.append(val) return l
def stat_format(keys, props): st = swift_stat(**props) l = [] for key in keys: if key == 'size': val = st.st_size elif key == 'directory': val = st.st_mode & stat.S_IFDIR == stat.S_IFDIR elif key == 'permissions': val = st.st_mode elif key == 'hardlinks': val = st.st_nlink elif key == 'modified': val = int(st.st_mtime) elif key in 'owner': val = 'nobody' elif key in 'group': val = 'nobody' else: # Unknown Value val = '' l.append(val) return l