From 3afb393e16accf0fb2277b8b1b2a5a564ab470da Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sun, 8 Nov 2020 12:03:12 +0000 Subject: Upgrade print statements to python v3 syntax --- wikiquery | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/wikiquery b/wikiquery index 565752a..f0dcc3a 100755 --- a/wikiquery +++ b/wikiquery @@ -20,7 +20,7 @@ def stringify(o): return o.encode("utf-8", "replace") def display(o): - print stringify(o) + print (stringify(o)) def search(topic, index): results = wikipedia.search(topic) @@ -31,7 +31,7 @@ def search(topic, index): try: display(wikipedia.summary(results[index])) except IndexError: - print "index out of range, options are: [%s]" % stringify(results) + print ("index out of range, options are: [%s]" % stringify(results)) else: display(results) @@ -43,7 +43,7 @@ def url(topic, index): try: display(wikipedia.page(e.options[index]).url) except IndexError: - print "index out of range, options are: [%s]" % stringify(e.options) + print ("index out of range, options are: [%s]" % stringify(e.options)) else: display(e.options) else: @@ -57,12 +57,12 @@ def summary(topic, index): try: display(wikipedia.summary(e.options[index])) except IndexError: - print "index out of range, options are: [%s]" % stringify(e.options) + print ("index out of range, options are: [%s]" % stringify(e.options)) else: display(e.options) except wikipedia.exceptions.PageError as e: - print "No wikipedia results found for %s" %topic - + print ("No wikipedia results found for %s" %topic) + def parse_args(): args = sys.argv[1:] @@ -81,20 +81,20 @@ def main(): options, args = parse_args() if options.version: - print version + print (version) sys.exit(0) - + if args: topic = args.pop(0) while len(args) > 0 and not(isinstance(args[0], (int,long))): topic += " " + args.pop(0) - + index = int(args.pop(0)) if args else None if options.search: search(topic, index) elif options.url: - url(topic, index) + url(topic, index) else: summary(topic, index) -- cgit v1.2.3 From 0906971b898b28fa33a0f4168e5fc95944594ec8 Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sun, 8 Nov 2020 12:08:37 +0000 Subject: Upgrade python constraint --- wikiquery | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wikiquery b/wikiquery index f0dcc3a..84e7969 100755 --- a/wikiquery +++ b/wikiquery @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python import shlex import optparse -- cgit v1.2.3 From e65bc91a8d392637cf23a43ff7b2d12f96b4c92a Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sun, 8 Nov 2020 12:12:47 +0000 Subject: Switch to tabs not spaces --- wikiquery | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wikiquery b/wikiquery index 84e7969..8a91f65 100755 --- a/wikiquery +++ b/wikiquery @@ -60,8 +60,8 @@ def summary(topic, index): print ("index out of range, options are: [%s]" % stringify(e.options)) else: display(e.options) - except wikipedia.exceptions.PageError as e: - print ("No wikipedia results found for %s" %topic) + except wikipedia.exceptions.PageError as e: + print ("No wikipedia results found for %s" %topic) def parse_args(): args = sys.argv[1:] -- cgit v1.2.3 From 19ad795fdc6cf2d24e2a40f8d5ee0b3f406e4acd Mon Sep 17 00:00:00 2001 From: Fbenas Date: Sun, 8 Nov 2020 12:15:12 +0000 Subject: Fix indentation issue --- wikiquery | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wikiquery b/wikiquery index 8a91f65..ecfd0aa 100755 --- a/wikiquery +++ b/wikiquery @@ -60,8 +60,8 @@ def summary(topic, index): print ("index out of range, options are: [%s]" % stringify(e.options)) else: display(e.options) - except wikipedia.exceptions.PageError as e: - print ("No wikipedia results found for %s" %topic) + except wikipedia.exceptions.PageError as e: + print ("No wikipedia results found for %s" %topic) def parse_args(): args = sys.argv[1:] -- cgit v1.2.3