Skip to content

Commit 684780f

Browse files
casperdcltheengineear
authored andcommitted
py2.6 support
1 parent 1f1272d commit 684780f

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

plotly/graph_objs/graph_objs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def __init__(self, *args, **kwargs):
370370
self['type'] = self._name
371371

372372
# force key-value pairs to go through validation
373-
d = {key: val for key, val in dict(*args, **kwargs).items()}
373+
d = dict((key, val) for key, val in dict(*args, **kwargs).items())
374374
for key, val in d.items():
375375
self.__setitem__(key, val, _raise=_raise)
376376

plotly/graph_objs/graph_objs_tools.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ def _dict_attribute_help(object_name, path, parent_object_names, attribute):
115115
if object_name in trace_names and attribute == 'type':
116116
d = {'role': 'info'}
117117
else:
118-
d = {k: v for k, v in attribute_dict[attribute].items()
119-
if k in meta_keys and not k.startswith('_')}
118+
d = dict((k, v) for k, v in attribute_dict[attribute].items()
119+
if k in meta_keys and not k.startswith('_'))
120120
elif attribute in attribute_dict.get('_deprecated', {}):
121121
deprecate_attribute_dict = attribute_dict['_deprecated'][attribute]
122-
d = {k: v for k, v in deprecate_attribute_dict.items()
123-
if k in meta_keys and not k.startswith('_')}
122+
d = dict((k, v) for k, v in deprecate_attribute_dict.items()
123+
if k in meta_keys and not k.startswith('_'))
124124
d['deprecated'] = True
125125
else:
126126
continue

plotly/graph_reference.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def get_graph_reference():
8686

8787
sha1 = hashlib.sha1(six.b(str(graph_reference))).hexdigest()
8888

89-
graph_reference_url = '{}{}?sha1={}'.format(plotly_api_domain,
90-
GRAPH_REFERENCE_PATH, sha1)
89+
graph_reference_url = plotly_api_domain + GRAPH_REFERENCE_PATH + \
90+
"?sha1=" + sha1
9191
try:
9292
response = requests.get(graph_reference_url,
9393
timeout=GRAPH_REFERENCE_DOWNLOAD_TIMEOUT)
@@ -184,8 +184,8 @@ def get_attributes_dicts(object_name, parent_object_names=()):
184184

185185
# We return a dict mapping paths to attributes. We also add in additional
186186
# attributes if defined.
187-
attributes_dicts = {path: utils.get_by_path(GRAPH_REFERENCE, path)
188-
for path in attribute_paths}
187+
attributes_dicts = dict((path, utils.get_by_path(GRAPH_REFERENCE, path))
188+
for path in attribute_paths)
189189
attributes_dicts['additional_attributes'] = additional_attributes
190190

191191
return attributes_dicts
@@ -525,6 +525,6 @@ def _get_classes():
525525

526526
CLASSES = _get_classes()
527527

528-
OBJECT_NAME_TO_CLASS_NAME = {class_dict['object_name']: class_name
529-
for class_name, class_dict in CLASSES.items()
530-
if class_dict['object_name'] is not None}
528+
OBJECT_NAME_TO_CLASS_NAME = dict((class_dict['object_name'], class_name)
529+
for class_name, class_dict in CLASSES.items()
530+
if class_dict['object_name'] is not None)

plotly/plotly/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
verifiable account (username/api-key pair) and a network connection.
88
99
"""
10-
from . plotly import (
10+
from .plotly import (
1111
sign_in,
1212
update_plot_options,
1313
get_credentials,

plotly/plotly/plotly.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def _plot_option_logic(plot_options_from_call_signature):
112112
user_plot_options.update(file_options)
113113
user_plot_options.update(session_options)
114114
user_plot_options.update(plot_options_from_call_signature)
115-
user_plot_options = {k: v for k, v in user_plot_options.items()
116-
if k in default_plot_options}
115+
user_plot_options = dict((k, v) for k, v in user_plot_options.items()
116+
if k in default_plot_options)
117117

118118
return user_plot_options
119119

plotly/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def load_json_dict(filename, *args):
5858
data = {} # TODO: issue a warning and bubble it up
5959
lock.release()
6060
if args:
61-
return {key: data[key] for key in args if key in data}
61+
return dict((key, data[key]) for key in args if key in data)
6262
return data
6363

6464

0 commit comments

Comments
 (0)