Skip to content

Базовый интерфейс

Bases: ABC

Base file filter interface.

Filters used by several onETL components, including onetl.file.file_downloader.file_downloader.FileDownloader and onetl.file.file_mover.file_mover.FileMover, to determine if a file should be handled or not.

All filters are stateless.

Added in 0.8.0

Source code in onetl/base/base_file_filter.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
class BaseFileFilter(ABC):
    """
    Base file filter interface.

    Filters used by several onETL components, including [onetl.file.file_downloader.file_downloader.FileDownloader][] and [onetl.file.file_mover.file_mover.FileMover][],
    to determine if a file should be handled or not.

    All filters are stateless.

    !!! success "Added in 0.8.0"
    """

    @abstractmethod
    def match(self, path: PathProtocol) -> bool:
        """
        Returns `True` if path is matching the filter, `False` otherwise

        !!! success "Added in 0.8.0"

        Examples
        --------

        ```python
        >>> from onetl.impl import LocalPath
        >>> filter.match(LocalPath("/path/to/file.csv"))
        True
        >>> filter.match(LocalPath("/path/to/excluded.csv"))
        False
        >>> filter.match(LocalPath("/path/to/file.csv"))
        True
        ```
        """

match(path) abstractmethod

Returns True if path is matching the filter, False otherwise

Added in 0.8.0

Examples

>>> from onetl.impl import LocalPath
>>> filter.match(LocalPath("/path/to/file.csv"))
True
>>> filter.match(LocalPath("/path/to/excluded.csv"))
False
>>> filter.match(LocalPath("/path/to/file.csv"))
True
Source code in onetl/base/base_file_filter.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@abstractmethod
def match(self, path: PathProtocol) -> bool:
    """
    Returns `True` if path is matching the filter, `False` otherwise

    !!! success "Added in 0.8.0"

    Examples
    --------

    ```python
    >>> from onetl.impl import LocalPath
    >>> filter.match(LocalPath("/path/to/file.csv"))
    True
    >>> filter.match(LocalPath("/path/to/excluded.csv"))
    False
    >>> filter.match(LocalPath("/path/to/file.csv"))
    True
    ```
    """