|
1 | 1 | #!/usr/bin/env python |
2 | | -# This Python file uses the following encoding: utf-8 |
3 | 2 | #------------------------------------------------------------------------------ |
4 | 3 | # Brain Workshop: a Dual N-Back game in Python |
5 | 4 | # |
@@ -52,24 +51,16 @@ def get_argv(arg): |
52 | 51 | exit(1) |
53 | 52 |
|
54 | 53 | 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 |
63 | 57 | from decimal import Decimal |
64 | 58 | from time import strftime |
65 | 59 | from datetime import date |
66 | 60 | import gettext |
67 | 61 |
|
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') |
73 | 64 |
|
74 | 65 | # Clinical mode? Clinical mode sets cfg.JAEGGI_MODE = True, enforces a minimal user |
75 | 66 | # interface, and saves results into a binary file (default 'logfile.dat') which |
@@ -759,10 +750,7 @@ def parse_config(configpath): |
759 | 750 | os.path.join(get_data_dir(), configpath)) |
760 | 751 |
|
761 | 752 | 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)) |
766 | 754 |
|
767 | 755 | def try_eval(text): # this is a one-use function for config parsing |
768 | 756 | try: return eval(text) |
@@ -889,10 +877,7 @@ def update_check(): |
889 | 877 | global update_available |
890 | 878 | global update_version |
891 | 879 | 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) |
896 | 881 | try: |
897 | 882 | response = urllib.urlopen(req) |
898 | 883 | version = response.readline().strip() |
|
0 commit comments