summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsaucypy28
1 files changed, 14 insertions, 14 deletions
diff --git a/saucypy b/saucypy
index 42dd9f2..efe24c7 100755
--- a/saucypy
+++ b/saucypy
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
import difflib
import json
@@ -28,7 +28,7 @@ def main():
options, args = parse_args()
if options.version:
- print VERSION
+ print (VERSION)
sys.exit( 0 )
try:
@@ -41,36 +41,36 @@ def main():
entries[key] = value
matches = find( key, entries )
if len( matches ) > 1:
- exact_match = filter( lambda x: x == key, matches )
+ exact_match = list(filter( lambda x: x == key, matches))
if exact_match:
- print "There is already an item named " + key
+ print ("There is already an item named " + key)
else:
json.dump( entries, open( ENTRIES_FILE, "w" ), indent = 4, sort_keys = True )
- print key + ": " + value + " added"
+ print (key + ": " + value + " added")
elif options.count:
- print "Entries: {0}".format( len( entries.keys() ) )
+ print ("Entries: {0}".format( len( entries.keys() ) ))
else:
if not args:
- print "Expected a search argument, got nothing."
+ print ("Expected a search argument, got nothing.")
sys.exit( 1 )
matches = find( args[0], entries )
if len( matches ) > 1:
- exact_match = filter( lambda x: x == args[0], matches )
+ exact_match = list(filter( lambda x: x == args[0], matches))
if exact_match:
- print entries[exact_match[0]].encode("utf-8")
+ print (entries[exact_match[0]].encode("utf-8"))
elif options.index is not None:
try:
- print entries[matches[options.index]].encode("utf-8")
+ print (entries[matches[options.index]].encode("utf-8"))
except IndexError:
- print "Match index out of range."
+ print ("Match index out of range.")
sys.exit( 1 )
else:
- print "Matches (use -i option to pick one) -> {0}".format( ", ".join( "{0}: {1}".format( i, m ) for i, m in enumerate( matches ) ) )
+ print ("Matches (use -i option to pick one) -> {0}".format( ", ".join( "{0}: {1}".format( i, m ) for i, m in enumerate( matches ) ) ))
elif matches:
- print entries[matches[0]]
+ print (entries[matches[0]])
else:
- print "No match found."
+ print ("No match found.")
if __name__ == "__main__":
main()