|
13 | 13 | from copy import deepcopy |
14 | 14 | from datetime import datetime |
15 | 15 | from distutils.util import strtobool |
16 | | -from typing import Any, Dict, List, Optional |
| 16 | +from typing import Any, Dict, Iterable, List, Optional |
17 | 17 |
|
18 | 18 | import ipaddr |
19 | 19 | import six |
@@ -274,10 +274,10 @@ def fork(req: Plumbing.Request, *opts): |
274 | 274 |
|
275 | 275 | @deprecated(reason="any pipeline has been replace by other behaviour") |
276 | 276 | @pipe(name='any') |
277 | | -def _any(lst, d): |
| 277 | +def _any(lst: Iterable[Any], d: Any) -> Any: |
278 | 278 | for x in lst: |
279 | 279 | if x in d: |
280 | | - if type(d) == dict: |
| 280 | + if isinstance(d, dict): |
281 | 281 | return d[x] |
282 | 282 | else: |
283 | 283 | return True |
@@ -695,19 +695,25 @@ def _select_args(req: Plumbing.Request) -> List[str]: |
695 | 695 | raise ValueError(f'Selection not possible with arg that is not a string: {this}') |
696 | 696 | args += [this] |
697 | 697 |
|
698 | | - if args is None and req.state.select: |
| 698 | + if not args and req.state.select: |
699 | 699 | args = [req.state.select] |
700 | 700 | log.debug(f'Using req.state.select: {args}') |
701 | | - if args is None: |
| 701 | + if not args: |
702 | 702 | args = req.store.collections() |
703 | 703 | log.debug(f'Using req.store.collections: {args}') |
704 | | - if args is None or not args: |
| 704 | + if not args: |
705 | 705 | args = req.store.lookup('entities') |
706 | | - log.debug(f'Using req.store.entities: {args}') |
707 | | - if args is None or not args: |
| 706 | + if len(args) < 5: |
| 707 | + log.debug(f'Using req.store.entities: {args}') |
| 708 | + else: |
| 709 | + log.debug(f'Using req.store.entities: {args[:4]} (truncated)') |
| 710 | + if not args: |
708 | 711 | args = [] |
709 | 712 |
|
710 | | - log.info(f'selecting using args: {args}') |
| 713 | + if len(args) < 5: |
| 714 | + log.info(f'selecting using args: {args}') |
| 715 | + else: |
| 716 | + log.info(f'selecting using args: {args[:4]} (truncated)') |
711 | 717 |
|
712 | 718 | return args |
713 | 719 |
|
|
0 commit comments