Skip to content

Protocol

provide.foundation.file.operations.detectors.protocol

Protocol definitions for file operation detectors.

Classes

DetectorFunc

Bases: Protocol

Protocol for file operation detector functions.

A detector function analyzes a list of file events and attempts to identify a specific file operation pattern (atomic save, batch update, etc.).

Returns None if the pattern is not detected, or a FileOperation with confidence score if the pattern matches.

Functions
__call__
__call__(events: list[FileEvent]) -> FileOperation | None

Detect file operation pattern from events.

Parameters:

Name Type Description Default
events list[FileEvent]

List of file events to analyze

required

Returns:

Type Description
FileOperation | None

FileOperation if pattern detected, None otherwise

Source code in provide/foundation/file/operations/detectors/protocol.py
def __call__(self, events: list[FileEvent]) -> FileOperation | None:
    """Detect file operation pattern from events.

    Args:
        events: List of file events to analyze

    Returns:
        FileOperation if pattern detected, None otherwise
    """
    ...