Skip to content

Commit 1763776

Browse files
committed
bugfix after change from default None to empty list
1 parent 37f31b0 commit 1763776

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/pyff/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ def process_handler(request: Request) -> Response:
300300
)
301301

302302
r = p.process(request.registry.md, state=state, raise_exceptions=True, scheduler=request.registry.scheduler)
303-
log.debug(f'Plumbing process result: {r}')
304303
if r is None:
305304
r = []
306305

src/pyff/builtins.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from copy import deepcopy
1414
from datetime import datetime
1515
from distutils.util import strtobool
16-
from typing import Any, Dict, List, Optional
16+
from typing import Any, Dict, Iterable, List, Optional
1717

1818
import ipaddr
1919
import six
@@ -274,10 +274,10 @@ def fork(req: Plumbing.Request, *opts):
274274

275275
@deprecated(reason="any pipeline has been replace by other behaviour")
276276
@pipe(name='any')
277-
def _any(lst, d):
277+
def _any(lst: Iterable[Any], d: Any) -> Any:
278278
for x in lst:
279279
if x in d:
280-
if type(d) == dict:
280+
if isinstance(d, dict):
281281
return d[x]
282282
else:
283283
return True
@@ -695,19 +695,25 @@ def _select_args(req: Plumbing.Request) -> List[str]:
695695
raise ValueError(f'Selection not possible with arg that is not a string: {this}')
696696
args += [this]
697697

698-
if args is None and req.state.select:
698+
if not args and req.state.select:
699699
args = [req.state.select]
700700
log.debug(f'Using req.state.select: {args}')
701-
if args is None:
701+
if not args:
702702
args = req.store.collections()
703703
log.debug(f'Using req.store.collections: {args}')
704-
if args is None or not args:
704+
if not args:
705705
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:
708711
args = []
709712

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)')
711717

712718
return args
713719

0 commit comments

Comments
 (0)