Skip to content

Commit

Permalink
config parsing clean-ups (#1240)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwild authored and douglascamata committed Jul 27, 2016
1 parent f9468ef commit 4d07a18
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions pokecli.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,13 @@ def init_config():
config.password = getpass("Password: ")

# Passed in arguments should trump
for key in config.__dict__:
if key in load and load[key]:
config.__dict__[key] = load[key]
for key, value in load.iteritems():
if key in config and value:
setattr(config, key, value)

if 'catch' in load:
config.catch = load['catch']
else:
config.catch = {}

if 'release' in load:
config.release = load['release']
else:
config.release = {}

if 'item_filter' in load:
config.item_filter = load['item_filter']
else:
config.item_filter = {}
config.catch = load.get('catch', {})
config.release = load.get('release', {})
config.item_filter = load.get('item_filter', {})

if config.auth_service not in ['ptc', 'google']:
logging.error("Invalid Auth service specified! ('ptc' or 'google')")
Expand Down

0 comments on commit 4d07a18

Please sign in to comment.