From 2b9e343fc593edb760affcc754b0131c704e9fb2 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Wed, 1 Jun 2022 17:45:03 -0500 Subject: [PATCH 1/2] tests(lookup_exact): Use operator, add doctest --- libvcs/_internal/query_list.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libvcs/_internal/query_list.py b/libvcs/_internal/query_list.py index d3975cba5..834c5aae6 100644 --- a/libvcs/_internal/query_list.py +++ b/libvcs/_internal/query_list.py @@ -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 @@ -57,8 +58,15 @@ def __call__(self, data: Union[list[str], str], rhs: Union[list[str], str]): """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): From e0ffa685427215cee5a55776e962795e43217853 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 4 Jun 2022 14:24:54 -0500 Subject: [PATCH 2/2] !squash wip --- libvcs/_internal/query_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libvcs/_internal/query_list.py b/libvcs/_internal/query_list.py index 834c5aae6..7a3b79eca 100644 --- a/libvcs/_internal/query_list.py +++ b/libvcs/_internal/query_list.py @@ -54,7 +54,7 @@ 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.""" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy