diff --git a/plotly/graph_objs/graph_objs.py b/plotly/graph_objs/graph_objs.py index 65632cadad6..142a53cf20a 100644 --- a/plotly/graph_objs/graph_objs.py +++ b/plotly/graph_objs/graph_objs.py @@ -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) diff --git a/plotly/graph_objs/graph_objs_tools.py b/plotly/graph_objs/graph_objs_tools.py index 334927ef4c4..9a4d2c5ff52 100644 --- a/plotly/graph_objs/graph_objs_tools.py +++ b/plotly/graph_objs/graph_objs_tools.py @@ -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 diff --git a/plotly/graph_reference.py b/plotly/graph_reference.py index 1e8eccb0213..a7287aab19a 100644 --- a/plotly/graph_reference.py +++ b/plotly/graph_reference.py @@ -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) @@ -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 @@ -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) diff --git a/plotly/plotly/__init__.py b/plotly/plotly/__init__.py index b45bdda4439..61e63b52d8a 100644 --- a/plotly/plotly/__init__.py +++ b/plotly/plotly/__init__.py @@ -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, diff --git a/plotly/plotly/plotly.py b/plotly/plotly/plotly.py index 756fc190000..7c6b5b6ec59 100644 --- a/plotly/plotly/plotly.py +++ b/plotly/plotly/plotly.py @@ -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 diff --git a/plotly/utils.py b/plotly/utils.py index 841d9a9d305..986599e82e0 100644 --- a/plotly/utils.py +++ b/plotly/utils.py @@ -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