Skip to content

py2.6 support #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plotly/graph_objs/graph_objs.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ def __init__(self, *args, **kwargs):
self['type'] = self._name

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

Expand Down
8 changes: 4 additions & 4 deletions plotly/graph_objs/graph_objs_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ def _dict_attribute_help(object_name, path, parent_object_names, attribute):
if object_name in trace_names and attribute == 'type':
d = {'role': 'info'}
else:
d = {k: v for k, v in attribute_dict[attribute].items()
if k in meta_keys and not k.startswith('_')}
d = dict((k, v) for k, v in attribute_dict[attribute].items()
if k in meta_keys and not k.startswith('_'))
elif attribute in attribute_dict.get('_deprecated', {}):
deprecate_attribute_dict = attribute_dict['_deprecated'][attribute]
d = {k: v for k, v in deprecate_attribute_dict.items()
if k in meta_keys and not k.startswith('_')}
d = dict((k, v) for k, v in deprecate_attribute_dict.items()
if k in meta_keys and not k.startswith('_'))
d['deprecated'] = True
else:
continue
Expand Down
14 changes: 7 additions & 7 deletions plotly/graph_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def get_graph_reference():

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

graph_reference_url = '{}{}?sha1={}'.format(plotly_api_domain,
GRAPH_REFERENCE_PATH, sha1)
graph_reference_url = plotly_api_domain + GRAPH_REFERENCE_PATH + \
"?sha1=" + sha1
try:
response = requests.get(graph_reference_url,
timeout=GRAPH_REFERENCE_DOWNLOAD_TIMEOUT)
Expand Down Expand Up @@ -184,8 +184,8 @@ def get_attributes_dicts(object_name, parent_object_names=()):

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

return attributes_dicts
Expand Down Expand Up @@ -525,6 +525,6 @@ def _get_classes():

CLASSES = _get_classes()

OBJECT_NAME_TO_CLASS_NAME = {class_dict['object_name']: class_name
for class_name, class_dict in CLASSES.items()
if class_dict['object_name'] is not None}
OBJECT_NAME_TO_CLASS_NAME = dict((class_dict['object_name'], class_name)
for class_name, class_dict in CLASSES.items()
if class_dict['object_name'] is not None)
2 changes: 1 addition & 1 deletion plotly/plotly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
verifiable account (username/api-key pair) and a network connection.

"""
from . plotly import (
from .plotly import (
sign_in,
update_plot_options,
get_credentials,
Expand Down
4 changes: 2 additions & 2 deletions plotly/plotly/plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ def _plot_option_logic(plot_options_from_call_signature):
user_plot_options.update(file_options)
user_plot_options.update(session_options)
user_plot_options.update(plot_options_from_call_signature)
user_plot_options = {k: v for k, v in user_plot_options.items()
if k in default_plot_options}
user_plot_options = dict((k, v) for k, v in user_plot_options.items()
if k in default_plot_options)

return user_plot_options

Expand Down
2 changes: 1 addition & 1 deletion plotly/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def load_json_dict(filename, *args):
data = {} # TODO: issue a warning and bubble it up
lock.release()
if args:
return {key: data[key] for key in args if key in data}
return dict((key, data[key]) for key in args if key in data)
return data


Expand Down