当前位置: 首页>>代码示例>>Python>>正文


Python Time.genstrtotime方法代码示例

本文整理汇总了Python中Time.genstrtotime方法的典型用法代码示例。如果您正苦于以下问题:Python Time.genstrtotime方法的具体用法?Python Time.genstrtotime怎么用?Python Time.genstrtotime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Time的用法示例。


在下文中一共展示了Time.genstrtotime方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Compare

# 需要导入模块: import Time [as 别名]
# 或者: from Time import genstrtotime [as 别名]
def Compare(compare_type, src_rp, dest_rp, compare_time = None):
	"""Compare metadata in src_rp with metadata of backup session

	Prints to stdout whenever a file in the src_rp directory has
	different metadata than what is recorded in the metadata for the
	appropriate session.

	Session time is read from restore_timestr if compare_time is None.

	"""
	global return_val
	dest_rp = require_root_set(dest_rp, 1)
	if not compare_time:
		try: compare_time = Time.genstrtotime(restore_timestr)
		except Time.TimeException, exc: Log.FatalError(str(exc))

	mirror_rp = restore_root.new_index(restore_index)
	inc_rp = Globals.rbdir.append_path("increments", restore_index)
	backup_set_select(src_rp) # Sets source rorp iterator
	if compare_type == "compare": compare_func = compare.Compare
	elif compare_type == "compare-hash": compare_func = compare.Compare_hash
	else:
		assert compare_type == "compare-full", compare_type
		compare_func = compare.Compare_full
	return_val = compare_func(src_rp, mirror_rp, inc_rp, compare_time)
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:27,代码来源:Main.py

示例2: ListAtTime

# 需要导入模块: import Time [as 别名]
# 或者: from Time import genstrtotime [as 别名]
def ListAtTime(rp):
	"""List files in archive under rp that are present at restoretime"""
	rp = require_root_set(rp, 1)
	try: rest_time = Time.genstrtotime(restore_timestr)
	except Time.TimeException, exc: Log.FatalError(str(exc))
	mirror_rp = restore_root.new_index(restore_index)
	inc_rp = mirror_rp.append_path("increments", restore_index)
	for rorp in rp.conn.restore.ListAtTime(mirror_rp, inc_rp, rest_time):
		print rorp.get_indexpath()
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:11,代码来源:Main.py

示例3: ListChangedSince

# 需要导入模块: import Time [as 别名]
# 或者: from Time import genstrtotime [as 别名]
def ListChangedSince(rp):
	"""List all the files under rp that have changed since restoretime"""
	rp = require_root_set(rp, 1)
	try: rest_time = Time.genstrtotime(restore_timestr)
	except Time.TimeException, exc: Log.FatalError(str(exc))
	mirror_rp = restore_root.new_index(restore_index)
	inc_rp = mirror_rp.append_path("increments", restore_index)
	for rorp in rp.conn.restore.ListChangedSince(mirror_rp, inc_rp, rest_time):
		# This is a hack, see restore.ListChangedSince for rationale
		print rorp.index[0]
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:12,代码来源:Main.py

示例4: Verify

# 需要导入模块: import Time [as 别名]
# 或者: from Time import genstrtotime [as 别名]
def Verify(dest_rp, verify_time = None):
	"""Check the hashes of the regular files against mirror_metadata"""
	global return_val
	dest_rp = require_root_set(dest_rp, 1)
	if not verify_time:
		try: verify_time = Time.genstrtotime(restore_timestr)
		except Time.TimeException, exc: Log.FatalError(str(exc))

	mirror_rp = restore_root.new_index(restore_index)
	inc_rp = Globals.rbdir.append_path("increments", restore_index)
	return_val = dest_rp.conn.compare.Verify(mirror_rp, inc_rp, verify_time)
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:13,代码来源:Main.py

示例5: rot_check_time

# 需要导入模块: import Time [as 别名]
# 或者: from Time import genstrtotime [as 别名]
def rot_check_time(time_string):
	"""Check remove older than time_string, return time in seconds"""
	try: time = Time.genstrtotime(time_string)
	except Time.TimeException, exc: Log.FatalError(str(exc))

	times_in_secs = [inc.getinctime() for inc in 
		  restore.get_inclist(Globals.rbdir.append_path("increments"))]
	times_in_secs = filter(lambda t: t < time, times_in_secs)
	if not times_in_secs:
		Log("No increments older than %s found, exiting." %
			(Time.timetopretty(time),), 3)
		return None

	times_in_secs.sort()
	inc_pretty_time = "\n".join(map(Time.timetopretty, times_in_secs))
	if len(times_in_secs) > 1 and not force:
		Log.FatalError("Found %d relevant increments, dated:\n%s"
			"\nIf you want to delete multiple increments in this way, "
			"use the --force." % (len(times_in_secs), inc_pretty_time))
	if len(times_in_secs) == 1:
		Log("Deleting increment at time:\n" + inc_pretty_time, 3)
	else: Log("Deleting increments at times:\n" + inc_pretty_time, 3)
	return times_in_secs[-1]+1 # make sure we don't delete current increment
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:25,代码来源:Main.py

示例6: restore_check_paths

# 需要导入模块: import Time [as 别名]
# 或者: from Time import genstrtotime [as 别名]
					   + src_rp.path)
	restore_check_paths(src_rp, dest_rp, restore_as_of)
	try:
		dest_rp.conn.fs_abilities.restore_set_globals(dest_rp)
	except IOError, exc:
		if exc.errno == errno.EACCES:
			print "\n"
			Log.FatalError("Could not begin restore due to\n%s" % exc)
		else:
			raise
	init_user_group_mapping(dest_rp.conn)
	src_rp = restore_init_quoting(src_rp)
	restore_check_backup_dir(restore_root, src_rp, restore_as_of)
	inc_rpath = Globals.rbdir.append_path('increments', restore_index)
	if restore_as_of:
		try: time = Time.genstrtotime(restore_timestr, rp = inc_rpath)
		except Time.TimeException, exc: Log.FatalError(str(exc))
	else: time = src_rp.getinctime()
	restore_set_select(restore_root, dest_rp)
	restore_start_log(src_rp, dest_rp, time)
	try:
		restore.Restore(restore_root.new_index(restore_index),
						inc_rpath, dest_rp, time)
	except IOError, exc:
		if exc.errno == errno.EACCES:
			print "\n"
			Log.FatalError("Could not complete restore due to\n%s" % exc)
		else:
			raise
	else:
		Log("Restore finished", 4)
开发者ID:blackcoffeerider,项目名称:rdiff-backup,代码行数:33,代码来源:Main.py


注:本文中的Time.genstrtotime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。