@@ -74,7 +74,7 @@ def __init__(
74
74
volumes : Optional [list [tuple [str , str , str ]]] = None ,
75
75
network : Optional [Network ] = None ,
76
76
network_aliases : Optional [list [str ]] = None ,
77
- transferrables : Optional [list [Transferable ]] = None ,
77
+ transferables : Optional [list [Transferable ]] = None ,
78
78
** kwargs : Any ,
79
79
) -> None :
80
80
self .env = env or {}
@@ -102,7 +102,7 @@ def __init__(
102
102
self .with_network_aliases (* network_aliases )
103
103
104
104
self ._kwargs = kwargs
105
- self ._transferables : list [Transferable ] = transferrables or []
105
+ self ._transferables : list [Transferable ] = transferables or []
106
106
107
107
def with_env (self , key : str , value : str ) -> Self :
108
108
self .env [key ] = value
@@ -285,15 +285,19 @@ def _configure(self) -> None:
285
285
pass
286
286
287
287
def with_copy_into_container (
288
- self , file_content : bytes | PathLike , destination_in_container : str , mode : int = 0o644
289
- ):
288
+ self , file_content : Union [ bytes , PathLike ] , destination_in_container : str , mode : int = 0o644
289
+ ) -> Self :
290
290
self ._transferables .append (Transferable (file_content , destination_in_container , mode ))
291
291
return self
292
292
293
- def copy_into_container (self , file_content : bytes | PathLike , destination_in_container : str , mode : int = 0o644 ):
293
+ def copy_into_container (
294
+ self , file_content : Union [bytes , PathLike ], destination_in_container : str , mode : int = 0o644
295
+ ) -> None :
294
296
return self ._transfer_into_container (file_content , destination_in_container , mode )
295
297
296
- def _transfer_into_container (self , source : bytes | PathLike , destination_in_container : str , mode : int ):
298
+ def _transfer_into_container (
299
+ self , source : Union [bytes , PathLike ], destination_in_container : str , mode : int
300
+ ) -> None :
297
301
if isinstance (source , bytes ):
298
302
file_content = source
299
303
elif isinstance (source , PathLike ):
@@ -309,10 +313,12 @@ def _transfer_into_container(self, source: bytes | PathLike, destination_in_cont
309
313
tarinfo .mode = mode
310
314
tar .addfile (tarinfo , io .BytesIO (file_content ))
311
315
fileobj .seek (0 )
316
+ assert self ._container is not None
312
317
rv = self ._container .put_archive (path = "/" , data = fileobj .getvalue ())
313
318
assert rv is True
314
319
315
- def copy_from_container (self , source_in_container : str , destination_on_host : PathLike ):
320
+ def copy_from_container (self , source_in_container : str , destination_on_host : PathLike ) -> None :
321
+ assert self ._container is not None
316
322
tar_stream , _ = self ._container .get_archive (source_in_container )
317
323
318
324
for chunk in tar_stream :
0 commit comments