11import datetime
22import threading
3- from typing import Any , Callable , List , Mapping , Optional
3+ from typing import TYPE_CHECKING , Any , Callable , List , Mapping , Optional
44
55from yamcs .core .helpers import parse_server_time
66from yamcs .protobuf .filetransfer import filetransfer_pb2
77
8+ if TYPE_CHECKING :
9+ from yamcs .filetransfer .client import ServiceClient
10+
811
912class Service :
10- def __init__ (self , proto , service_client ):
13+ def __init__ (self , proto , service_client : "ServiceClient" ):
1114 self ._proto = proto
1215 self ._service_client = service_client
1316 self ._local_entities = [EntityInfo (entity ) for entity in proto .localEntities ]
@@ -54,18 +57,11 @@ def upload(
5457 remote_path : str ,
5558 source_entity : Optional [str ] = None ,
5659 destination_entity : Optional [str ] = None ,
57- overwrite : bool = True ,
58- parents : bool = True ,
59- reliable : bool = False ,
6060 options : Optional [Mapping [str , Any ]] = None ,
6161 ) -> "Transfer" :
6262 """
6363 Uploads a file located in a bucket to a remote destination path.
6464
65- .. warning::
66- Prefer the use of ``options`` instead of the deprecated params
67- ``overwrite``, ``parents`` and ``reliable``.
68-
6965 :param bucket_name:
7066 Name of the bucket containing the source object.
7167 :param object_name:
@@ -76,34 +72,15 @@ def upload(
7672 Use a specific source entity. (useful in case of multiples)
7773 :param destination_entity:
7874 Use a specific destination entity. (useful in case of multiples)
79- :param overwrite:
80- Replace file if it already exists.
81-
82- .. deprecated:: 1.8.6
83- Use ``options`` instead (option name: ``overwrite``)
84- :param parents:
85- Create the remote path if it does not yet exist.
86-
87- .. deprecated:: 1.8.6
88- Use ``options`` instead (option name: ``createPath``)
89- :param reliable:
90- Enable reliable transfers.
91-
92- .. deprecated:: 1.8.6
93- Use ``options`` instead (option name: ``reliable``)
9475 :param options:
95- file transfer options dict (may overwrite "overwrite", "parents"
96- or "reliable" parameters if set in these options).
76+ file transfer options
9777 """
9878 return self ._service_client .upload (
9979 bucket_name = bucket_name ,
10080 object_name = object_name ,
10181 remote_path = remote_path ,
10282 source_entity = source_entity ,
10383 destination_entity = destination_entity ,
104- overwrite = overwrite ,
105- parents = parents ,
106- reliable = reliable ,
10784 options = options ,
10885 )
10986
@@ -114,18 +91,11 @@ def download(
11491 object_name : Optional [str ] = None ,
11592 source_entity : Optional [str ] = None ,
11693 destination_entity : Optional [str ] = None ,
117- overwrite : bool = True ,
118- parents : bool = True ,
119- reliable : bool = False ,
12094 options : Optional [Mapping [str , Any ]] = None ,
12195 ) -> "Transfer" :
12296 """
12397 Downloads a file from the source to a bucket.
12498
125- .. warning::
126- Prefer the use of ``options`` instead of the deprecated
127- params ``overwrite``, ``parents`` and ``reliable``.
128-
12999 :param bucket_name:
130100 Name of the bucket to receive the file.
131101 :param object_name:
@@ -136,34 +106,15 @@ def download(
136106 Use a specific source entity. (useful in case of multiples)
137107 :param destination_entity:
138108 Use a specific destination entity. (useful in case of multiples)
139- :param overwrite:
140- Replace file if it already exists.
141-
142- .. deprecated:: 1.8.6
143- Use ``options`` instead (option name: ``overwrite``)
144- :param parents:
145- Create the remote path if it does not yet exist.
146-
147- .. deprecated:: 1.8.6
148- Use ``options`` instead (option name: ``createPath``)
149- :param reliable:
150- Enable reliable transfers.
151-
152- .. deprecated:: 1.8.6
153- Use ``options`` instead (option name: ``reliable``)
154109 :param options:
155- File transfer options dict (may overwrite ``overwrite``, ``parents``
156- or ``reliable`` parameters if set in these options).
110+ File transfer options.
157111 """
158112 return self ._service_client .download (
159113 bucket_name = bucket_name ,
160114 remote_path = remote_path ,
161115 object_name = object_name ,
162116 source_entity = source_entity ,
163117 destination_entity = destination_entity ,
164- overwrite = overwrite ,
165- parents = parents ,
166- reliable = reliable ,
167118 options = options ,
168119 )
169120
0 commit comments