Skip to content

Commit b18e871

Browse files
committed
Merge pull request plotly#252 from plotly/remove-python-2.6-support
Remove python 2.6 support
2 parents 5d27be0 + 907bf41 commit b18e871

File tree

82 files changed

+608
-698
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+608
-698
lines changed

plotly/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828

2929
from __future__ import absolute_import
3030

31-
from plotly import plotly, graph_objs, grid_objs, tools, utils, session, offline
31+
from plotly import (plotly, graph_objs, grid_objs, tools, utils, session,
32+
offline)
3233
from plotly.version import __version__

plotly/exceptions.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,14 @@
1515
1616
1717
"""
18-
import sys
19-
import six
18+
import json
2019

21-
if sys.version[:3] == '2.6':
22-
import simplejson as json
23-
else:
24-
import json
25-
26-
## Base Plotly Error ##
2720

21+
# Base Plotly Error
2822
class PlotlyError(Exception):
2923
pass
3024

3125

32-
3326
class InputError(PlotlyError):
3427
pass
3528

@@ -63,8 +56,7 @@ def __str__(self):
6356
return self.message
6457

6558

66-
## Grid Errors ##
67-
59+
# Grid Errors #
6860
COLUMN_NOT_YET_UPLOADED_MESSAGE = (
6961
"Hm... it looks like your column '{column_name}' hasn't "
7062
"been uploaded to Plotly yet. You need to upload your "
@@ -79,14 +71,14 @@ def __str__(self):
7971
"can't have duplicate column names. Rename "
8072
"the column \"{0}\" and try again."
8173
)
82-
## Would Cause Server Errors ##
74+
75+
# Would Cause Server Errors
8376

8477
class PlotlyEmptyDataError(PlotlyError):
8578
pass
8679

8780

88-
## Graph Objects Errors ##
89-
81+
# Graph Objects Errors
9082
class PlotlyGraphObjectError(PlotlyError):
9183
def __init__(self, message='', path=None, notes=None, plain_message=''):
9284
self.message = message
@@ -202,8 +194,7 @@ def __init__(self, obj='', index='', **kwargs):
202194
**kwargs)
203195

204196

205-
## Local Config Errors ##
206-
197+
# Local Config Errors
207198
class PlotlyLocalError(PlotlyError):
208199
pass
209200

@@ -224,8 +215,7 @@ def __init__(self):
224215
super(PlotlyLocalCredentialsError, self).__init__(message)
225216

226217

227-
## Server Errors ##
228-
218+
# Server Errors
229219
class PlotlyServerError(PlotlyError):
230220
pass
231221

plotly/graph_objs/graph_objs.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,19 @@
2424
"""
2525
from __future__ import absolute_import
2626

27+
import copy
28+
import sys
2729
import warnings
30+
from collections import OrderedDict
31+
2832
import six
33+
34+
from plotly import exceptions, utils
2935
from plotly.graph_objs import graph_objs_tools
3036
from plotly.graph_objs.graph_objs_tools import (
3137
INFO, OBJ_MAP, NAME_TO_KEY, KEY_TO_NAME
3238
)
3339

34-
from plotly import exceptions
35-
from plotly import utils
36-
37-
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-
4440
__all__ = None
4541

4642

plotly/graph_objs/graph_objs_tools.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,14 @@
11
from __future__ import absolute_import
2-
from plotly import utils
3-
import textwrap
2+
3+
import json
44
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
5+
import textwrap
6+
from collections import OrderedDict
7+
from pkg_resources import resource_string
8+
209
import six
2110

22-
from pkg_resources import resource_string
11+
from plotly import utils
2312

2413

2514
# Define graph reference loader

plotly/grid_objs/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
=========
44
55
"""
6+
from __future__ import absolute_import
67

7-
8-
from . grid_objs import Grid, Column
8+
from plotly.grid_objs.grid_objs import Grid, Column

plotly/grid_objs/grid_objs.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
"""
66
from __future__ import absolute_import
77

8-
import sys
8+
import json
99
from collections import MutableSequence
10-
from plotly import exceptions
11-
from plotly import utils
1210

13-
if sys.version[:3] == '2.6':
14-
import simplejson as json
15-
else:
16-
import json
11+
from plotly import exceptions, utils
1712

1813
__all__ = None
1914

plotly/matplotlylib/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
'tools' module or 'plotly' package.
1010
1111
"""
12-
from . renderer import PlotlyRenderer
13-
from . mplexporter import Exporter
12+
from __future__ import absolute_import
13+
14+
from plotly.matplotlylib.renderer import PlotlyRenderer
15+
from plotly.matplotlylib.mplexporter import Exporter

plotly/matplotlylib/mpltools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
A module for converting from mpl language to plotly language.
55
66
"""
7-
87
import math
98
import warnings
9+
1010
import matplotlib.dates
1111
import pytz
1212

plotly/matplotlylib/renderer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
import warnings
1212

13-
from . mplexporter import Renderer
14-
from . import mpltools
1513
import plotly.graph_objs as go
14+
from plotly.matplotlylib.mplexporter import Renderer
15+
from plotly.matplotlylib import mpltools
1616

1717

1818
# Warning format

plotly/offline/offline.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
"""
66
from __future__ import absolute_import
77

8-
import uuid
98
import json
109
import os
10+
import uuid
11+
1112
import requests
1213

13-
from plotly import utils
14-
from plotly import tools
14+
from plotly import session, tools, utils
1515
from plotly.exceptions import PlotlyError
16-
from plotly import session
1716

1817
PLOTLY_OFFLINE_DIRECTORY = plotlyjs_path = os.path.expanduser(
1918
os.path.join(*'~/.plotly/plotlyjs'.split('/')))

0 commit comments

Comments
 (0)