Add a function to the query path. Similar to __getattr__ but for arbitrary functions.
(self, fn: Callable[[Any], Any])
| 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 | |
| 516 | def where(key: str) -> Query: |
| 517 | """ |
no outgoing calls