本文整理汇总了Python中node.Node.get_dest_path方法的典型用法代码示例。如果您正苦于以下问题:Python Node.get_dest_path方法的具体用法?Python Node.get_dest_path怎么用?Python Node.get_dest_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node.Node
的用法示例。
在下文中一共展示了Node.get_dest_path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pull_file
# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import get_dest_path [as 别名]
def pull_file(self, filename, source_uname, source_ip):
"""pull file 'filename' from the source"""
my_file = Node.get_dest_path(filename, self.username)
self.pulled_files.add(my_file)
proc = subprocess.Popen(['scp', "%[email protected]%s:%s" % (source_uname, source_ip, filename), my_file])
return_status = proc.wait()
logger.debug("returned status %s", return_status)
示例2: get_watch_dirs
# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import get_dest_path [as 别名]
def get_watch_dirs(config, user_name):
watch_dirs = []
for key, value in config.items('syncit.dirs'):
dir = os.path.expanduser(value.strip())
my_dir = Node.get_dest_path(dir, user_name)
watch_dirs.append(my_dir)
logger.debug("watched dirs %s", watch_dirs)
return watch_dirs
示例3: check_collision
# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import get_dest_path [as 别名]
def check_collision(self, filedata):
my_file = Node.get_dest_path(filedata["name"], self.username)
try:
collision_exist = os.path.getmtime(my_file) > filedata["time"]
logger.debug("collision check: server time %s client time %s", os.path.getmtime(my_file), filedata["time"])
except OSError as e:
if e.errno == errno.ENOENT:
collision_exist = False
else:
raise
logger.debug("collision check for file %s result %s", my_file, collision_exist)
return collision_exist
示例4: req_push_file
# 需要导入模块: from node import Node [as 别名]
# 或者: from node.Node import get_dest_path [as 别名]
def req_push_file(self, filedata, source_uname, source_ip, source_port):
"""Mark this file as to be notified to clients - this file 'filename' has been modified, pull the latest copy"""
logger.debug("server filedata %s %s", filedata["name"], filedata.keys())
my_file = Node.get_dest_path(filedata["name"], self.username)
# check if there is a conflict
if self.check_collision(filedata):
server_filename = "%s.backup.%s.%s.%s:%s" % (
my_file,
filedata["time"],
source_uname,
source_ip,
source_port,
)
else:
server_filename = my_file
logger.debug("server filename %s returned for file %s", server_filename, filedata["name"])
return server_filename