Skip to content

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

Bases: ABC

Base file filter interface.

Filters used by several onETL components, including :ref:file-downloader and :ref:file-mover, to determine if a file should be handled or not.

All filters are stateless.

.. versionadded:: 0.8.0

Source code in onetl/base/base_file_filter.py
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 :ref:`file-downloader` and :ref:`file-mover`,
    to determine if a file should be handled or not.

    All filters are stateless.

    .. versionadded:: 0.8.0
    """

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

        .. versionadded:: 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
        """

match(path) abstractmethod

Returns True if path is matching the filter, False otherwise

.. versionadded:: 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
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

    .. versionadded:: 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
    """