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

5 statements  

« prev     ^ index     » next       coverage.py v7.6.7, created at 2024-11-22 01:18 +0000

1# 

2# Copyright (c) Microsoft Corporation. 

3# Licensed under the MIT License. 

4# 

5"""Protocol interface for file share operations.""" 

6 

7from typing import Protocol, runtime_checkable 

8 

9 

10@runtime_checkable 

11class SupportsFileShareOps(Protocol): 

12 """Protocol interface for file share operations.""" 

13 

14 def download( 

15 self, 

16 params: dict, 

17 remote_path: str, 

18 local_path: str, 

19 recursive: bool = True, 

20 ) -> None: 

21 """ 

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

23 

24 Parameters 

25 ---------- 

26 params : dict 

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

28 remote_path : str 

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

30 or a directory if recursive=True. 

31 local_path : str 

32 Path to store the downloaded content to. 

33 recursive : bool 

34 If False, ignore the subdirectories; 

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

36 """ 

37 

38 def upload( 

39 self, 

40 params: dict, 

41 local_path: str, 

42 remote_path: str, 

43 recursive: bool = True, 

44 ) -> None: 

45 """ 

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

47 

48 Parameters 

49 ---------- 

50 params : dict 

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

52 local_path : str 

53 Path to the local directory to upload contents from. 

54 remote_path : str 

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

56 recursive : bool 

57 If False, ignore the subdirectories; 

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

59 """