Skip to content

Commit 44e5b83

Browse files
committed
Drop python 2.x support
1 parent 6bd11f4 commit 44e5b83

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

brainworkshop.py

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# This Python file uses the following encoding: utf-8
32
#------------------------------------------------------------------------------
43
# Brain Workshop: a Dual N-Back game in Python
54
#
@@ -52,24 +51,16 @@ def get_argv(arg):
5251
exit(1)
5352

5453
import random, os, sys, socket, webbrowser, time, math, traceback, datetime, errno
55-
if sys.version_info >= (3,0):
56-
import urllib.request, configparser as ConfigParser
57-
from io import StringIO
58-
import pickle
59-
else:
60-
import urllib2 as urllib, ConfigParser, StringIO
61-
import cPickle as pickle
62-
54+
import urllib.request, configparser as ConfigParser
55+
from io import StringIO
56+
import pickle
6357
from decimal import Decimal
6458
from time import strftime
6559
from datetime import date
6660
import gettext
6761

68-
if sys.version_info >= (3,0):
69-
# TODO check if this is right
70-
gettext.install('messages', localedir='res/i18n')
71-
else:
72-
gettext.install('messages', localedir='res/i18n', unicode=True)
62+
# TODO check if this is right
63+
gettext.install('messages', localedir='res/i18n')
7364

7465
# Clinical mode? Clinical mode sets cfg.JAEGGI_MODE = True, enforces a minimal user
7566
# interface, and saves results into a binary file (default 'logfile.dat') which
@@ -759,10 +750,7 @@ def parse_config(configpath):
759750
os.path.join(get_data_dir(), configpath))
760751

761752
defaultconfig = ConfigParser.ConfigParser()
762-
if sys.version_info >= (3,):
763-
defaultconfig.read_file(StringIO(CONFIGFILE_DEFAULT_CONTENTS))
764-
else:
765-
defaultconfig.readfp(StringIO.StringIO(CONFIGFILE_DEFAULT_CONTENTS))
753+
defaultconfig.read_file(StringIO(CONFIGFILE_DEFAULT_CONTENTS))
766754

767755
def try_eval(text): # this is a one-use function for config parsing
768756
try: return eval(text)
@@ -889,10 +877,7 @@ def update_check():
889877
global update_available
890878
global update_version
891879
socket.setdefaulttimeout(TIMEOUT_SILENT)
892-
if sys.version_info >= (3,0):
893-
req = urllib.request.Request(WEB_VERSION_CHECK)
894-
else:
895-
req = urllib.Request(WEB_VERSION_CHECK)
880+
req = urllib.request.Request(WEB_VERSION_CHECK)
896881
try:
897882
response = urllib.urlopen(req)
898883
version = response.readline().strip()

0 commit comments

Comments
 (0)