Skip to content

Commit

Permalink
rewrite data validation to something mypy approves of
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikt committed May 3, 2021
1 parent 4f4df74 commit 37f31b0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/pyff/builtins.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,14 @@ def load(req: Plumbing.Request, *opts):

def _select_args(req: Plumbing.Request) -> List[str]:
log.debug(f'Select args: {req.args}, state: {req.state}')
args = req.args
args: List[str] = []

if req.args:
for this in req.args:
if not isinstance(this, str):
raise ValueError(f'Selection not possible with arg that is not a string: {this}')
args += [this]

if args is None and req.state.select:
args = [req.state.select]
log.debug(f'Using req.state.select: {args}')
Expand All @@ -702,10 +709,6 @@ def _select_args(req: Plumbing.Request) -> List[str]:

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

for this in args:
if not isinstance(this, str):
raise ValueError(f'Selection resulted in something that is not a string: {this}')

return args


Expand Down

0 comments on commit 37f31b0

Please sign in to comment.