Skip to content

Commit 37f31b0

Browse files
committed
rewrite data validation to something mypy approves of
1 parent 4f4df74 commit 37f31b0

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/pyff/builtins.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,14 @@ def load(req: Plumbing.Request, *opts):
687687

688688
def _select_args(req: Plumbing.Request) -> List[str]:
689689
log.debug(f'Select args: {req.args}, state: {req.state}')
690-
args = req.args
690+
args: List[str] = []
691+
692+
if req.args:
693+
for this in req.args:
694+
if not isinstance(this, str):
695+
raise ValueError(f'Selection not possible with arg that is not a string: {this}')
696+
args += [this]
697+
691698
if args is None and req.state.select:
692699
args = [req.state.select]
693700
log.debug(f'Using req.state.select: {args}')
@@ -702,10 +709,6 @@ def _select_args(req: Plumbing.Request) -> List[str]:
702709

703710
log.info(f'selecting using args: {args}')
704711

705-
for this in args:
706-
if not isinstance(this, str):
707-
raise ValueError(f'Selection resulted in something that is not a string: {this}')
708-
709712
return args
710713

711714

0 commit comments

Comments
 (0)