本文整理汇总了Python中Tardis.Util.getUserId方法的典型用法代码示例。如果您正苦于以下问题:Python Util.getUserId方法的具体用法?Python Util.getUserId怎么用?Python Util.getUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tardis.Util
的用法示例。
在下文中一共展示了Util.getUserId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listFiles
# 需要导入模块: from Tardis import Util [as 别名]
# 或者: from Tardis.Util import getUserId [as 别名]
def listFiles(db, crypt):
#print args
info = getBackupSet(db, args.backup, args.date, defaultCurrent=True)
#print info, info['backupset']
lastDir = '/'
lastDirInode = (-1, -1)
bset = info['backupset']
files = db.getNewFiles(info['backupset'], args.previous)
for fInfo in files:
name = _decryptFilename(fInfo['name'], crypt)
if not args.dirs and fInfo['dir']:
continue
dirInode = (fInfo['parent'], fInfo['parentdev'])
if dirInode == lastDirInode:
path = lastDir
else:
path = _path(db, crypt, bset, dirInode)
lastDirInode = dirInode
lastDir = path
if not args.fullname:
print("%s:" % (path))
if args.status:
status = '[New] ' if fInfo['chainlength'] == 0 else '[Delta] '
else:
status = ''
if args.fullname:
name = os.path.join(path, name)
if args.long:
mode = Util.filemode(fInfo['mode'])
group = Util.getGroupName(fInfo['gid'])
owner = Util.getUserId(fInfo['uid'])
mtime = Util.formatTime(fInfo['mtime'])
if fInfo['size'] is not None:
if args.human:
size = "%8s" % Util.fmtSize(fInfo['size'], formats=['','KB','MB','GB', 'TB', 'PB'])
else:
size = "%8d" % int(fInfo['size'])
else:
size = ''
print(' %s%9s %-8s %-8s %8s %12s' % (status, mode, owner, group, size, mtime), end=' ')
if args.cksums:
print(' %32s ' % (fInfo['checksum'] or ''), end=' ')
if args.chnlen:
print(' %4s ' % (fInfo['chainlength']), end=' ')
if args.inode:
print(' %-16s ' % ("(%s, %s)" % (fInfo['device'], fInfo['inode'])), end=' ')
print(name)
else:
print(" %s" % status, end=' ')
if args.cksums:
print(' %32s ' % (fInfo['checksum'] or ''), end=' ')
if args.chnlen:
print(' %4s ' % (fInfo['chainlength']), end=' ')
if args.inode:
print(' %-16s ' % ("(%s, %s)" % (fInfo['device'], fInfo['inode'])), end=' ')
print(name)
示例2: printit
# 需要导入模块: from Tardis import Util [as 别名]
# 或者: from Tardis.Util import getUserId [as 别名]
def printit(info, name, color, gone):
global column
annotation = ''
if args.annotate and info is not None:
if info['dir']:
annotation = '/'
elif info['link']:
annotation = '@'
elif info['mode'] & (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH):
annotation = '*'
name = name + annotation
if gone:
name = '(' + name + ')'
if column == 0:
doprint(' ')
if args.cksums:
if info and info['checksum']:
cksum = info['checksum']
else:
cksum = ''
if args.chnlen:
if info and info['chainlength'] is not None:
chnlen = "%-3d" % int(info['chainlength'])
else:
chnlen = ''
if args.inode:
if info and info['inode'] is not None:
inode = "%8d" % int(info['inode'])
else:
inode = ''
if args.size:
if info and info['size'] is not None:
if args.human:
fsize = "%8s" % Util.fmtSize(info['size'], formats=['','KB','MB','GB', 'TB', 'PB'])
else:
fsize = "%8d" % int(info['size'])
else:
fsize = ''
if args.long:
if gone:
doprint(' %s' % (name), color, eol=True)
else:
mode = Util.filemode(info['mode'])
group = Util.getGroupName(info['gid'])
owner = Util.getUserId(info['uid'])
mtime = Util.formatTime(info['mtime'])
nlinks = info['nlinks']
if info['size'] is not None:
if args.human:
size = Util.fmtSize(info['size'], formats=['','KB','MB','GB', 'TB', 'PB'])
else:
size = "%8d" % info['size']
else:
size = ''
doprint(' %9s %3d %-8s %-8s %8s %12s ' % (mode, nlinks, owner, group, size, mtime), color=colors['name'])
if args.size:
doprint(' %8s ' % (fsize))
if args.inode:
doprint(' %8s ' % (inode))
if args.cksums:
doprint(' %32s ' % (cksum))
if args.chnlen:
doprint(' %-3s ' % (chnlen))
doprint('%s' % (name), color, eol=True)
elif args.cksums or args.chnlen or args.inode or args.size:
doprint(columnfmt % name, color)
if args.size:
doprint(' ' + fsize, color=colors['name'])
if args.inode:
doprint(' ' + inode, color=colors['name'])
if args.cksums:
doprint(' ' + cksum, color=colors['name'])
if args.chnlen:
doprint(' ' + chnlen, color=colors['name'])
doprint(' ', eol=True)
else:
column += 1
if column == columns:
eol = True
column = 0
else:
eol = False
doprint(columnfmt % name, color, eol=eol)