Upgrade to Python 3

This commit is contained in:
Nemo 2017-12-24 16:43:07 +05:30
parent 297ef91497
commit 678b0090c4
5 changed files with 13 additions and 13 deletions

View File

@ -16,20 +16,20 @@ if(os.environ.get('TRAVIS')!='true'):
try: try:
import appindicator import appindicator
except ImportError: except ImportError:
import appindicator_replacement as appindicator from . import appindicator_replacement as appindicator
from appindicator_replacement import get_icon_filename from .appindicator_replacement import get_icon_filename
import json import json
import argparse import argparse
from os.path import expanduser from os.path import expanduser
import signal import signal
from hackernews import HackerNews from .hackernews import HackerNews
from chrome import Chrome from .chrome import Chrome
from firefox import Firefox from .firefox import Firefox
from version import Version from .version import Version
from analytics import Analytics from .analytics import Analytics
class HackerNewsApp: class HackerNewsApp:
HN_URL_PREFIX = "https://news.ycombinator.com/item?id=" HN_URL_PREFIX = "https://news.ycombinator.com/item?id="
@ -211,7 +211,7 @@ class HackerNewsApp:
self.addItem(item) self.addItem(item)
# Catch network errors # Catch network errors
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
print "[+] There was an error in fetching news items" print("[+] There was an error in fetching news items")
finally: finally:
# Call every 10 minutes # Call every 10 minutes
if not no_timer: if not no_timer:

View File

@ -8,7 +8,7 @@ class Analytics:
self.dnt = dnt self.dnt = dnt
self.tracker = Mixpanel(token) self.tracker = Mixpanel(token)
if(self.dnt == True): if(self.dnt == True):
print "[+] Analytics disabled" print("[+] Analytics disabled")
# Track an event # Track an event
# event - string containing the event name # event - string containing the event name
# data - data related to the event, defaults to {} # data - data related to the event, defaults to {}

View File

@ -1,4 +1,4 @@
from __future__ import print_function
import sqlite3 import sqlite3
import shutil import shutil
import os import os

View File

@ -1,4 +1,4 @@
from __future__ import print_function
import sqlite3 import sqlite3
import shutil import shutil
import os import os

View File

@ -18,10 +18,10 @@ class Version:
current = Version.current() current = Version.current()
try: try:
if pkg_resources.parse_version(latest) > pkg_resources.parse_version(current): if pkg_resources.parse_version(latest) > pkg_resources.parse_version(current):
print "[+] New version " + latest + " is available" print("[+] New version " + latest + " is available")
return True return True
else: else:
return False return False
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
print "[+] There was an error in trying to fetch updates" print("[+] There was an error in trying to fetch updates")
return False return False