MCPcopy
hub / github.com/msiemens/tinydb / map

Method map

tinydb/queries.py:500–514  ·  view source on GitHub ↗

Add a function to the query path. Similar to __getattr__ but for arbitrary functions.

(self, fn: Callable[[Any], Any])

Source from the content-addressed store, hash-verified

498 )
499
500 def map(self, fn: Callable[[Any], Any]) -> 'Query':
501 """
502 Add a function to the query path. Similar to __getattr__ but for
503 arbitrary functions.
504 """
505 query = type(self)()
506
507 # Now we add the callable to the query path ...
508 query._path = self._path + (fn,)
509
510 # ... and kill the hash - callable objects can be mutable, so it's
511 # harmful to cache their results.
512 query._hash = None
513
514 return query
515
516def where(key: str) -> Query:
517 """

Calls

no outgoing calls