Skip to content

Commit

Permalink
Merge pull request schodet#142 from dlech/config-parsing
Browse files Browse the repository at this point in the history
Rewritten to remove eval()
  • Loading branch information
GoldSloth authored Apr 28, 2018
2 parents c53df54 + cad30b1 commit 4e92a66
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nxt/locator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ def find_one_brick(host=None, name=None, silent=False, strict=None, debug=False,
host = conf.get('Brick', 'host')
name = conf.get('Brick', 'name')
strict = bool(int(conf.get('Brick', 'strict')))
method = eval('Method(%s)' % conf.get('Brick', 'method'))
methods = map(lambda x: x.strip().split('='),
conf.get('Brick', 'method').split(','))
method = Method(**{k: v == 'True' for k, v in methods
if k in ('bluetooth', 'usb', 'device')})
if not strict: strict = True
if not method: method = Method()

Expand Down

0 comments on commit 4e92a66

Please sign in to comment.