Coverage for mlos_bench/mlos_bench/services/types/fileshare_type.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-06 00:35 +0000

1# 

2# Copyright (c) Microsoft Corporation. 

3# Licensed under the MIT License. 

4# 

5""" 

6Protocol interface for file share operations. 

7""" 

8 

9from typing import Protocol, runtime_checkable 

10 

11 

12@runtime_checkable 

13class SupportsFileShareOps(Protocol): 

14 """ 

15 Protocol interface for file share operations. 

16 """ 

17 

18 def download(self, params: dict, remote_path: str, local_path: str, recursive: bool = True) -> None: 

19 """ 

20 Downloads contents from a remote share path to a local path. 

21 

22 Parameters 

23 ---------- 

24 params : dict 

25 Flat dictionary of (key, value) pairs of (optional) connection details. 

26 remote_path : str 

27 Path to download from the remote file share, a file if recursive=False 

28 or a directory if recursive=True. 

29 local_path : str 

30 Path to store the downloaded content to. 

31 recursive : bool 

32 If False, ignore the subdirectories; 

33 if True (the default), download the entire directory tree. 

34 """ 

35 

36 def upload(self, params: dict, local_path: str, remote_path: str, recursive: bool = True) -> None: 

37 """ 

38 Uploads contents from a local path to remote share path. 

39 

40 Parameters 

41 ---------- 

42 params : dict 

43 Flat dictionary of (key, value) pairs of (optional) connection details. 

44 local_path : str 

45 Path to the local directory to upload contents from. 

46 remote_path : str 

47 Path in the remote file share to store the uploaded content to. 

48 recursive : bool 

49 If False, ignore the subdirectories; 

50 if True (the default), upload the entire directory tree. 

51 """