Skip to content

Commit

Permalink
Merge pull request #511 from tcmitchell/pep8
Browse files Browse the repository at this point in the history
Fix PEP 8 warnings and errors
  • Loading branch information
tcmitchell committed Jun 7, 2016
2 parents 02ec974 + da50902 commit 2e3fbab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tools/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def parseOptions(args):
parser.add_option("--credentials",
help="List of comma-separated credential files",
default="")
parser.add_option("--raw_output", action="store_true",
parser.add_option("--raw_output", action="store_true",
dest="raw_output", default=False)

[opts, args] = parser.parse_args(args)
Expand Down Expand Up @@ -394,7 +394,7 @@ def main(args=sys.argv, do_print=True):
# Lookup login info (authorities only)
elif opts.method in ['lookup_login_info']:
(result, msg) = \
_do_ssl(framework, suppress_errors, reason, fcn,
_do_ssl(framework, suppress_errors, reason, fcn,
opts.credentials, client_options)

# Portal query
Expand Down
11 changes: 7 additions & 4 deletions tools/json_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,29 @@
#
# Usage: json_extractor.py keys filename
# where
# keys is a comma-separated list of
# keys is a comma-separated list of
# dictionary keys (Lookup the value for key f and continue)
# key=value pairs (for finding a dictionary in a list of dictionaries)
#
# Thus for JSON containing:
#
# {"a": [{"name": "foo", "value": "bar"}, {"name": "boo", "value": "baz"}], "b" : "3"}
# {"a": [{"name": "foo", "value": "bar"},
# {"name": "boo", "value": "baz"}],
# "b" : "3"}
#
# json_extractor.py a,name=foo,value => bar
# json_extractor.py b => 3

import json
import sys


def main():
if len(sys.argv) <= 2:
print "Usage: json_extractor.py keys filename"
sys.exit(1)

keys = sys.argv[1] # Comma separated
keys = sys.argv[1] # Comma separated
filename = sys.argv[2]

data = open(filename).read()
Expand Down Expand Up @@ -74,7 +77,7 @@ def main():
(key_name, key_value, result, jdata)
sys.exit(1)
result = found

print result
return 0

Expand Down

0 comments on commit 2e3fbab

Please sign in to comment.