本文整理汇总了Python中sync.Sync类的典型用法代码示例。如果您正苦于以下问题:Python Sync类的具体用法?Python Sync怎么用?Python Sync使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Sync类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
def main():
parser = argparse.ArgumentParser(description='Sync current folder to your flickr account.')
parser.add_argument('--monitor', action='store_true', help='starts a daemon after sync for monitoring')
parser.add_argument('--starts-with', type=str, help='only sync that path that starts with')
parser.add_argument('--download', type=str, help='download the photos from flickr specify a path or . for all')
parser.add_argument('--ignore-videos', action='store_true', help='ignore video files')
parser.add_argument('--ignore-images', action='store_true', help='ignore image files')
parser.add_argument('--version', action='store_true', help='output current version')
parser.add_argument('--sync-path', type=str, default=os.getcwd(),
help='specify the sync folder (default is current dir)')
parser.add_argument('--custom-set', type=str, help='customize your set name from path with regex')
parser.add_argument('--custom-set-builder', type=str, help='build your custom set title (default just merge groups)')
parser.add_argument('--update-custom-set', action='store_true', help='updates your set title from custom set')
parser.add_argument('--username', type=str, help='token username') #token username argument for api
parser.add_argument('--keyword', action='append', type=str, help='only upload files matching this keyword')
args = parser.parse_args()
if args.version:
# todo get from setup.cfg
logger.info('v0.1.17')
exit()
# validate args
args.is_windows = os.name == 'nt'
args.sync_path = args.sync_path.rstrip(os.sep) + os.sep
if not os.path.exists(args.sync_path):
logger.error('Sync path does not exists')
exit(0)
local = Local(args)
remote = Remote(args)
sync = Sync(args, local, remote)
sync.start_sync()
开发者ID:akaDashe,项目名称:flickrsmartsync,代码行数:34,代码来源:__init__.py
示例2: run
def run(self):
sync = Sync(show_progress=self._isManual, run_silent=self._runSilent, api=globals.traktapi)
sync.sync()
if utilities.getSettingAsBool('tagging_enable') and utilities.getSettingAsBool('tagging_tag_after_sync'):
q = queue.SqliteQueue()
q.append({'action': 'updateTags'})
开发者ID:perern,项目名称:script.trakt,代码行数:7,代码来源:service.py
示例3: sync
def sync(self, dst, event):
"""Sync pdb-rest.db to to local target"""
pdbsync = Sync(
self,
dst,
event)
pdbsync.run()
开发者ID:nlippis,项目名称:vBroker,代码行数:7,代码来源:controller.py
示例4: main
def main():
parser = argparse.ArgumentParser(description='Sync current folder to your flickr account.')
parser.add_argument('--monitor', action='store_true',
help='starts a daemon after sync for monitoring')
parser.add_argument('--dry-run', action='store_true',
help='do not perform any remote action')
parser.add_argument('--starts-with', type=str,
help='only sync that path starts with this text, e.g. "2015/06"')
parser.add_argument('--download', type=str,
help='download the photos from flickr, specify a path or . for all')
parser.add_argument('--ignore-videos', action='store_true',
help='ignore video files')
parser.add_argument('--ignore-images', action='store_true',
help='ignore image files')
parser.add_argument('--ignore-ext', type=str,
help='comma separated list of extensions to ignore, e.g. "jpg,png"')
parser.add_argument('--version', action='store_true',
help='output current version: ' + version)
parser.add_argument('--sync-path', type=str, default=os.getcwd(),
help='specify the sync folder (default is current dir)')
parser.add_argument('--sync-from', type=str,
help='Only supported value: "all". Uploads anything that isn\'t on flickr, and download anything that isn\'t on the local filesystem')
parser.add_argument('--custom-set', type=str,
help='customize your set name from path with regex, e.g. "(.*)/(.*)"')
parser.add_argument('--custom-set-builder', type=str,
help='build your custom set title, e.g. "{0} {1}" to join the first two groups (default merges groups with hyphen)')
parser.add_argument('--update-custom-set', action='store_true',
help='updates your set title from custom-set (and custom-set-builder, if given)')
parser.add_argument('--custom-set-debug', action='store_true',
help='for testing your custom sets, asks for confirmation when creating an album on flickr')
parser.add_argument('--username', type=str,
help='token username') # token username argument for api
parser.add_argument('--add-photo-prefix', type=str,
help='Add a specific prefix to the remote files whose local files have that prefix')
parser.add_argument('--iphoto', action='store_true',
help='Backup iPhoto Masters folder')
parser.add_argument('--keyword', action='append', type=str,
help='only upload files matching this keyword')
args = parser.parse_args()
if args.version:
logger.info(version)
exit()
# validate args
args.is_windows = os.name == 'nt'
args.sync_path = args.sync_path.rstrip(os.sep) + os.sep
if not os.path.exists(args.sync_path):
logger.error('Sync path does not exists')
exit(0)
local = Local(args)
remote = Remote(args)
sync = Sync(args, local, remote)
sync.start_sync()
开发者ID:pthiben,项目名称:flickrsmartsync,代码行数:56,代码来源:__init__.py
示例5: main
def main():
parser = argparse.ArgumentParser(description="Sync current folder to your flickr account.")
parser.add_argument("--monitor", action="store_true", help="starts a daemon after sync for monitoring")
parser.add_argument("--starts-with", type=str, help='only sync that path starts with this text, e.g. "2015/06"')
parser.add_argument("--download", type=str, help="download the photos from flickr, specify a path or . for all")
parser.add_argument("--ignore-videos", action="store_true", help="ignore video files")
parser.add_argument("--ignore-images", action="store_true", help="ignore image files")
parser.add_argument("--ignore-ext", type=str, help='comma separated list of extensions to ignore, e.g. "jpg,png"')
parser.add_argument("--version", action="store_true", help="output current version: " + version)
parser.add_argument(
"--sync-path", type=str, default=os.getcwd(), help="specify the sync folder (default is current dir)"
)
parser.add_argument(
"--sync-from",
type=str,
help="Only supported value: \"all\". Uploads anything that isn't on flickr, and download anything that isn't on the local filesystem",
)
parser.add_argument("--custom-set", type=str, help='customize your set name from path with regex, e.g. "(.*)/(.*)"')
parser.add_argument(
"--custom-set-builder",
type=str,
help='build your custom set title, e.g. "{0} {1}" to join the first two groups (default merges groups with hyphen)',
)
parser.add_argument(
"--update-custom-set",
action="store_true",
help="updates your set title from custom-set (and custom-set-builder, if given)",
)
parser.add_argument(
"--custom-set-debug",
action="store_true",
help="for testing your custom sets, asks for confirmation when creating an album on flickr",
)
parser.add_argument("--username", type=str, help="token username") # token username argument for api
parser.add_argument("--keyword", action="append", type=str, help="only upload files matching this keyword")
args = parser.parse_args()
if args.version:
logger.info(version)
exit()
# validate args
args.is_windows = os.name == "nt"
args.sync_path = args.sync_path.rstrip(os.sep) + os.sep
if not os.path.exists(args.sync_path):
logger.error("Sync path does not exists")
exit(0)
local = Local(args)
remote = Remote(args)
sync = Sync(args, local, remote)
sync.start_sync()
开发者ID:baboulaz,项目名称:flickrsmartsync,代码行数:53,代码来源:__init__.py
示例6: run
def run(self):
"""
Thread: Run
"""
s = Sync(self.src, self.dst, **self.kwargs)
s.diff()
self.loadInitContents(s)
s.progressfnc = self.progress
while True:
s.diff()
s.difftrim(create=self.getInitContents())
s.run()
time.sleep(self.freq)
开发者ID:moonbot,项目名称:filesync,代码行数:13,代码来源:watch.py
示例7: onLogin
def onLogin(self, host, username, passwd, ssl):
"""
Slot. Triggers a log in request to the server.
:param host: Indicates the hostname of the FTP server
:param username: Username to log in into the FTP server
:param passwd: Password to log in into the FTP server
:param ssl: Indicates whether the FTP needs SSL support
"""
self.sync = Sync(host, ssl)
self.syncStarted.connect(self.sync.initQueue)
self.sync.server.downloadProgress.connect(self.onDownloadProgress)
self.sync.server.uploadProgress.connect(self.onUploadProgress)
self.sync.server.fileEvent.connect(self.onFileEvent)
self.sync.server.badFilenameFound.connect(self.badNameWarning)
self.sync.server.loginCompleted.connect(self.onLoginCompleted)
self.sync.server.fileEventCompleted.connect(self.onFileEventCompleted)
self.sync.server.ioError.connect(self.onIOError)
# Added by Si
self.sync.server.textStatus.connect(self.setStatus)
self.sync.statusChanged.connect(self.setStatus)
self.loginRequested.connect(self.sync.server.onLogin)
self.syncThread = QThread()
self.sync.moveToThread(self.syncThread)
self.syncThread.start()
QApplication.instance().lastWindowClosed.connect(self.syncThread.quit)
self.loginRequested.emit(username, passwd)
开发者ID:ShareByLink,项目名称:iqbox-ftp,代码行数:31,代码来源:window.py
示例8: setUp
def setUp(self, glancesync):
"""create constructor, mock with glancesync, Set a master region"""
self.regions = []
self.sync = Sync(self.regions)
self.glancesync = glancesync
config = {'return_value.master_region': 'MasterRegion'}
self.glancesync.configure_mock(**config)
开发者ID:rachmadagitam,项目名称:ops.Glancesync,代码行数:7,代码来源:test_sync.py
示例9: onShow
def onShow(self):
print(self.controller.get_srvAddr())
self.sync = Sync(srvAddr=self.controller.get_srvAddr(),conn=self.conn,session=self.controller.get_session())
if self.sync is not None:
self.sync.dosync()
self.remotePgmTotal = self.sync.getRemoteProgramTotalCount()
self.remoteTrackTotal = self.sync.getRemoteTrackTotalCount()
banner = Frame(self)
banner.grid(row=0,column=0,sticky="WE")
self.label = Label(banner,image=self.logo)
self.label.image = self.logo
self.label.pack()
body = Frame(self)
body.grid(row=1,column=0,sticky="NSWE")
Label(body,text="歌曲同步中...",padding=(10, 5, 10, 5)).grid(row=1,column=0,sticky="WE")
self.pgb_media = Progressbar(body, orient="horizontal", length=200, mode="determinate")
self.pgb_media.grid(row=1,column=1,sticky="WE")
self.pgb_media["value"]=0
self.pgb_media["maximum"]=self.remoteTrackTotal
self.sync.start()
self.checkstatus()
开发者ID:walton007,项目名称:envomuseDeliveryTool,代码行数:27,代码来源:start.py
示例10: run
def run(self, orig_args):
options,args = self.parser.parse_args(orig_args)
args = args[1:]
if len(args) <= 0:
self.print_usage()
return
project_dir = self.git.module_name(args[0])
if project_dir == None or len(project_dir) <= 0:
print("Unknow project name.Please use git clone, then use mgit sync in the project dir.")
return
cmd = ['git', 'clone'] + args
if options.branch != None:
cmd += ["-b", options.branch]
if 0 != os.system(" ".join(cmd)):
return
cwd = os.getcwd()
os.chdir("/".join([cwd, project_dir]))
sync = Sync()
sync.run(['sync'] + orig_args[1:])
os.chdir(cwd)
开发者ID:cpsoft,项目名称:mgit,代码行数:20,代码来源:clone.py
示例11: Execute
def Execute(self, opt, args):
if os.path.exists(os.path.join(self.repodir, "projects")):
print >>sys.stderr, "this working directory has already been cloned into. exiting."
sys.exit(1)
#run Sync to clone the repos into the tree the way Repo expects them
sync_cmd = Sync()
sync_cmd.NAME = 'sync'
sync_cmd.manifest = self.manifest
sync_cmd.repodir = self.repodir
argv = sys.argv
argv = argv[argv.index('--')+2:]
newopts, newargs = sync_cmd.OptionParser.parse_args(argv)
sync_cmd.Execute(newopts, newargs)
#checkout master everywhere
for project in self.GetProjects(''):
print >>sys.stdout, "%s:" % project.name
out = project.work_git.checkout("-t", "-b", "master", "remotes/origin/master")
print >>sys.stdout, out
print >>sys.stdout
开发者ID:lost-theory,项目名称:tools_repo,代码行数:21,代码来源:clone.py
示例12: op_sync
def op_sync (self):
conf = self.get_config()
pname = self._load_profile()
sync = Sync(conf, pname, self.get_db(), dr=self.is_dry_run())
if self.is_dry_run():
sync.prep_lists(self.get_sync_dir())
else:
try:
startt = conf.get_curr_time()
result = sync.sync(self.get_sync_dir())
if result:
conf.set_last_sync_start(pname, val=startt)
conf.set_last_sync_stop(pname)
logging.info('Updating item inventory...')
sync.save_item_lists()
logging.info('Updating item inventory...done')
else:
logging.info('timestamps not reset for profile %s due to '
'errors (previously identified).', pname)
except Exception, e:
logging.critical('Exception (%s) while syncing profile %s',
str(e), pname)
logging.critical(traceback.format_exc())
return False
开发者ID:jt74,项目名称:emacs,代码行数:25,代码来源:asynk.py
示例13: TestSync
class TestSync(unittest.TestCase):
"""Class to test all methods but constructor and parallel sync"""
@patch('sync.GlanceSync', auto_spec=True)
def setUp(self, glancesync):
"""create constructor, mock with glancesync, Set a master region"""
self.regions = []
self.sync = Sync(self.regions)
self.glancesync = glancesync
config = {'return_value.master_region': 'MasterRegion'}
self.glancesync.configure_mock(**config)
def test_report_status(self):
"""check that calls to export_sync_region_status are done"""
self.sync.regions = ['region1', 'region2']
self.sync.report_status()
calls = [call('region1', ANY), call('region2', ANY)]
self.glancesync.return_value.export_sync_region_status.\
assert_has_calls(calls)
def test_sequential_sync(self):
"""check that calls to sync_region are done"""
self.sync.regions = ['region1', 'region2']
self.sync.sequential_sync(dry_run=True)
calls = [call('region1', dry_run=True), call('region2', dry_run=True)]
self.glancesync.return_value.sync_region.assert_has_calls(calls)
def test_show_regions(self):
"""check that calls to get_regions are done"""
targets = {'master': None, 'other_target': None}
config = {'return_value.targets': targets}
self.glancesync.configure_mock(**config)
self.sync.show_regions()
calls = [call(), call(target='other_target')]
self.glancesync.return_value.get_regions.assert_has_calls(calls)
@patch('sync.os')
@patch('sync.datetime')
def test_make_backup(self, datetime_mock, os_mock):
"""check make backup; calls are correct and mkdir is invoked with
right parameters"""
datetime_str = '2020-02-06T23:57:09.205378'
config = {'datetime.now.return_value.isoformat.return_value':
datetime_str}
datetime_mock.configure_mock(**config)
self.sync.make_backup()
dir_name = 'backup_glance_' + datetime_str
os_mock.mkdir.assert_called_with(dir_name)
self.glancesync.return_value.backup_glancemetadata_region.\
assert_called_with('MasterRegion', dir_name)
开发者ID:rachmadagitam,项目名称:ops.Glancesync,代码行数:49,代码来源:test_sync.py
示例14: SyncFrame
class SyncFrame(Frame):
def __init__(self,master=None,controller=None,conn=None):
Frame.__init__(self,master)
self.controller = controller
self.conn = self.controller.get_conn()
self.logo = self.controller.get_logo()
self.remotePgmTotal = 0
self.remoteTrackTotal = 0
def onShow(self):
print(self.controller.get_srvAddr())
self.sync = Sync(srvAddr=self.controller.get_srvAddr(),conn=self.conn,session=self.controller.get_session())
if self.sync is not None:
self.sync.dosync()
self.remotePgmTotal = self.sync.getRemoteProgramTotalCount()
self.remoteTrackTotal = self.sync.getRemoteTrackTotalCount()
banner = Frame(self)
banner.grid(row=0,column=0,sticky="WE")
self.label = Label(banner,image=self.logo)
self.label.image = self.logo
self.label.pack()
body = Frame(self)
body.grid(row=1,column=0,sticky="NSWE")
Label(body,text="歌曲同步中...",padding=(10, 5, 10, 5)).grid(row=1,column=0,sticky="WE")
self.pgb_media = Progressbar(body, orient="horizontal", length=200, mode="determinate")
self.pgb_media.grid(row=1,column=1,sticky="WE")
self.pgb_media["value"]=0
self.pgb_media["maximum"]=self.remoteTrackTotal
self.sync.start()
self.checkstatus()
def checkstatus(self):
self.pgb_media["value"] = 0 if self.sync is None else self.sync.getTrackIdx()
if self.pgb_media["value"] >= self.remoteTrackTotal:
self.gotoMain()
else:
self.after(200,self.checkstatus)
def gotoMain(self):
print('going to main....')
self.controller.show_frame(EnvoMaster)
开发者ID:walton007,项目名称:envomuseDeliveryTool,代码行数:49,代码来源:start.py
示例15: __init__
def __init__(self, port, virtual_world, camera_mgr, sync_session):
self.port = port
self.virtual_world = virtual_world
self.cam_mgr = camera_mgr
self.task_mgr = virtual_world.taskMgr
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cReader.setRawMode(True)
self.cWriter = ConnectionWriter(self.cManager, 1)
self.cWriter.setRawMode(True)
self.tcpSocket = self.cManager.openTCPServerRendezvous(port, BACKLOG)
self.cListener.addConnection(self.tcpSocket)
self.activeSessions = {}
self.connection_map = {}
self.set_handlers()
hostname = socket.gethostname()
a, b, address_list = socket.gethostbyname_ex(hostname)
self.ip = address_list[0]
logging.info("Addresses %s" % address_list)
logging.info("Server is running on ip: %s, port: %s"
%(self.ip, self.port))
self.client_counter = 0
self.read_buffer = ''
self.read_state = 0
self.read_body_length = 0
self.packet = SocketPacket()
controller = virtual_world.getController()
self.sync = Sync(self.task_mgr, controller, camera_mgr, sync_session)
self.vv_id = None
if sync_session:
logging.info("Waiting for Sync Client!")
self.showing_info = False
virtual_world.accept("i", self.toggleInfo)
self.sync_session = sync_session
self.createInfoLabel()
atexit.register(self.exit)
开发者ID:shubhamgoyal,项目名称:virtual-vision-simulator,代码行数:44,代码来源:socket_server.py
示例16: op_sync
def op_sync (self):
conf = self.get_config()
pname = self._load_profile()
startt_old = conf.get_last_sync_start(pname)
stopt_old = conf.get_last_sync_stop(pname)
if self.is_sync_all():
# This is the case the user wants to force a sync ignoring the
# earlier sync states. This is useful when ASynK code changes -
# and let's say we add support for synching a enw field, or some
# such.
#
# This works by briefly resetting the last sync start and stop
# times to fool the system. If the user is doing a dry run, we
# will restore his earlier times dutifully.
if self.is_dry_run():
logging.debug('Temporarily resetting last sync times...')
conf.set_last_sync_start(pname, val=utils.time_start)
conf.set_last_sync_stop(pname, val=utils.time_start)
sync = Sync(conf, pname, [x.get_db() for x in self.get_colls()],
dr=self.is_dry_run())
if self.is_dry_run():
sync.prep_lists(self.get_sync_dir())
# Since it is only a dry run, resetting to the timestamps to the
# real older sync is sort of called for.
conf.set_last_sync_start(pname, val=startt_old)
conf.set_last_sync_stop(pname, val=stopt_old)
logging.debug('Reset last sync timestamps to real values')
else:
try:
startt = conf.get_curr_time()
result = sync.sync(self.get_sync_dir())
if result:
conf.set_last_sync_start(pname, val=startt)
conf.set_last_sync_stop(pname)
logging.info('Updating item inventory...')
sync.save_item_lists()
logging.info('Updating item inventory...done')
else:
logging.info('timestamps not reset for profile %s due to '
'errors (previously identified).', pname)
except Exception, e:
logging.critical('Exception (%s) while syncing profile %s',
str(e), pname)
logging.critical(traceback.format_exc())
return False
开发者ID:xgid,项目名称:ASynK,代码行数:47,代码来源:asynk_core.py
示例17: test_push
def test_push(self):
sync = Sync("https://ersatzworld.net/ctpwdgen-server/", 'inter', 'op', 'file.pem')
self.assertTrue(sync.push(str(b64encode(b'Test'), encoding='utf-8')))
开发者ID:JPO1,项目名称:ctSESAM-pyside,代码行数:3,代码来源:test_Sync.py
示例18: SocketServer
class SocketServer():
def __init__(self, port, virtual_world, camera_mgr, sync_session):
self.port = port
self.virtual_world = virtual_world
self.cam_mgr = camera_mgr
self.task_mgr = virtual_world.taskMgr
self.cManager = QueuedConnectionManager()
self.cListener = QueuedConnectionListener(self.cManager, 0)
self.cReader = QueuedConnectionReader(self.cManager, 0)
self.cReader.setRawMode(True)
self.cWriter = ConnectionWriter(self.cManager, 1)
self.cWriter.setRawMode(True)
self.tcpSocket = self.cManager.openTCPServerRendezvous(port, BACKLOG)
self.cListener.addConnection(self.tcpSocket)
self.activeSessions = {}
self.connection_map = {}
self.set_handlers()
hostname = socket.gethostname()
a, b, address_list = socket.gethostbyname_ex(hostname)
self.ip = address_list[0]
logging.info("Addresses %s" % address_list)
logging.info("Server is running on ip: %s, port: %s"
%(self.ip, self.port))
self.client_counter = 0
self.read_buffer = ''
self.read_state = 0
self.read_body_length = 0
self.packet = SocketPacket()
controller = virtual_world.getController()
self.sync = Sync(self.task_mgr, controller, camera_mgr, sync_session)
self.vv_id = None
if sync_session:
logging.info("Waiting for Sync Client!")
self.showing_info = False
virtual_world.accept("i", self.toggleInfo)
self.sync_session = sync_session
self.createInfoLabel()
atexit.register(self.exit)
def createInfoLabel(self):
string = self.generateInfoString()
self.info_label = OST(string,
pos=(-1.3, -0.5),
fg=(1,1,1,1),
bg=(0,0,0,0.7),
scale=0.05,
align=TextNode.ALeft)
self.info_label.hide()
def generateInfoString(self,):
string = " IP:\t%s \n" % self.ip
string += " PORT:\t%s \n" % self.port
if self.sync_session:
string += " MODE:\tSync Client\n"
string += " VV ID:\t%s\n" % self.vv_id
else:
string += " MODE:\tAutomatic\n"
cameras = self.cam_mgr.getCameras()
num_cameras = len(cameras)
for camera in cameras:
id = camera.getId()
type = camera.getTypeString()
string += " Cam%s:\t%s\n" %(id, type)
string += "\n"
return string
def set_handlers(self):
self.task_mgr.add(self.connection_polling, "Poll new connections", -39)
self.task_mgr.add(self.reader_polling, "Poll reader", -40)
self.task_mgr.add(self.disconnection_polling, "PollDisconnections", -41)
def connection_polling(self, taskdata):
if self.cListener.newConnectionAvailable():
rendezvous = PointerToConnection()
netAddress = NetAddress()
newConn = PointerToConnection()
if self.cListener.getNewConnection(rendezvous,netAddress, newConn):
conn = newConn.p()
self.cReader.addConnection(conn) # Begin reading connection
conn_id = self.client_counter
logging.info("New Connection from ip:%s, conn:%s"
% (conn.getAddress(), conn_id))
self.connection_map[conn_id] = conn
self.client_counter += 1
message = eVV_ACK_OK(self.ip, self.port, conn_id)
self.sendMessage(message, conn)
#.........这里部分代码省略.........
开发者ID:shubhamgoyal,项目名称:virtual-vision-simulator,代码行数:101,代码来源:socket_server.py
示例19: Sync
# Operations
group = optparse.OptionGroup(parser, 'Operations', 'Type of sync to run, only supply one.')
group.add_option('--watch', help='Watch the source folder for changes and sync them to the destination folder',
dest='watch', action='store_true', default=False)
group.add_option('--run', help='Run sync with custom flags specified below',
dest='run', action='store_true', default=False)
parser.add_option_group(group)
help = {'update':'Update files that are changed in the source folder to the destination',
'newer':'Only update if the source file is newer than the destination',
'create':'Create files that don\'t currently exist in destination',
'purge':'Delete files that don\'t currently exist in destination',
'watch':'Keep the sync alive and monitor source folder for changes'}
# Flags
s = Sync()
opts = s.getopts()
group = optparse.OptionGroup(parser, 'Flags', 'Flags to adjust sync')
for k in opts.keys():
typ = 'string'
kwargs = {}
if isinstance(opts[k], bool):
typ = 'choice'
kwargs['choices'] = ['True', 'False']
group.add_option('--{0}'.format(k), help=(help[k] + ' ' if help.has_key(k) else '') + 'Default: {0}'.format(opts[k]),
dest=k, action='store', default=None, type=typ, **kwargs)
del s
parser.add_option_group(group)
# Watch folder customization
group = optparse.OptionGroup(parser, 'Watch Folder Attributes')
开发者ID:moonbot,项目名称:filesync,代码行数:31,代码来源:__main__.py
示例20: create_sync
def create_sync(self):
"""
creates a sync object.
"""
self.sync = Sync(self.server_address, self.username, self.password, self.certificate_file.name)
开发者ID:JPO1,项目名称:ctSESAM-pyside,代码行数:5,代码来源:sync_manager.py
注:本文中的sync.Sync类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论