synapseclient 4.3.0__tar.gz → 4.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {synapseclient-4.3.0/synapseclient.egg-info → synapseclient-4.3.1}/PKG-INFO +1 -2
- {synapseclient-4.3.0 → synapseclient-4.3.1}/setup.cfg +0 -1
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/client.py +1 -52
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/multipart_upload_async.py +2 -12
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/upload_functions_async.py +3 -27
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/utils.py +2 -34
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/file.py +1 -9
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/synapsePythonClient +1 -1
- {synapseclient-4.3.0 → synapseclient-4.3.1/synapseclient.egg-info}/PKG-INFO +1 -2
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient.egg-info/requires.txt +0 -1
- {synapseclient-4.3.0 → synapseclient-4.3.1}/MANIFEST.in +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/README.md +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/pyproject.toml +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/setup.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/.synapseConfig +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/__main__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/activity.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/annotations.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/api/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/api/annotations.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/api/entity_bundle_services_v2.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/api/entity_services.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/api/file_services.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/async_utils.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/cache.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/config.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/constants/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/constants/concrete_types.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/constants/config_file_constants.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/constants/limits.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/constants/method_flags.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/credentials/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/credentials/cred_data.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/credentials/credential_provider.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/cumulative_transfer_progress.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/dozer.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/exceptions.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/lock.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/logging_setup.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/models/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/models/custom_json.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/models/dict_object.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/models/permission.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/multithread_download/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/multithread_download/download_threads.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/pool_provider.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/remote_file_storage_wrappers.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/retry.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/sts_transfer.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/multipart_upload.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/upload_functions.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/upload_utils.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/version_check.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/entity.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/evaluation.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/activity.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/annotations.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/evaluation.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/folder.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/mixins/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/mixins/access_control.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/mixins/storable_container.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/project.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/access_control_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/activity_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/annotations_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/file_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/folder_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/project_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/storable_container_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/table_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/team_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/user_protocol.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/services/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/services/search.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/services/storable_entity.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/services/storable_entity_components.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/table.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/team.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/user.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/wiki.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/services/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/services/json_schema.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/table.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/team.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/wiki.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient.egg-info/SOURCES.txt +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient.egg-info/dependency_links.txt +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient.egg-info/entry_points.txt +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient.egg-info/not-zip-safe +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient.egg-info/top_level.txt +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseutils/__init__.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseutils/copy_functions.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseutils/describe_functions.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseutils/migrate_functions.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseutils/monitor.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseutils/sync.py +0 -0
- {synapseclient-4.3.0 → synapseclient-4.3.1}/synapseutils/walk_functions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: synapseclient
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.1
|
|
4
4
|
Summary: A client for Synapse, a collaborative, open-source research platform that allows teams to share data, track analyses, and collaborate.
|
|
5
5
|
Home-page: https://www.synapse.org
|
|
6
6
|
Author: The Synapse Engineering Team
|
|
@@ -39,7 +39,6 @@ Requires-Dist: nest-asyncio~=1.6.0
|
|
|
39
39
|
Requires-Dist: asyncio-atexit~=1.0.1
|
|
40
40
|
Requires-Dist: httpx~=0.27.0
|
|
41
41
|
Requires-Dist: tqdm<5.0,>=4.66.2
|
|
42
|
-
Requires-Dist: loky~=3.0.0
|
|
43
42
|
Requires-Dist: async-lru~=2.0.4
|
|
44
43
|
Requires-Dist: psutil~=5.9.8
|
|
45
44
|
Provides-Extra: dev
|
|
@@ -34,7 +34,6 @@ import httpx
|
|
|
34
34
|
from deprecated import deprecated
|
|
35
35
|
|
|
36
36
|
from concurrent.futures import ThreadPoolExecutor
|
|
37
|
-
from loky import get_reusable_executor
|
|
38
37
|
|
|
39
38
|
import synapseclient
|
|
40
39
|
from .annotations import (
|
|
@@ -399,7 +398,6 @@ class Synapse(object):
|
|
|
399
398
|
self._thread_executor = {}
|
|
400
399
|
self._process_executor = {}
|
|
401
400
|
self._parallel_file_transfer_semaphore = {}
|
|
402
|
-
self._md5_semaphore = {}
|
|
403
401
|
self.use_boto_sts_transfers = transfer_config["use_boto_sts"]
|
|
404
402
|
|
|
405
403
|
def _get_requests_session_async_synapse(
|
|
@@ -510,55 +508,6 @@ class Synapse(object):
|
|
|
510
508
|
asyncio_atexit.register(close_pool)
|
|
511
509
|
return self._thread_executor[asyncio_event_loop]
|
|
512
510
|
|
|
513
|
-
def _get_process_pool_executor(self, asyncio_event_loop: asyncio.AbstractEventLoop):
|
|
514
|
-
"""
|
|
515
|
-
Retrieve the process pool executor for the Synapse client. Or create a new one
|
|
516
|
-
if it does not exist. This executor is used for parallel processing of data.
|
|
517
|
-
|
|
518
|
-
This is expected to be called from within an AsyncIO loop.
|
|
519
|
-
|
|
520
|
-
Note: Within Windows a ProcessPoolExecutor requires that the initial entry point
|
|
521
|
-
into the code be within a `if __name__ == "__main__":` block. This is not
|
|
522
|
-
possible within the current codebase as it would require everyone using this
|
|
523
|
-
library to have this as their entry point. As a result, the ProcessPoolExecutor
|
|
524
|
-
will not work within Windows.
|
|
525
|
-
|
|
526
|
-
To get around this Windows limitation this is using this package:
|
|
527
|
-
https://github.com/joblib/loky
|
|
528
|
-
"""
|
|
529
|
-
if (
|
|
530
|
-
hasattr(self, "_process_executor")
|
|
531
|
-
and asyncio_event_loop in self._process_executor
|
|
532
|
-
and self._process_executor[asyncio_event_loop] is not None
|
|
533
|
-
):
|
|
534
|
-
return self._process_executor[asyncio_event_loop]
|
|
535
|
-
|
|
536
|
-
self._process_executor.update({asyncio_event_loop: get_reusable_executor(1)})
|
|
537
|
-
|
|
538
|
-
return self._process_executor[asyncio_event_loop]
|
|
539
|
-
|
|
540
|
-
def _get_md5_semaphore(
|
|
541
|
-
self, asyncio_event_loop: asyncio.AbstractEventLoop
|
|
542
|
-
) -> asyncio.Semaphore:
|
|
543
|
-
"""
|
|
544
|
-
Retrieve the semaphore for the Synapse client. Or create a new one if it does not
|
|
545
|
-
exist. This semaphore is used to ensure that only one process is calculating the
|
|
546
|
-
MD5 hash at a time. This is to prevent the custom process pool executor from
|
|
547
|
-
thrashing or handling the waiting. We should let asyncio handle the waiting.
|
|
548
|
-
|
|
549
|
-
This is expected to be called from within an AsyncIO loop.
|
|
550
|
-
"""
|
|
551
|
-
if (
|
|
552
|
-
hasattr(self, "_md5_semaphore")
|
|
553
|
-
and asyncio_event_loop in self._md5_semaphore
|
|
554
|
-
and self._md5_semaphore[asyncio_event_loop] is not None
|
|
555
|
-
):
|
|
556
|
-
return self._md5_semaphore[asyncio_event_loop]
|
|
557
|
-
|
|
558
|
-
self._md5_semaphore.update({asyncio_event_loop: asyncio.Semaphore(1)})
|
|
559
|
-
|
|
560
|
-
return self._md5_semaphore[asyncio_event_loop]
|
|
561
|
-
|
|
562
511
|
def _get_parallel_file_transfer_semaphore(
|
|
563
512
|
self, asyncio_event_loop: asyncio.AbstractEventLoop
|
|
564
513
|
) -> asyncio.Semaphore:
|
|
@@ -3534,7 +3483,7 @@ class Synapse(object):
|
|
|
3534
3483
|
else:
|
|
3535
3484
|
mode = "wb"
|
|
3536
3485
|
previouslyTransferred = 0
|
|
3537
|
-
sig = hashlib.new("md5", usedforsecurity=False)
|
|
3486
|
+
sig = hashlib.new("md5", usedforsecurity=False) # nosec
|
|
3538
3487
|
|
|
3539
3488
|
try:
|
|
3540
3489
|
with open(temp_destination, mode) as fd:
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/multipart_upload_async.py
RENAMED
|
@@ -114,7 +114,7 @@ from synapseclient.core.upload.upload_utils import (
|
|
|
114
114
|
)
|
|
115
115
|
from synapseclient.core.utils import MB
|
|
116
116
|
from synapseclient.core.utils import md5_fn as md5_fn_util
|
|
117
|
-
from synapseclient.core.utils import
|
|
117
|
+
from synapseclient.core.utils import md5_for_file_hex
|
|
118
118
|
|
|
119
119
|
if TYPE_CHECKING:
|
|
120
120
|
from synapseclient import Synapse
|
|
@@ -669,17 +669,7 @@ async def multipart_upload_file_async(
|
|
|
669
669
|
mime_type, _ = mimetypes.guess_type(file_path, strict=False)
|
|
670
670
|
content_type = mime_type or "application/octet-stream"
|
|
671
671
|
|
|
672
|
-
md5_hex = md5 or (
|
|
673
|
-
await md5_for_file_multiprocessing(
|
|
674
|
-
filename=file_path,
|
|
675
|
-
process_pool_executor=syn._get_process_pool_executor(
|
|
676
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
677
|
-
),
|
|
678
|
-
md5_semaphore=syn._get_md5_semaphore(
|
|
679
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
680
|
-
),
|
|
681
|
-
)
|
|
682
|
-
)
|
|
672
|
+
md5_hex = md5 or md5_for_file_hex(filename=file_path)
|
|
683
673
|
|
|
684
674
|
part_size = get_part_size(
|
|
685
675
|
part_size or DEFAULT_PART_SIZE,
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/upload/upload_functions_async.py
RENAMED
|
@@ -77,15 +77,7 @@ async def upload_file_handle(
|
|
|
77
77
|
expanded_upload_path = os.path.expandvars(os.path.expanduser(path))
|
|
78
78
|
|
|
79
79
|
if md5 is None and os.path.isfile(expanded_upload_path):
|
|
80
|
-
md5 =
|
|
81
|
-
filename=expanded_upload_path,
|
|
82
|
-
process_pool_executor=syn._get_process_pool_executor(
|
|
83
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
84
|
-
),
|
|
85
|
-
md5_semaphore=syn._get_md5_semaphore(
|
|
86
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
87
|
-
),
|
|
88
|
-
)
|
|
80
|
+
md5 = utils.md5_for_file_hex(filename=expanded_upload_path)
|
|
89
81
|
|
|
90
82
|
entity_parent_id = id_of(parent_entity_id)
|
|
91
83
|
|
|
@@ -203,15 +195,7 @@ async def create_external_file_handle(
|
|
|
203
195
|
parsed_url = urllib_parse.urlparse(url)
|
|
204
196
|
parsed_path = file_url_to_path(url)
|
|
205
197
|
if parsed_url.scheme == "file" and os.path.isfile(parsed_path):
|
|
206
|
-
actual_md5 =
|
|
207
|
-
filename=parsed_path,
|
|
208
|
-
process_pool_executor=syn._get_process_pool_executor(
|
|
209
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
210
|
-
),
|
|
211
|
-
md5_semaphore=syn._get_md5_semaphore(
|
|
212
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
213
|
-
),
|
|
214
|
-
)
|
|
198
|
+
actual_md5 = utils.md5_for_file_hex(filename=parsed_path)
|
|
215
199
|
if md5 is not None and md5 != actual_md5:
|
|
216
200
|
raise SynapseMd5MismatchError(
|
|
217
201
|
f"The specified md5 [{md5}] does not match the calculated md5 "
|
|
@@ -255,15 +239,7 @@ async def upload_external_file_handle_sftp(
|
|
|
255
239
|
storage_str=storage_str,
|
|
256
240
|
)
|
|
257
241
|
|
|
258
|
-
file_md5 = md5 or
|
|
259
|
-
filename=file_path,
|
|
260
|
-
process_pool_executor=syn._get_process_pool_executor(
|
|
261
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
262
|
-
),
|
|
263
|
-
md5_semaphore=syn._get_md5_semaphore(
|
|
264
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
265
|
-
),
|
|
266
|
-
)
|
|
242
|
+
file_md5 = md5 or utils.md5_for_file_hex(filename=file_path)
|
|
267
243
|
file_handle = await post_external_filehandle(
|
|
268
244
|
external_url=uploaded_url,
|
|
269
245
|
mimetype=mimetype,
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Utility functions useful in the implementation and testing of the Synapse client.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
import asyncio
|
|
6
5
|
import base64
|
|
7
6
|
import cgi
|
|
8
7
|
import collections.abc
|
|
@@ -68,7 +67,7 @@ def md5_for_file(
|
|
|
68
67
|
The MD5 Checksum
|
|
69
68
|
"""
|
|
70
69
|
loop_iteration = 0
|
|
71
|
-
md5 = hashlib.new("md5", usedforsecurity=False)
|
|
70
|
+
md5 = hashlib.new("md5", usedforsecurity=False) # nosec
|
|
72
71
|
with open(filename, "rb") as f:
|
|
73
72
|
while True:
|
|
74
73
|
loop_iteration += 1
|
|
@@ -106,37 +105,6 @@ def md5_for_file_hex(
|
|
|
106
105
|
return md5_for_file(filename, block_size, callback).hexdigest()
|
|
107
106
|
|
|
108
107
|
|
|
109
|
-
async def md5_for_file_multiprocessing(
|
|
110
|
-
filename: str,
|
|
111
|
-
process_pool_executor,
|
|
112
|
-
md5_semaphore: asyncio.Semaphore,
|
|
113
|
-
block_size: int = 2 * MB,
|
|
114
|
-
) -> str:
|
|
115
|
-
"""
|
|
116
|
-
Calculates the MD5 of the given file.
|
|
117
|
-
See source <http://stackoverflow.com/questions/1131220/get-md5-hash-of-a-files-without-open-it-in-python>.
|
|
118
|
-
|
|
119
|
-
Arguments:
|
|
120
|
-
filename: The file to read in
|
|
121
|
-
process_pool_executor: The process pool executor to use for the calculation.
|
|
122
|
-
md5_semaphore: The semaphore to use for waiting to calculate.
|
|
123
|
-
block_size: How much of the file to read in at once (bytes).
|
|
124
|
-
Defaults to 2 MB.
|
|
125
|
-
|
|
126
|
-
Returns:
|
|
127
|
-
The MD5 Checksum
|
|
128
|
-
"""
|
|
129
|
-
async with md5_semaphore:
|
|
130
|
-
with tracer.start_as_current_span("Utils::md5_for_file_multiprocessing"):
|
|
131
|
-
future = process_pool_executor.submit(
|
|
132
|
-
md5_for_file_hex, filename, block_size
|
|
133
|
-
)
|
|
134
|
-
while not future.done():
|
|
135
|
-
await asyncio.sleep(0)
|
|
136
|
-
result = future.result()
|
|
137
|
-
return result
|
|
138
|
-
|
|
139
|
-
|
|
140
108
|
@tracer.start_as_current_span("Utils::md5_fn")
|
|
141
109
|
def md5_fn(part, _) -> str:
|
|
142
110
|
"""Calculate the MD5 of a file-like object.
|
|
@@ -147,7 +115,7 @@ def md5_fn(part, _) -> str:
|
|
|
147
115
|
Returns:
|
|
148
116
|
The MD5 Checksum
|
|
149
117
|
"""
|
|
150
|
-
md5 = hashlib.new("md5", usedforsecurity=False)
|
|
118
|
+
md5 = hashlib.new("md5", usedforsecurity=False) # nosec
|
|
151
119
|
md5.update(part)
|
|
152
120
|
return md5.hexdigest()
|
|
153
121
|
|
|
@@ -635,15 +635,7 @@ class File(FileSynchronousProtocol, AccessControllable):
|
|
|
635
635
|
"""Load the MD5 of the file if it's a local file and we have not already loaded
|
|
636
636
|
it."""
|
|
637
637
|
if not self.content_md5 and self.path and os.path.isfile(self.path):
|
|
638
|
-
self.content_md5 =
|
|
639
|
-
filename=self.path,
|
|
640
|
-
process_pool_executor=syn._get_process_pool_executor(
|
|
641
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
642
|
-
),
|
|
643
|
-
md5_semaphore=syn._get_md5_semaphore(
|
|
644
|
-
asyncio_event_loop=asyncio.get_running_loop()
|
|
645
|
-
),
|
|
646
|
-
)
|
|
638
|
+
self.content_md5 = utils.md5_for_file_hex(filename=self.path)
|
|
647
639
|
|
|
648
640
|
async def _find_existing_file(
|
|
649
641
|
self, synapse_client: Optional[Synapse] = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: synapseclient
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.1
|
|
4
4
|
Summary: A client for Synapse, a collaborative, open-source research platform that allows teams to share data, track analyses, and collaborate.
|
|
5
5
|
Home-page: https://www.synapse.org
|
|
6
6
|
Author: The Synapse Engineering Team
|
|
@@ -39,7 +39,6 @@ Requires-Dist: nest-asyncio~=1.6.0
|
|
|
39
39
|
Requires-Dist: asyncio-atexit~=1.0.1
|
|
40
40
|
Requires-Dist: httpx~=0.27.0
|
|
41
41
|
Requires-Dist: tqdm<5.0,>=4.66.2
|
|
42
|
-
Requires-Dist: loky~=3.0.0
|
|
43
42
|
Requires-Dist: async-lru~=2.0.4
|
|
44
43
|
Requires-Dist: psutil~=5.9.8
|
|
45
44
|
Provides-Extra: dev
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/constants/config_file_constants.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/credentials/credential_provider.py
RENAMED
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/cumulative_transfer_progress.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/multithread_download/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/core/remote_file_storage_wrappers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/mixins/storable_container.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/activity_protocol.py
RENAMED
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/annotations_protocol.py
RENAMED
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/folder_protocol.py
RENAMED
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/project_protocol.py
RENAMED
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/protocols/table_protocol.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{synapseclient-4.3.0 → synapseclient-4.3.1}/synapseclient/models/services/storable_entity.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|