File Manager

Bases: ABC

Abstract Interface for file management operations.

This class provides a structured interface for handling files, including methods for reading, writing, and deleting files. Implementations should provide specific mechanisms for these operations.

Source code in numerous/files/file_manager.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
class FileManager(ABC):

    """
    Abstract Interface for file management operations.

    This class provides a structured interface for handling files, including
    methods for reading, writing, and deleting files. Implementations should
    provide specific mechanisms for these operations.
    """

    @abstractmethod
    def put(self, src: StrOrPath, dst: str ) -> None:
        """
        Upload a file to a path.

        Args:
            src: Source file path.
            dst: Destination file path.

        """
        ...

    @abstractmethod
    def remove(self, path: str) -> None:
        """
        Remove a file at a path.

        Args:
            path: File path to remove.

        """
        ...

    @abstractmethod
    def list(self, path: str | None) -> List[str]:
        """
        List files at a path.

        Args:
            path: Path to list files from.

        """
        ...

    @abstractmethod
    def move(self, src: str, dst: str) -> None:
        """
        Move a file from a source to a destination.

        Args:
            src: Source file path.
            dst: Destination file path.

        """
        ...

    @abstractmethod
    def copy(self, src: str, dst: str) -> None:
        """
        Copy a file from a source to a destination.

        Args:
            src: Source file path.
            dst: Destination file path.

        """
        ...

    @abstractmethod
    def get(self, src: str, dst: Path|str) -> None:
        """
        Download a file from a source to a destination.

        Args:
            src: Source file path.
            dst: Destination file path.

        """
        ...

copy(src, dst) abstractmethod

Copy a file from a source to a destination.

Parameters:
  • src (str) –

    Source file path.

  • dst (str) –

    Destination file path.

Source code in numerous/files/file_manager.py
64
65
66
67
68
69
70
71
72
73
74
@abstractmethod
def copy(self, src: str, dst: str) -> None:
    """
    Copy a file from a source to a destination.

    Args:
        src: Source file path.
        dst: Destination file path.

    """
    ...

get(src, dst) abstractmethod

Download a file from a source to a destination.

Parameters:
  • src (str) –

    Source file path.

  • dst (Path | str) –

    Destination file path.

Source code in numerous/files/file_manager.py
76
77
78
79
80
81
82
83
84
85
86
@abstractmethod
def get(self, src: str, dst: Path|str) -> None:
    """
    Download a file from a source to a destination.

    Args:
        src: Source file path.
        dst: Destination file path.

    """
    ...

list(path) abstractmethod

List files at a path.

Parameters:
  • path (str | None) –

    Path to list files from.

Source code in numerous/files/file_manager.py
41
42
43
44
45
46
47
48
49
50
@abstractmethod
def list(self, path: str | None) -> List[str]:
    """
    List files at a path.

    Args:
        path: Path to list files from.

    """
    ...

move(src, dst) abstractmethod

Move a file from a source to a destination.

Parameters:
  • src (str) –

    Source file path.

  • dst (str) –

    Destination file path.

Source code in numerous/files/file_manager.py
52
53
54
55
56
57
58
59
60
61
62
@abstractmethod
def move(self, src: str, dst: str) -> None:
    """
    Move a file from a source to a destination.

    Args:
        src: Source file path.
        dst: Destination file path.

    """
    ...

put(src, dst) abstractmethod

Upload a file to a path.

Parameters:
  • src (StrOrPath) –

    Source file path.

  • dst (str) –

    Destination file path.

Source code in numerous/files/file_manager.py
18
19
20
21
22
23
24
25
26
27
28
@abstractmethod
def put(self, src: StrOrPath, dst: str ) -> None:
    """
    Upload a file to a path.

    Args:
        src: Source file path.
        dst: Destination file path.

    """
    ...

remove(path) abstractmethod

Remove a file at a path.

Parameters:
  • path (str) –

    File path to remove.

Source code in numerous/files/file_manager.py
30
31
32
33
34
35
36
37
38
39
@abstractmethod
def remove(self, path: str) -> None:
    """
    Remove a file at a path.

    Args:
        path: File path to remove.

    """
    ...