Anton Shestakov <av6@dwimlabs.net>, Sat, 16 Jul 2016 15:12:21 +0800
rollbot: inline "if hasattr(args, 'config')" block
Helps with keeping arguments and their defaults closer to each other.
--- a/rollbot.py Wed Jul 06 17:23:23 2016 +0800
+++ b/rollbot.py Sat Jul 16 15:12:21 2016 +0800
logging.basicConfig(level=args.loglevel, format='%(asctime)s %(levelname)-8s %(message)s')
- if hasattr(args, 'config'):
- config = yaml.safe_load(args.config)
+ config = yaml.safe_load(args.config) if hasattr(args, 'config') else {}
jid = lookup('jid', args, config)
password = lookup('password', args, config)