Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2e4a74d

Browse files
committed
organize the rest of our imports.
1 parent 4afa886 commit 2e4a74d

File tree

15 files changed

+48
-47
lines changed

15 files changed

+48
-47
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/graph_objs/graph_objs.py

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

27+
import copy
2728
import warnings
2829
from collections import OrderedDict
30+
2931
import six
32+
33+
from plotly import exceptions, utils
3034
from plotly.graph_objs import graph_objs_tools
3135
from plotly.graph_objs.graph_objs_tools import (
3236
INFO, OBJ_MAP, NAME_TO_KEY, KEY_TO_NAME
3337
)
3438

35-
from plotly import exceptions
36-
from plotly import utils
37-
38-
import copy
3939
__all__ = None
4040

4141

plotly/graph_objs/graph_objs_tools.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from __future__ import absolute_import
2-
from plotly import utils
3-
import textwrap
2+
43
import json
54
import os
5+
import textwrap
66
from collections import OrderedDict
7+
from pkg_resources import resource_string
8+
79
import six
810

9-
from pkg_resources import resource_string
11+
from plotly import utils
1012

1113

1214
# 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 import Grid, Column

plotly/grid_objs/grid_objs.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
import json
99
from collections import MutableSequence
10-
from plotly import exceptions
11-
from plotly import utils
1210

11+
from plotly import exceptions, utils
1312

1413
__all__ = None
1514

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('/')))

plotly/plotly/plotly.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,22 @@
1616
"""
1717
from __future__ import absolute_import
1818

19-
import sys
20-
import warnings
19+
import base64
2120
import copy
2221
import json
2322
import os
24-
import six
25-
import base64
26-
import requests
27-
28-
if sys.version[:1] == '2':
29-
from urlparse import urlparse
30-
else:
31-
from urllib.parse import urlparse
23+
import warnings
3224

25+
import requests
26+
import six
27+
import six.moves
3328

29+
from plotly import exceptions, tools, utils, version
3430
from plotly.plotly import chunked_requests
35-
from plotly import utils
36-
from plotly import tools
37-
from plotly import exceptions
38-
from plotly import version
3931
from plotly.session import (sign_in, update_session_plot_options,
4032
get_session_plot_options, get_session_credentials,
4133
get_session_config)
4234

43-
4435
__all__ = None
4536

4637
DEFAULT_PLOT_OPTIONS = {
@@ -1155,7 +1146,7 @@ def parse_grid_id_args(cls, grid, grid_url):
11551146
else:
11561147
supplied_arg_name = supplied_arg_names.pop()
11571148
if supplied_arg_name == 'grid_url':
1158-
path = urlparse(grid_url).path
1149+
path = six.moves.urllib.parse(grid_url).path
11591150
file_owner, file_id = path.replace("/~", "").split('/')[0:2]
11601151
return '{0}:{1}'.format(file_owner, file_id)
11611152
else:

plotly/session.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
which user they're signed in as, and plotting defaults.
66
77
"""
8+
from __future__ import absolute_import
89

910
import copy
11+
1012
import six
11-
from . import exceptions
13+
14+
from plotly import exceptions
1215

1316
_session = {
1417
'credentials': {},

plotly/tools.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
"""
1010
from __future__ import absolute_import
1111

12-
import os
1312
import os.path
1413
import warnings
14+
1515
import six
16-
import requests
1716

1817
from plotly import utils
1918
from plotly import exceptions

plotly/utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
Low-level functionality NOT intended for users to EVER use.
66
77
"""
8-
98
import json
109
import os.path
10+
import re
1111
import sys
1212
import threading
13-
import re
14-
import datetime
13+
1514
import pytz
1615

1716
try:

plotly/widgets/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from . graph_widget import GraphWidget
1+
from __future__ import absolute_import
2+
3+
from plotly.widgets.graph_widget import GraphWidget

plotly/widgets/graph_widget.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
from collections import deque
1+
"""
2+
Module to allow Plotly graphs to interact with IPython widgets.
3+
4+
"""
25
import json
36
import uuid
7+
from collections import deque
8+
from pkg_resources import resource_string
9+
410

511
# TODO: protected imports?
612
from IPython.html import widgets
@@ -10,8 +16,6 @@
1016
import plotly.plotly.plotly as py
1117
from plotly import utils, tools
1218
from plotly.graph_objs import Figure
13-
from pkg_resources import resource_string
14-
1519

1620
# Load JS widget code
1721
# No officially recommended way to do this in any other way

0 commit comments

Comments
 (0)