Skip to content

Commit 844fd9d

Browse files
committed
remove python 2 support
1 parent e70a2e1 commit 844fd9d

File tree

4 files changed

+10
-36
lines changed

4 files changed

+10
-36
lines changed

channelfinder/CFDataTypes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@
99
@author: shroffk
1010
"""
1111

12-
from ._conf import PYTHON3
1312

14-
if PYTHON3:
15-
# cmp function is gone in Python 3.
16-
# Define for backward compatibility
17-
def cmp(a, b):
18-
return (a > b) - (a < b)
13+
def cmp(a, b):
14+
return (a > b) - (a < b)
1915

2016

2117
class Channel(object):

channelfinder/ChannelFinderClient.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
from copy import copy
1616

1717
try:
18-
from json import JSONDecoder, JSONEncoder
18+
from json import JSONEncoder
1919
except ImportError:
2020
from simplejson import JSONEncoder
2121

22-
from ._conf import basecfg, PYTHON3
22+
from ._conf import basecfg
2323

2424

2525
class ChannelFinderClient(object):
@@ -63,10 +63,7 @@ def __getDefaultConfig(self, key, ref):
6363
"""
6464
result = ref
6565
if ref is None:
66-
if PYTHON3:
67-
result = basecfg["DEFAULT"].get(key, None)
68-
elif basecfg.has_option("DEFAULT", key):
69-
result = basecfg.get("DEFAULT", key)
66+
result = basecfg["DEFAULT"].get(key, None)
7067
return result
7168

7269
def set(self, **kwds):

channelfinder/_conf.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,9 @@
1212
password=MyPassword
1313
"""
1414

15-
import sys
1615
import os.path
1716

18-
19-
if sys.version_info[0] < 3:
20-
PYTHON3 = False
21-
# Python 2 code in this block
22-
from ConfigParser import SafeConfigParser as ConfigParser
23-
else:
24-
PYTHON3 = True
25-
# Python 3 code in this block
26-
from configparser import ConfigParser
17+
from configparser import ConfigParser
2718

2819

2920
def __loadConfig():

channelfinder/cfPropertyManager/CFPropertyManager.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from getpass import getpass
1111

1212
from channelfinder import ChannelFinderClient
13-
from channelfinder._conf import basecfg, PYTHON3
13+
from channelfinder._conf import basecfg
1414

1515
global username, client, exclusion_expression, password, SERVICE_URL, quiet, verbose
1616

@@ -122,19 +122,9 @@ def applyExpression():
122122
}
123123
)
124124
except Exception as e:
125-
if PYTHON3:
126-
# Python 3 code in this block
127-
print(
128-
"Failed to update: "
129-
+ channel_name
130-
+ " \n--Cause:"
131-
+ str(e).strip()
132-
)
133-
else:
134-
# Python 2 code in this block
135-
print(
136-
"Failed to update: " + channel_name + " \n--Cause:" + e.message
137-
)
125+
print(
126+
"Failed to update: " + channel_name + " \n--Cause:" + str(e).strip()
127+
)
138128

139129

140130
def updateProperty(result, property_name, channel_name):

0 commit comments

Comments
 (0)