Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

function libtmux latest

parse_lookup

Check if field lookup key, e.g. "my__path__contains" has comparator, return val.

Source and package
Qualified name
libtmux._internal.query_list.parse_lookup
Module
libtmux._internal.query_list
Package
libtmux
Source
src/libtmux/_internal/query_list.py
parse_lookup ( obj: Mapping[str, t.Any], path: str, lookup: str ) → t.Any | None

Description#

If comparator not used or value not found, return None.

>>> parse_lookup({ "food": "red apple" }, "food__istartswith", "__istartswith")
'red apple'

It can also look up objects:

>>> from dataclasses import dataclass
>>> @dataclass()
... class Inventory:
... food: str
>>> item = Inventory(food="red apple")
>>> item
Inventory(food='red apple')
>>> parse_lookup(item, "food__istartswith", "__istartswith")
'red apple'
Parameters
Esc

Type to search.

Reference previewOpen reference