Removed the lists in favour of generators

This commit is contained in:
Alen Mujezinovic 2012-02-28 13:33:33 +00:00
parent f73aaa844f
commit b567104267

View File

@ -34,10 +34,10 @@ class KeyValueType(object):
self.separators = separators self.separators = separators
def __call__(self, string): def __call__(self, string):
found = dict([ found = dict(
(string.find(sep), sep) for sep in self.separators (string.find(sep), sep) for sep in self.separators
if string.find(sep) != -1 if string.find(sep) != -1
]) )
if not found: if not found:
raise argparse.ArgumentTypeError( raise argparse.ArgumentTypeError(
@ -149,8 +149,8 @@ def main():
verify=True if args.verify == 'yes' else args.verify, verify=True if args.verify == 'yes' else args.verify,
timeout=args.timeout, timeout=args.timeout,
auth=(args.auth.key, args.auth.value) if args.auth else None, auth=(args.auth.key, args.auth.value) if args.auth else None,
proxies=dict([(p.key, p.value) for p in args.proxy]), proxies=dict((p.key, p.value) for p in args.proxy),
files=dict([(os.path.basename(f.name), f) for f in args.file]), files=dict((os.path.basename(f.name), f) for f in args.file),
) )
except (KeyboardInterrupt, SystemExit) as e: except (KeyboardInterrupt, SystemExit) as e:
sys.stderr.write('\n') sys.stderr.write('\n')