Skip to content

Commit 66318cc

Browse files
committed
Remove outdated filetransfer deprecations
1 parent 88dcfc8 commit 66318cc

2 files changed

Lines changed: 20 additions & 91 deletions

File tree

yamcs-client/src/yamcs/filetransfer/client.py

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,9 @@ def upload(
172172
bucket_name: str,
173173
object_name: str,
174174
remote_path: str,
175-
source_entity: str,
176-
destination_entity: str,
177-
overwrite: bool,
178-
parents: bool,
179-
reliable: bool,
180-
options: Mapping[str, Any],
175+
source_entity: Optional[str],
176+
destination_entity: Optional[str],
177+
options: Optional[Mapping[str, Any]],
181178
) -> Transfer:
182179
req = filetransfer_pb2.CreateTransferRequest()
183180
req.direction = filetransfer_pb2.TransferDirection.UPLOAD
@@ -188,14 +185,6 @@ def upload(
188185
req.source = source_entity
189186
if destination_entity:
190187
req.destination = destination_entity
191-
192-
# Old options for backwards compatibility
193-
old_options = {
194-
"overwrite": overwrite,
195-
"createPath": parents,
196-
"reliable": reliable,
197-
}
198-
req.options.update(old_options)
199188
if options:
200189
req.options.update(options)
201190

@@ -209,13 +198,10 @@ def download(
209198
self,
210199
bucket_name: str,
211200
remote_path: str,
212-
object_name: str,
213-
source_entity: str,
214-
destination_entity: str,
215-
overwrite: bool,
216-
parents: bool,
217-
reliable: bool,
218-
options: Mapping[str, Any],
201+
object_name: Optional[str],
202+
source_entity: Optional[str],
203+
destination_entity: Optional[str],
204+
options: Optional[Mapping[str, Any]],
219205
) -> Transfer:
220206
req = filetransfer_pb2.CreateTransferRequest()
221207
req.direction = filetransfer_pb2.TransferDirection.DOWNLOAD
@@ -227,14 +213,6 @@ def download(
227213
req.source = source_entity
228214
if destination_entity:
229215
req.destination = destination_entity
230-
231-
# Old options for backwards compatibility
232-
old_options = {
233-
"overwrite": overwrite,
234-
"createPath": parents,
235-
"reliable": reliable,
236-
}
237-
req.options.update(old_options)
238216
if options:
239217
req.options.update(options)
240218

@@ -247,9 +225,9 @@ def download(
247225
def fetch_filelist(
248226
self,
249227
remote_path: str,
250-
source_entity: str,
251-
destination_entity: str,
252-
options: Mapping[str, Any],
228+
source_entity: Optional[str],
229+
destination_entity: Optional[str],
230+
options: Optional[Mapping[str, Any]],
253231
):
254232
req = filetransfer_pb2.ListFilesRequest()
255233
req.remotePath = remote_path
@@ -265,9 +243,9 @@ def fetch_filelist(
265243
def get_filelist(
266244
self,
267245
remote_path: str,
268-
source_entity: str,
269-
destination_entity: str,
270-
options: Mapping[str, Any],
246+
source_entity: Optional[str],
247+
destination_entity: Optional[str],
248+
options: Optional[Mapping[str, Any]],
271249
) -> RemoteFileListing:
272250
params = {"remotePath": remote_path}
273251
if source_entity:

yamcs-client/src/yamcs/filetransfer/model.py

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import datetime
22
import threading
3-
from typing import Any, Callable, List, Mapping, Optional
3+
from typing import TYPE_CHECKING, Any, Callable, List, Mapping, Optional
44

55
from yamcs.core.helpers import parse_server_time
66
from yamcs.protobuf.filetransfer import filetransfer_pb2
77

8+
if TYPE_CHECKING:
9+
from yamcs.filetransfer.client import ServiceClient
10+
811

912
class 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

Comments
 (0)