Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions libvcs/_internal/query_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
----
This is an internal API not covered by versioning policy.
"""
import operator
import re
import traceback
from typing import Any, Callable, Optional, Protocol, Sequence, TypeVar, Union
Expand Down Expand Up @@ -53,12 +54,19 @@ def parse_lookup(obj, path, lookup):
class LookupProtocol(Protocol):
"""Protocol for :class:`QueryList` filtering operators."""

def __call__(self, data: Union[list[str], str], rhs: Union[list[str], str]):
def __call__(self, data: Any, rhs: Any):
"""Callback for :class:`QueryList` filtering operators."""


def lookup_exact(data, rhs):
return rhs == data
lookup_exact = operator.eq
"""Exact match. Alias of :func:`operator.eq`.

>>> lookup_exact("cat", "cat")
True

>>> lookup_exact("cat", "dog")
False
"""


def lookup_iexact(data, rhs):
Expand Down