Skip to content

Commit 47f38e0

Browse files
committed
define optional params
1 parent 99cbb81 commit 47f38e0

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

synapseclient/core/download/download_functions.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -571,9 +571,9 @@ def download_fn(
571571

572572
async def download_from_url_multi_threaded(
573573
file_handle_id: Optional[str],
574-
object_id: Optional[str],
575-
object_type: Optional[str],
576574
destination: str,
575+
object_id: Optional[str] = None,
576+
object_type: Optional[str] = None,
577577
*,
578578
expected_md5: str = None,
579579
synapse_client: Optional["Synapse"] = None,
@@ -584,12 +584,12 @@ async def download_from_url_multi_threaded(
584584
585585
Arguments:
586586
file_handle_id: The id of the FileHandle to download
587-
object_id: The id of the Synapse object that uses the FileHandle
587+
destination: The destination on local file system
588+
object_id: Optional. The id of the Synapse object that uses the FileHandle
588589
e.g. "syn123"
589-
object_type: The type of the Synapse object that uses the
590+
object_type: Optional. The type of the Synapse object that uses the
590591
FileHandle e.g. "FileEntity". Any of
591592
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/FileHandleAssociateType.html>
592-
destination: The destination on local file system
593593
expected_md5: The expected MD5
594594
content_size: The size of the content
595595
synapse_client: If not passed in and caching was not disabled by
@@ -647,8 +647,8 @@ async def download_from_url_multi_threaded(
647647
def download_from_url(
648648
url: str,
649649
destination: str,
650-
entity_id: Optional[str],
651-
file_handle_associate_type: Optional[str],
650+
entity_id: Optional[str] = None,
651+
file_handle_associate_type: Optional[str] = None,
652652
file_handle_id: Optional[str] = None,
653653
expected_md5: Optional[str] = None,
654654
progress_bar: Optional[tqdm] = None,
@@ -662,9 +662,9 @@ def download_from_url(
662662
Arguments:
663663
url: The source of download
664664
destination: The destination on local file system
665-
entity_id: The id of the Synapse object that uses the FileHandle
665+
entity_id: Optional. The id of the Synapse object that uses the FileHandle
666666
e.g. "syn123"
667-
file_handle_associate_type: The type of the Synapse object that uses the
667+
file_handle_associate_type: Optional. The type of the Synapse object that uses the
668668
FileHandle e.g. "FileEntity". Any of
669669
<https://rest-docs.synapse.org/rest/org/sagebionetworks/repo/model/file/FileHandleAssociateType.html>
670670
file_handle_id: Optional. If given, the file will be given a temporary name that includes the file
@@ -694,7 +694,10 @@ def download_from_url(
694694
actual_md5 = None
695695
redirect_count = 0
696696
delete_on_md5_mismatch = True
697-
client.logger.debug(f"[{entity_id}]: Downloading from {url} to {destination}")
697+
if entity_id is not None:
698+
client.logger.debug(f"[{entity_id}]: Downloading from {url} to {destination}")
699+
else:
700+
client.logger.debug(f"Downloading from {url} to {destination}")
698701
while redirect_count < REDIRECT_LIMIT:
699702
redirect_count += 1
700703
scheme = urllib_urlparse.urlparse(url).scheme

0 commit comments

Comments
 (0)