This commit is contained in:
Petr Kalis 2020-09-18 19:08:15 +02:00
parent e793ee1c11
commit 0ed04d2c5e
4 changed files with 31 additions and 20 deletions

View file

@ -1663,9 +1663,7 @@ def timeit(method):
name = kw.get('log_name', method.__name__.upper())
kw['log_time'][name] = int((te - ts) * 1000)
else:
log.debug('%r %2.2f ms' % \
(method.__name__, (te - ts) * 1000))
print('%r %2.2f ms' % \
(method.__name__, (te - ts) * 1000))
log.debug('%r %2.2f ms' % (method.__name__, (te - ts) * 1000))
print('%r %2.2f ms' % (method.__name__, (te - ts) * 1000))
return result
return timed

View file

@ -2,4 +2,4 @@ from .sync_server import SyncServer
def tray_init(tray_widget, main_widget):
return SyncServer()
return SyncServer()

View file

@ -8,10 +8,13 @@ class AbstractProvider(metaclass=ABCMeta):
"""
Copy file from 'source_path' to 'target_path' on provider.
Use 'overwrite' boolean to rewrite existing file on provider
:param source_path: absolute path on local system
:param target_path: absolute path on provider (GDrive etc.)
:param overwrite: <boolean> True if overwite existing
:return: <string> file_id of created file, raises exception
Args:
source_path (string): absolute path on local system
target_path (string): absolute path on provider (GDrive etc.)
overwrite (boolean): True if overwite existing
Returns:
(string) file_id of created file, raises exception
"""
pass
@ -19,9 +22,12 @@ class AbstractProvider(metaclass=ABCMeta):
def download_file(self, source_path, local_path):
"""
Download file from provider into local system
:param source_path: absolute path on provider
:param local_path: absolute path on local
:return:
Args:
source_path (string): absolute path on provider
local_path (string): absolute path on local
Returns:
None
"""
pass
@ -29,8 +35,12 @@ class AbstractProvider(metaclass=ABCMeta):
def delete_file(self, path):
"""
Deletes file from 'path'. Expects path to specific file.
:param path: absolute path to particular file
:return: None
Args:
path (string): absolute path to particular file
Returns:
None
"""
pass
@ -38,7 +48,10 @@ class AbstractProvider(metaclass=ABCMeta):
def list_folder(self, folder_path):
"""
List all files and subfolders of particular path non-recursively.
:param folder_path: absolut path on provider
:return: <list>
Args:
folder_path (string): absolut path on provider
Returns:
(list)
"""
pass
pass

View file

@ -114,7 +114,8 @@ class SyncServer():
Returns:
(list)
"""
retries_str = "null,"+",".join([str(i) for i in range(self.RETRY_CNT)])
retries_str = "null," + \
",".join([str(i) for i in range(self.RETRY_CNT)])
representations = io.find({
"type": "representation",
"$or": [
@ -399,7 +400,7 @@ class SyncServer():
"files._id": file_id
}
update = {
"$unset": {"files.$.sites.{}".format(site_index): ""}
"$unset": {"files.$.sites.{}".format(site_index): ""}
}
# it actually modifies single _id, but io.update_one not implemented
io.update_many(
@ -533,7 +534,6 @@ class SynchServerThread(threading.Thread):
try:
while self.is_running:
import time
from datetime import datetime
start_time = time.time()
sync_representations = self.module.get_sync_representations()