Skip to content

Commit 4afa886

Browse files
committed
adjust imports to not cater to python 2.6!
1 parent df4fafb commit 4afa886

File tree

7 files changed

+8
-48
lines changed

7 files changed

+8
-48
lines changed

plotly/exceptions.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,7 @@
1515
1616
1717
"""
18-
import sys
19-
import six
20-
21-
if sys.version[:3] == '2.6':
22-
import simplejson as json
23-
else:
24-
import json
18+
import json
2519

2620
## Base Plotly Error ##
2721

plotly/graph_objs/graph_objs.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from __future__ import absolute_import
2626

2727
import warnings
28+
from collections import OrderedDict
2829
import six
2930
from plotly.graph_objs import graph_objs_tools
3031
from plotly.graph_objs.graph_objs_tools import (
@@ -35,12 +36,6 @@
3536
from plotly import utils
3637

3738
import copy
38-
import sys
39-
if sys.version[:3] == '2.6':
40-
from ordereddict import OrderedDict
41-
else:
42-
from collections import OrderedDict
43-
4439
__all__ = None
4540

4641

plotly/graph_objs/graph_objs_tools.py

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
11
from __future__ import absolute_import
22
from plotly import utils
33
import textwrap
4+
import json
45
import os
5-
import sys
6-
if sys.version[:3] == '2.6':
7-
try:
8-
from ordereddict import OrderedDict
9-
import simplejson as json
10-
except ImportError:
11-
raise ImportError(
12-
"Looks like you're running Python 2.6. Plotly expects newer "
13-
"standard library versions of ordereddict and json. You can "
14-
"simply upgrade with these 'extras' with the following terminal "
15-
"command:\npip install 'plotly[PY2.6]'"
16-
)
17-
else:
18-
from collections import OrderedDict
19-
import json
6+
from collections import OrderedDict
207
import six
218

229
from pkg_resources import resource_string

plotly/grid_objs/grid_objs.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,11 @@
55
"""
66
from __future__ import absolute_import
77

8-
import sys
8+
import json
99
from collections import MutableSequence
1010
from plotly import exceptions
1111
from plotly import utils
1212

13-
if sys.version[:3] == '2.6':
14-
import simplejson as json
15-
else:
16-
import json
1713

1814
__all__ = None
1915

plotly/plotly/plotly.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import sys
2020
import warnings
2121
import copy
22+
import json
2223
import os
2324
import six
2425
import base64
@@ -29,10 +30,6 @@
2930
else:
3031
from urllib.parse import urlparse
3132

32-
if sys.version[:3] == '2.6':
33-
import simplejson as json
34-
else:
35-
import json
3633

3734
from plotly.plotly import chunked_requests
3835
from plotly import utils

plotly/utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
77
"""
88

9+
import json
910
import os.path
1011
import sys
1112
import threading
@@ -31,11 +32,6 @@
3132
except ImportError:
3233
_sage_imported = False
3334

34-
if sys.version[:3] == '2.6':
35-
import simplejson as json
36-
else:
37-
import json
38-
3935

4036
### incase people are using threading, we lock file reads
4137
lock = threading.Lock()

plotly/widgets/graph_widget.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections import deque
2+
import json
23
import uuid
3-
import sys
44

55
# TODO: protected imports?
66
from IPython.html import widgets
@@ -12,11 +12,6 @@
1212
from plotly.graph_objs import Figure
1313
from pkg_resources import resource_string
1414

15-
# even though python 2.6 wouldn't be able to run *any* of this...
16-
if sys.version[:3] == '2.6':
17-
import simplejson as json
18-
else:
19-
import json
2015

2116
# Load JS widget code
2217
# No officially recommended way to do this in any other way

0 commit comments

Comments
 (0)