We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Installing simplejson kills pip on anaconda
@theengineear, from: http://stackoverflow.com/questions/28751216/plotly-killed-my-python-install?nah=1#28754036

Python 3.4 on Windows via Anaconda 2.1.0: installing simplejson (which is pulled in by Plotly's requirements.txt) kills pip:

```
Traceback (most recent call last):
  File "C:\Anaconda3\Scripts\pip-script.py", line 3, in <module>
    from pip import main
  File "C:\Anaconda3\lib\site-packages\pip\__init__.py", line 11, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "C:\Anaconda3\lib\site-packages\pip\vcs\mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "C:\Anaconda3\lib\site-packages\pip\download.py", line 22, in <module>
    from pip._vendor import requests, six
  File "C:\Anaconda3\lib\site-packages\pip\_vendor\requests\__init__.py", line 58, in <module>
    from . import utils
  File "C:\Anaconda3\lib\site-packages\pip\_vendor\requests\utils.py", line 25, in <module>
    from .compat import parse_http_list as _parse_list_header
  File "C:\Anaconda3\lib\site-packages\pip\_vendor\requests\compat.py", line 77, in <module>
    import simplejson as json
  File "C:\Anaconda3\lib\site-packages\simplejson\__init__.py", line 112, in <module>
    from .scanner import JSONDecodeError
  File "C:\Anaconda3\lib\site-packages\simplejson\scanner.py", line 10, in <module>
    c_make_scanner = _import_c_make_scanner()
  File "C:\Anaconda3\lib\site-packages\simplejson\scanner.py", line 6, in _import_c_make_scanner
    from simplejson._speedups import make_scanner
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 4: invalid start byte
```

Can we _not_ install simplejson unless it's really needed (Python 2.6 systems)?  Or is there another way we can work around this Anaconda issue?  (Logged for Anaconda as: https://github.com/ContinuumIO/anaconda-issues/issues/238 )


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `plotly/graph_objs/graph_objs_tools.py`
Content:
```
1 from __future__ import absolute_import
2 from plotly import utils
3 import textwrap
4 import os
5 import sys
6 if sys.version[:3] == '2.6':
7     from ordereddict import OrderedDict
8     import simplejson as json
9 else:
10     from collections import OrderedDict
11     import json
12 import six
13 
14 from pkg_resources import resource_string
15 
16 
17 # Define graph reference loader
18 def _load_graph_ref():
19     graph_reference_dir = 'graph_reference'
20     json_files = [
21         'graph_objs_meta.json',
22         'OBJ_MAP.json',
23         'NAME_TO_KEY.json',
24         'KEY_TO_NAME.json'
25     ]
26     out = []
27     for json_file in json_files:
28         relative_path = os.path.join(graph_reference_dir, json_file)
29         s = resource_string('plotly', relative_path).decode('utf-8')
30         tmp = json.loads(s, object_pairs_hook=OrderedDict)
31         tmp = utils.decode_unicode(tmp)
32         out += [tmp]
33     return tuple(out)
34 
35 # Load graph reference
36 INFO, OBJ_MAP, NAME_TO_KEY, KEY_TO_NAME = _load_graph_ref()
37 
38 # Add mentions to Python-specific graph obj
39 # to NAME_TO_KEY, KEY_TO_NAME, INFO
40 NAME_TO_KEY['PlotlyList'] = 'plotlylist'
41 NAME_TO_KEY['PlotlyDict'] = 'plotlydict'
42 NAME_TO_KEY['PlotlyTrace'] = 'plotlytrace'
43 NAME_TO_KEY['Trace'] = 'trace'
44 KEY_TO_NAME['plotlylist'] = 'PlotlyList'
45 KEY_TO_NAME['plotlydict'] = 'PlotlyDict'
46 KEY_TO_NAME['plotlytrace'] = 'PlotlyTrace'
47 KEY_TO_NAME['trace'] = 'Trace'
48 INFO['plotlylist'] = dict(keymeta=dict())
49 INFO['plotlydict'] = dict(keymeta=dict())
50 INFO['plotlytrace'] = dict(keymeta=dict())
51 INFO['trace'] = dict(keymeta=dict())
52 
53 # Define line and tab size for help text!
54 LINE_SIZE = 76
55 TAB_SIZE = 4
56 
57 
58 # Doc make function for list-like objects
59 def make_list_doc(name):
60     # get info for this graph obj
61     info = INFO[NAME_TO_KEY[name]]
62     # add docstring to doc
63     doc = info['docstring']
64     doc = "\t" + "\n\t".join(textwrap.wrap(doc, width=LINE_SIZE)) + "\n"
65     # Add examples to doc
66     examples = info['examples']
67     if len(examples):
68         doc += "\nExample:\n\n    >>> " + "\n    >>> ".join(examples) + "\n"
69     # Add links to online examples to doc
70     links = info['links']
71     if len(links) == 1:
72         doc += "\nOnline example:\n\n    " + "\n    ".join(links) + "\n"
73     elif len(links) > 1:
74         doc += "\nOnline examples:\n\n    " + "\n    ".join(links) + "\n"
75     # Add parents keys to doc
76     parent_keys = info['parent_keys']
77     if len(parent_keys) == 1:
78         doc += "\nParent key:\n\n    " + "\n    ".join(parent_keys) + "\n"
79     elif len(parent_keys) > 1:
80         doc += "\nParent keys:\n\n    " + "\n    ".join(parent_keys) + "\n"
81     # Add method list to doc
82     doc += "\nQuick method reference:\n\n"
83     doc += "\t{0}.".format(name) + "\n\t{0}.".format(name).join(
84         ["update(changes)", "strip_style()", "get_data()",
85          "to_graph_objs()", "validate()", "to_string()",
86          "force_clean()"]) + "\n\n"
87     return doc.expandtabs(TAB_SIZE)
88 
89 
90 # Doc make function for dict-like objects
91 def make_dict_doc(name):
92     # get info for this graph obj
93     info = INFO[NAME_TO_KEY[name]]
94     # add docstring to doc
95     doc = info['docstring']
96     doc = "\t" + "\n\t".join(textwrap.wrap(doc, width=LINE_SIZE)) + "\n"
97     # Add examples to doc
98     examples = info['examples']
99     if len(examples):
100         doc += "\nExample:\n\n    >>> " + "\n    >>> ".join(examples) + "\n"
101     # Add links to online examples to doc
102     links = info['links']
103     if len(links) == 1:
104         doc += "\nOnline example:\n\n    " + "\n    ".join(links) + "\n"
105     elif len(links) > 1:
106         doc += "\nOnline examples:\n\n    " + "\n    ".join(links) + "\n"
107     # Add parents keys to doc
108     parent_keys = info['parent_keys']
109     if len(parent_keys) == 1:
110         doc += "\nParent key:\n\n    " + "\n    ".join(parent_keys) + "\n"
111     elif len(parent_keys) > 1:
112         doc += "\nParent keys:\n\n    " + "\n    ".join(parent_keys) + "\n"
113     # Add method list to doc
114     doc += "\nQuick method reference:\n\n"
115     doc += "\t{0}.".format(name) + "\n\t{0}.".format(name).join(
116         ["update(changes)", "strip_style()", "get_data()",
117          "to_graph_objs()", "validate()", "to_string()",
118          "force_clean()"]) + "\n\n"
119     # Add key meta to doc
120     keymeta = info['keymeta']
121     if len(keymeta):
122         doc += "Valid keys:\n\n"
123         # Add each key one-by-one and format
124         width1 = LINE_SIZE-TAB_SIZE
125         width2 = LINE_SIZE-2*TAB_SIZE
126         width3 = LINE_SIZE-3*TAB_SIZE
127         undocumented = "Aw, snap! Undocumented!"
128         for key in keymeta:
129             # main portion of documentation
130             try:
131                 required = str(keymeta[key]['required'])
132             except KeyError:
133                 required = undocumented
134             try:
135                 typ = str(keymeta[key]['key_type'])
136             except KeyError:
137                 typ = undocumented
138             try:
139                 val_types = str(keymeta[key]['val_types'])
140                 if typ == 'object':
141                     val_types = ("{0} object | ".format(KEY_TO_NAME[key]) +
142                                  val_types)
143             except KeyError:
144                 val_types = undocumented
145             try:
146                 descr = str(keymeta[key]['description'])
147             except KeyError:
148                 descr = undocumented
149             str_1 = "{0} [required={1}] (value={2})".format(
150                 key, required, val_types)
151             if "streamable" in keymeta[key] and keymeta[key]["streamable"]:
152                 str_1 += " (streamable)"
153             str_1 += ":\n"
154             str_1 = "\t" + "\n\t".join(textwrap.wrap(str_1,
155                                                      width=width1)) + "\n"
156             str_2 = "\t\t" + "\n\t\t".join(textwrap.wrap(descr,
157                                            width=width2)) + "\n"
158             doc += str_1 + str_2
159             # if a user can run help on this value, tell them!
160             if typ == "object":
161                 doc += "\n\t\tFor more, run `help(plotly.graph_objs.{0" \
162                        "})`\n".format(KEY_TO_NAME[key])
163             # if example usage exists, tell them!
164             try:
165                 if len(keymeta[key]['examples']):
166                     ex = "\n\t\tExamples:\n" + "\t\t\t"
167                     ex += "\n\t\t\t".join(
168                         textwrap.wrap(' | '.join(keymeta[key]['examples']),
169                                       width=width3)) + "\n"
170                     doc += ex
171             except:
172                 pass
173             doc += '\n'
174     return doc.expandtabs(TAB_SIZE)
175 
176 
177 def update_keys(keys):
178     """Change keys we used to support to their new equivalent."""
179     updated_keys = list()
180     for key in keys:
181         if key in translations:
182             updated_keys += [translations[key]]
183         else:
184             updated_keys += [key]
185     return updated_keys
186 
187 translations = dict(
188     scl="colorscale",
189     reversescl="reversescale"
190 )
191 
192 
193 def curtail_val_repr(val, max_chars, add_delim=False):
194     delim = ", "
195     end = ".."
196     if isinstance(val, six.string_types):
197         if max_chars <= len("'" + end + "'"):
198             return ' ' * max_chars
199         elif add_delim and max_chars <= len("'" + end + "'") + len(delim):
200             return "'" + end + "'" + ' ' * (max_chars - len("'" + end + "'"))
201     else:
202         if max_chars <= len(end):
203             return ' ' * max_chars
204         elif add_delim and max_chars <= len(end) + len(delim):
205             return end + ' ' * (max_chars - len(end))
206     if add_delim:
207         max_chars -= len(delim)
208     r = repr(val)
209     if len(r) > max_chars:
210         if isinstance(val, six.string_types):
211             # TODO: can we assume this ends in "'"
212             r = r[:max_chars - len(end + "'")] + end + "'"
213         elif (isinstance(val, list) and
214               max_chars >= len("[{end}]".format(end=end))):
215             r = r[:max_chars - len(end + ']')] + end + ']'
216         else:
217             r = r[:max_chars - len(end)] + end
218     if add_delim:
219         r += delim
220     return r
221
```

Path: `setup.py`
Content:
```
1 from setuptools import setup
2 
3 exec (open('plotly/version.py').read())
4 
5 
6 def readme():
7     with open('README.rst') as f:
8         return f.read()
9 
10 
11 setup(name='plotly',
12       version=__version__,
13       use_2to3=False,
14       author='Chris P',
15       author_email='chris@plot.ly',
16       maintainer='Chris P',
17       maintainer_email='chris@plot.ly',
18       url='https://plot.ly/api/python',
19       description="Python plotting library for collaborative, "
20                   "interactive, publication-quality graphs.",
21       long_description=readme(),
22       classifiers=[
23           'Development Status :: 4 - Beta',
24           'Programming Language :: Python :: 2',
25           'Programming Language :: Python :: 2.6',
26           'Programming Language :: Python :: 2.7',
27           'Programming Language :: Python :: 3',
28           'Programming Language :: Python :: 3.2',
29           'Programming Language :: Python :: 3.3',
30           'Programming Language :: Python :: 3.4',
31           'Topic :: Scientific/Engineering :: Visualization',
32       ],
33       license='MIT',
34       packages=['plotly',
35                 'plotly/plotly',
36                 'plotly/plotly/chunked_requests',
37                 'plotly/graph_objs',
38                 'plotly/grid_objs',
39                 'plotly/widgets',
40                 'plotly/matplotlylib',
41                 'plotly/matplotlylib/mplexporter',
42                 'plotly/matplotlylib/mplexporter/renderers'],
43       package_data={'plotly': ['graph_reference/*.json', 'widgets/*.js']},
44       install_requires=['requests',
45                         'six',
46                         'pytz',
47                         'ordereddict',
48                         'simplejson'],
49       zip_safe=False)
50
```

Path: `plotly/version.py`
Content:
```
1 __version__ = '1.6.9'
2
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/plotly/graph_objs/graph_objs_tools.py b/plotly/graph_objs/graph_objs_tools.py
--- a/plotly/graph_objs/graph_objs_tools.py
+++ b/plotly/graph_objs/graph_objs_tools.py
@@ -4,8 +4,16 @@
 import os
 import sys
 if sys.version[:3] == '2.6':
-    from ordereddict import OrderedDict
-    import simplejson as json
+    try:
+        from ordereddict import OrderedDict
+        import simplejson as json
+    except ImportError:
+        raise ImportError(
+            "Looks like you're running Python 2.6. Plotly expects newer "
+            "standard library versions of ordereddict and json. You can "
+            "simply upgrade with these 'extras' with the following terminal "
+            "command:\npip install 'plotly[PY2.6]'"
+        )
 else:
     from collections import OrderedDict
     import json
diff --git a/plotly/version.py b/plotly/version.py
--- a/plotly/version.py
+++ b/plotly/version.py
@@ -1 +1 @@
-__version__ = '1.6.9'
+__version__ = '1.6.10'
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -41,9 +41,6 @@
                 'plotly/matplotlylib/mplexporter',
                 'plotly/matplotlylib/mplexporter/renderers'],
       package_data={'plotly': ['graph_reference/*.json', 'widgets/*.js']},
-      install_requires=['requests',
-                        'six',
-                        'pytz',
-                        'ordereddict',
-                        'simplejson'],
+      install_requires=['requests', 'six', 'pytz'],
+      extras_require={"PY2.6": ['simplejson', 'ordereddict']},
       zip_safe=False)

{"golden_diff": "diff --git a/plotly/graph_objs/graph_objs_tools.py b/plotly/graph_objs/graph_objs_tools.py\n--- a/plotly/graph_objs/graph_objs_tools.py\n+++ b/plotly/graph_objs/graph_objs_tools.py\n@@ -4,8 +4,16 @@\n import os\n import sys\n if sys.version[:3] == '2.6':\n-    from ordereddict import OrderedDict\n-    import simplejson as json\n+    try:\n+        from ordereddict import OrderedDict\n+        import simplejson as json\n+    except ImportError:\n+        raise ImportError(\n+            \"Looks like you're running Python 2.6. Plotly expects newer \"\n+            \"standard library versions of ordereddict and json. You can \"\n+            \"simply upgrade with these 'extras' with the following terminal \"\n+            \"command:\\npip install 'plotly[PY2.6]'\"\n+        )\n else:\n     from collections import OrderedDict\n     import json\ndiff --git a/plotly/version.py b/plotly/version.py\n--- a/plotly/version.py\n+++ b/plotly/version.py\n@@ -1 +1 @@\n-__version__ = '1.6.9'\n+__version__ = '1.6.10'\ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -41,9 +41,6 @@\n                 'plotly/matplotlylib/mplexporter',\n                 'plotly/matplotlylib/mplexporter/renderers'],\n       package_data={'plotly': ['graph_reference/*.json', 'widgets/*.js']},\n-      install_requires=['requests',\n-                        'six',\n-                        'pytz',\n-                        'ordereddict',\n-                        'simplejson'],\n+      install_requires=['requests', 'six', 'pytz'],\n+      extras_require={\"PY2.6\": ['simplejson', 'ordereddict']},\n       zip_safe=False)\n", "issue": "Installing simplejson kills pip on anaconda\n@theengineear, from: http://stackoverflow.com/questions/28751216/plotly-killed-my-python-install?nah=1#28754036\n\nPython 3.4 on Windows via Anaconda 2.1.0: installing simplejson (which is pulled in by Plotly's requirements.txt) kills pip:\n\n```\nTraceback (most recent call last):\n  File \"C:\\Anaconda3\\Scripts\\pip-script.py\", line 3, in <module>\n    from pip import main\n  File \"C:\\Anaconda3\\lib\\site-packages\\pip\\__init__.py\", line 11, in <module>\n    from pip.vcs import git, mercurial, subversion, bazaar  # noqa\n  File \"C:\\Anaconda3\\lib\\site-packages\\pip\\vcs\\mercurial.py\", line 9, in <module>\n    from pip.download import path_to_url\n  File \"C:\\Anaconda3\\lib\\site-packages\\pip\\download.py\", line 22, in <module>\n    from pip._vendor import requests, six\n  File \"C:\\Anaconda3\\lib\\site-packages\\pip\\_vendor\\requests\\__init__.py\", line 58, in <module>\n    from . import utils\n  File \"C:\\Anaconda3\\lib\\site-packages\\pip\\_vendor\\requests\\utils.py\", line 25, in <module>\n    from .compat import parse_http_list as _parse_list_header\n  File \"C:\\Anaconda3\\lib\\site-packages\\pip\\_vendor\\requests\\compat.py\", line 77, in <module>\n    import simplejson as json\n  File \"C:\\Anaconda3\\lib\\site-packages\\simplejson\\__init__.py\", line 112, in <module>\n    from .scanner import JSONDecodeError\n  File \"C:\\Anaconda3\\lib\\site-packages\\simplejson\\scanner.py\", line 10, in <module>\n    c_make_scanner = _import_c_make_scanner()\n  File \"C:\\Anaconda3\\lib\\site-packages\\simplejson\\scanner.py\", line 6, in _import_c_make_scanner\n    from simplejson._speedups import make_scanner\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 4: invalid start byte\n```\n\nCan we _not_ install simplejson unless it's really needed (Python 2.6 systems)?  Or is there another way we can work around this Anaconda issue?  (Logged for Anaconda as: https://github.com/ContinuumIO/anaconda-issues/issues/238 )\n\n", "before_files": [{"content": "from __future__ import absolute_import\nfrom plotly import utils\nimport textwrap\nimport os\nimport sys\nif sys.version[:3] == '2.6':\n    from ordereddict import OrderedDict\n    import simplejson as json\nelse:\n    from collections import OrderedDict\n    import json\nimport six\n\nfrom pkg_resources import resource_string\n\n\n# Define graph reference loader\ndef _load_graph_ref():\n    graph_reference_dir = 'graph_reference'\n    json_files = [\n        'graph_objs_meta.json',\n        'OBJ_MAP.json',\n        'NAME_TO_KEY.json',\n        'KEY_TO_NAME.json'\n    ]\n    out = []\n    for json_file in json_files:\n        relative_path = os.path.join(graph_reference_dir, json_file)\n        s = resource_string('plotly', relative_path).decode('utf-8')\n        tmp = json.loads(s, object_pairs_hook=OrderedDict)\n        tmp = utils.decode_unicode(tmp)\n        out += [tmp]\n    return tuple(out)\n\n# Load graph reference\nINFO, OBJ_MAP, NAME_TO_KEY, KEY_TO_NAME = _load_graph_ref()\n\n# Add mentions to Python-specific graph obj\n# to NAME_TO_KEY, KEY_TO_NAME, INFO\nNAME_TO_KEY['PlotlyList'] = 'plotlylist'\nNAME_TO_KEY['PlotlyDict'] = 'plotlydict'\nNAME_TO_KEY['PlotlyTrace'] = 'plotlytrace'\nNAME_TO_KEY['Trace'] = 'trace'\nKEY_TO_NAME['plotlylist'] = 'PlotlyList'\nKEY_TO_NAME['plotlydict'] = 'PlotlyDict'\nKEY_TO_NAME['plotlytrace'] = 'PlotlyTrace'\nKEY_TO_NAME['trace'] = 'Trace'\nINFO['plotlylist'] = dict(keymeta=dict())\nINFO['plotlydict'] = dict(keymeta=dict())\nINFO['plotlytrace'] = dict(keymeta=dict())\nINFO['trace'] = dict(keymeta=dict())\n\n# Define line and tab size for help text!\nLINE_SIZE = 76\nTAB_SIZE = 4\n\n\n# Doc make function for list-like objects\ndef make_list_doc(name):\n    # get info for this graph obj\n    info = INFO[NAME_TO_KEY[name]]\n    # add docstring to doc\n    doc = info['docstring']\n    doc = \"\\t\" + \"\\n\\t\".join(textwrap.wrap(doc, width=LINE_SIZE)) + \"\\n\"\n    # Add examples to doc\n    examples = info['examples']\n    if len(examples):\n        doc += \"\\nExample:\\n\\n    >>> \" + \"\\n    >>> \".join(examples) + \"\\n\"\n    # Add links to online examples to doc\n    links = info['links']\n    if len(links) == 1:\n        doc += \"\\nOnline example:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    elif len(links) > 1:\n        doc += \"\\nOnline examples:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    # Add parents keys to doc\n    parent_keys = info['parent_keys']\n    if len(parent_keys) == 1:\n        doc += \"\\nParent key:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    elif len(parent_keys) > 1:\n        doc += \"\\nParent keys:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    # Add method list to doc\n    doc += \"\\nQuick method reference:\\n\\n\"\n    doc += \"\\t{0}.\".format(name) + \"\\n\\t{0}.\".format(name).join(\n        [\"update(changes)\", \"strip_style()\", \"get_data()\",\n         \"to_graph_objs()\", \"validate()\", \"to_string()\",\n         \"force_clean()\"]) + \"\\n\\n\"\n    return doc.expandtabs(TAB_SIZE)\n\n\n# Doc make function for dict-like objects\ndef make_dict_doc(name):\n    # get info for this graph obj\n    info = INFO[NAME_TO_KEY[name]]\n    # add docstring to doc\n    doc = info['docstring']\n    doc = \"\\t\" + \"\\n\\t\".join(textwrap.wrap(doc, width=LINE_SIZE)) + \"\\n\"\n    # Add examples to doc\n    examples = info['examples']\n    if len(examples):\n        doc += \"\\nExample:\\n\\n    >>> \" + \"\\n    >>> \".join(examples) + \"\\n\"\n    # Add links to online examples to doc\n    links = info['links']\n    if len(links) == 1:\n        doc += \"\\nOnline example:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    elif len(links) > 1:\n        doc += \"\\nOnline examples:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    # Add parents keys to doc\n    parent_keys = info['parent_keys']\n    if len(parent_keys) == 1:\n        doc += \"\\nParent key:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    elif len(parent_keys) > 1:\n        doc += \"\\nParent keys:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    # Add method list to doc\n    doc += \"\\nQuick method reference:\\n\\n\"\n    doc += \"\\t{0}.\".format(name) + \"\\n\\t{0}.\".format(name).join(\n        [\"update(changes)\", \"strip_style()\", \"get_data()\",\n         \"to_graph_objs()\", \"validate()\", \"to_string()\",\n         \"force_clean()\"]) + \"\\n\\n\"\n    # Add key meta to doc\n    keymeta = info['keymeta']\n    if len(keymeta):\n        doc += \"Valid keys:\\n\\n\"\n        # Add each key one-by-one and format\n        width1 = LINE_SIZE-TAB_SIZE\n        width2 = LINE_SIZE-2*TAB_SIZE\n        width3 = LINE_SIZE-3*TAB_SIZE\n        undocumented = \"Aw, snap! Undocumented!\"\n        for key in keymeta:\n            # main portion of documentation\n            try:\n                required = str(keymeta[key]['required'])\n            except KeyError:\n                required = undocumented\n            try:\n                typ = str(keymeta[key]['key_type'])\n            except KeyError:\n                typ = undocumented\n            try:\n                val_types = str(keymeta[key]['val_types'])\n                if typ == 'object':\n                    val_types = (\"{0} object | \".format(KEY_TO_NAME[key]) +\n                                 val_types)\n            except KeyError:\n                val_types = undocumented\n            try:\n                descr = str(keymeta[key]['description'])\n            except KeyError:\n                descr = undocumented\n            str_1 = \"{0} [required={1}] (value={2})\".format(\n                key, required, val_types)\n            if \"streamable\" in keymeta[key] and keymeta[key][\"streamable\"]:\n                str_1 += \" (streamable)\"\n            str_1 += \":\\n\"\n            str_1 = \"\\t\" + \"\\n\\t\".join(textwrap.wrap(str_1,\n                                                     width=width1)) + \"\\n\"\n            str_2 = \"\\t\\t\" + \"\\n\\t\\t\".join(textwrap.wrap(descr,\n                                           width=width2)) + \"\\n\"\n            doc += str_1 + str_2\n            # if a user can run help on this value, tell them!\n            if typ == \"object\":\n                doc += \"\\n\\t\\tFor more, run `help(plotly.graph_objs.{0\" \\\n                       \"})`\\n\".format(KEY_TO_NAME[key])\n            # if example usage exists, tell them!\n            try:\n                if len(keymeta[key]['examples']):\n                    ex = \"\\n\\t\\tExamples:\\n\" + \"\\t\\t\\t\"\n                    ex += \"\\n\\t\\t\\t\".join(\n                        textwrap.wrap(' | '.join(keymeta[key]['examples']),\n                                      width=width3)) + \"\\n\"\n                    doc += ex\n            except:\n                pass\n            doc += '\\n'\n    return doc.expandtabs(TAB_SIZE)\n\n\ndef update_keys(keys):\n    \"\"\"Change keys we used to support to their new equivalent.\"\"\"\n    updated_keys = list()\n    for key in keys:\n        if key in translations:\n            updated_keys += [translations[key]]\n        else:\n            updated_keys += [key]\n    return updated_keys\n\ntranslations = dict(\n    scl=\"colorscale\",\n    reversescl=\"reversescale\"\n)\n\n\ndef curtail_val_repr(val, max_chars, add_delim=False):\n    delim = \", \"\n    end = \"..\"\n    if isinstance(val, six.string_types):\n        if max_chars <= len(\"'\" + end + \"'\"):\n            return ' ' * max_chars\n        elif add_delim and max_chars <= len(\"'\" + end + \"'\") + len(delim):\n            return \"'\" + end + \"'\" + ' ' * (max_chars - len(\"'\" + end + \"'\"))\n    else:\n        if max_chars <= len(end):\n            return ' ' * max_chars\n        elif add_delim and max_chars <= len(end) + len(delim):\n            return end + ' ' * (max_chars - len(end))\n    if add_delim:\n        max_chars -= len(delim)\n    r = repr(val)\n    if len(r) > max_chars:\n        if isinstance(val, six.string_types):\n            # TODO: can we assume this ends in \"'\"\n            r = r[:max_chars - len(end + \"'\")] + end + \"'\"\n        elif (isinstance(val, list) and\n              max_chars >= len(\"[{end}]\".format(end=end))):\n            r = r[:max_chars - len(end + ']')] + end + ']'\n        else:\n            r = r[:max_chars - len(end)] + end\n    if add_delim:\n        r += delim\n    return r\n", "path": "plotly/graph_objs/graph_objs_tools.py"}, {"content": "from setuptools import setup\n\nexec (open('plotly/version.py').read())\n\n\ndef readme():\n    with open('README.rst') as f:\n        return f.read()\n\n\nsetup(name='plotly',\n      version=__version__,\n      use_2to3=False,\n      author='Chris P',\n      author_email='chris@plot.ly',\n      maintainer='Chris P',\n      maintainer_email='chris@plot.ly',\n      url='https://plot.ly/api/python',\n      description=\"Python plotting library for collaborative, \"\n                  \"interactive, publication-quality graphs.\",\n      long_description=readme(),\n      classifiers=[\n          'Development Status :: 4 - Beta',\n          'Programming Language :: Python :: 2',\n          'Programming Language :: Python :: 2.6',\n          'Programming Language :: Python :: 2.7',\n          'Programming Language :: Python :: 3',\n          'Programming Language :: Python :: 3.2',\n          'Programming Language :: Python :: 3.3',\n          'Programming Language :: Python :: 3.4',\n          'Topic :: Scientific/Engineering :: Visualization',\n      ],\n      license='MIT',\n      packages=['plotly',\n                'plotly/plotly',\n                'plotly/plotly/chunked_requests',\n                'plotly/graph_objs',\n                'plotly/grid_objs',\n                'plotly/widgets',\n                'plotly/matplotlylib',\n                'plotly/matplotlylib/mplexporter',\n                'plotly/matplotlylib/mplexporter/renderers'],\n      package_data={'plotly': ['graph_reference/*.json', 'widgets/*.js']},\n      install_requires=['requests',\n                        'six',\n                        'pytz',\n                        'ordereddict',\n                        'simplejson'],\n      zip_safe=False)\n", "path": "setup.py"}, {"content": "__version__ = '1.6.9'\n", "path": "plotly/version.py"}], "after_files": [{"content": "from __future__ import absolute_import\nfrom plotly import utils\nimport textwrap\nimport os\nimport sys\nif sys.version[:3] == '2.6':\n    try:\n        from ordereddict import OrderedDict\n        import simplejson as json\n    except ImportError:\n        raise ImportError(\n            \"Looks like you're running Python 2.6. Plotly expects newer \"\n            \"standard library versions of ordereddict and json. You can \"\n            \"simply upgrade with these 'extras' with the following terminal \"\n            \"command:\\npip install 'plotly[PY2.6]'\"\n        )\nelse:\n    from collections import OrderedDict\n    import json\nimport six\n\nfrom pkg_resources import resource_string\n\n\n# Define graph reference loader\ndef _load_graph_ref():\n    graph_reference_dir = 'graph_reference'\n    json_files = [\n        'graph_objs_meta.json',\n        'OBJ_MAP.json',\n        'NAME_TO_KEY.json',\n        'KEY_TO_NAME.json'\n    ]\n    out = []\n    for json_file in json_files:\n        relative_path = os.path.join(graph_reference_dir, json_file)\n        s = resource_string('plotly', relative_path).decode('utf-8')\n        tmp = json.loads(s, object_pairs_hook=OrderedDict)\n        tmp = utils.decode_unicode(tmp)\n        out += [tmp]\n    return tuple(out)\n\n# Load graph reference\nINFO, OBJ_MAP, NAME_TO_KEY, KEY_TO_NAME = _load_graph_ref()\n\n# Add mentions to Python-specific graph obj\n# to NAME_TO_KEY, KEY_TO_NAME, INFO\nNAME_TO_KEY['PlotlyList'] = 'plotlylist'\nNAME_TO_KEY['PlotlyDict'] = 'plotlydict'\nNAME_TO_KEY['PlotlyTrace'] = 'plotlytrace'\nNAME_TO_KEY['Trace'] = 'trace'\nKEY_TO_NAME['plotlylist'] = 'PlotlyList'\nKEY_TO_NAME['plotlydict'] = 'PlotlyDict'\nKEY_TO_NAME['plotlytrace'] = 'PlotlyTrace'\nKEY_TO_NAME['trace'] = 'Trace'\nINFO['plotlylist'] = dict(keymeta=dict())\nINFO['plotlydict'] = dict(keymeta=dict())\nINFO['plotlytrace'] = dict(keymeta=dict())\nINFO['trace'] = dict(keymeta=dict())\n\n# Define line and tab size for help text!\nLINE_SIZE = 76\nTAB_SIZE = 4\n\n\n# Doc make function for list-like objects\ndef make_list_doc(name):\n    # get info for this graph obj\n    info = INFO[NAME_TO_KEY[name]]\n    # add docstring to doc\n    doc = info['docstring']\n    doc = \"\\t\" + \"\\n\\t\".join(textwrap.wrap(doc, width=LINE_SIZE)) + \"\\n\"\n    # Add examples to doc\n    examples = info['examples']\n    if len(examples):\n        doc += \"\\nExample:\\n\\n    >>> \" + \"\\n    >>> \".join(examples) + \"\\n\"\n    # Add links to online examples to doc\n    links = info['links']\n    if len(links) == 1:\n        doc += \"\\nOnline example:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    elif len(links) > 1:\n        doc += \"\\nOnline examples:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    # Add parents keys to doc\n    parent_keys = info['parent_keys']\n    if len(parent_keys) == 1:\n        doc += \"\\nParent key:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    elif len(parent_keys) > 1:\n        doc += \"\\nParent keys:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    # Add method list to doc\n    doc += \"\\nQuick method reference:\\n\\n\"\n    doc += \"\\t{0}.\".format(name) + \"\\n\\t{0}.\".format(name).join(\n        [\"update(changes)\", \"strip_style()\", \"get_data()\",\n         \"to_graph_objs()\", \"validate()\", \"to_string()\",\n         \"force_clean()\"]) + \"\\n\\n\"\n    return doc.expandtabs(TAB_SIZE)\n\n\n# Doc make function for dict-like objects\ndef make_dict_doc(name):\n    # get info for this graph obj\n    info = INFO[NAME_TO_KEY[name]]\n    # add docstring to doc\n    doc = info['docstring']\n    doc = \"\\t\" + \"\\n\\t\".join(textwrap.wrap(doc, width=LINE_SIZE)) + \"\\n\"\n    # Add examples to doc\n    examples = info['examples']\n    if len(examples):\n        doc += \"\\nExample:\\n\\n    >>> \" + \"\\n    >>> \".join(examples) + \"\\n\"\n    # Add links to online examples to doc\n    links = info['links']\n    if len(links) == 1:\n        doc += \"\\nOnline example:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    elif len(links) > 1:\n        doc += \"\\nOnline examples:\\n\\n    \" + \"\\n    \".join(links) + \"\\n\"\n    # Add parents keys to doc\n    parent_keys = info['parent_keys']\n    if len(parent_keys) == 1:\n        doc += \"\\nParent key:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    elif len(parent_keys) > 1:\n        doc += \"\\nParent keys:\\n\\n    \" + \"\\n    \".join(parent_keys) + \"\\n\"\n    # Add method list to doc\n    doc += \"\\nQuick method reference:\\n\\n\"\n    doc += \"\\t{0}.\".format(name) + \"\\n\\t{0}.\".format(name).join(\n        [\"update(changes)\", \"strip_style()\", \"get_data()\",\n         \"to_graph_objs()\", \"validate()\", \"to_string()\",\n         \"force_clean()\"]) + \"\\n\\n\"\n    # Add key meta to doc\n    keymeta = info['keymeta']\n    if len(keymeta):\n        doc += \"Valid keys:\\n\\n\"\n        # Add each key one-by-one and format\n        width1 = LINE_SIZE-TAB_SIZE\n        width2 = LINE_SIZE-2*TAB_SIZE\n        width3 = LINE_SIZE-3*TAB_SIZE\n        undocumented = \"Aw, snap! Undocumented!\"\n        for key in keymeta:\n            # main portion of documentation\n            try:\n                required = str(keymeta[key]['required'])\n            except KeyError:\n                required = undocumented\n            try:\n                typ = str(keymeta[key]['key_type'])\n            except KeyError:\n                typ = undocumented\n            try:\n                val_types = str(keymeta[key]['val_types'])\n                if typ == 'object':\n                    val_types = (\"{0} object | \".format(KEY_TO_NAME[key]) +\n                                 val_types)\n            except KeyError:\n                val_types = undocumented\n            try:\n                descr = str(keymeta[key]['description'])\n            except KeyError:\n                descr = undocumented\n            str_1 = \"{0} [required={1}] (value={2})\".format(\n                key, required, val_types)\n            if \"streamable\" in keymeta[key] and keymeta[key][\"streamable\"]:\n                str_1 += \" (streamable)\"\n            str_1 += \":\\n\"\n            str_1 = \"\\t\" + \"\\n\\t\".join(textwrap.wrap(str_1,\n                                                     width=width1)) + \"\\n\"\n            str_2 = \"\\t\\t\" + \"\\n\\t\\t\".join(textwrap.wrap(descr,\n                                           width=width2)) + \"\\n\"\n            doc += str_1 + str_2\n            # if a user can run help on this value, tell them!\n            if typ == \"object\":\n                doc += \"\\n\\t\\tFor more, run `help(plotly.graph_objs.{0\" \\\n                       \"})`\\n\".format(KEY_TO_NAME[key])\n            # if example usage exists, tell them!\n            try:\n                if len(keymeta[key]['examples']):\n                    ex = \"\\n\\t\\tExamples:\\n\" + \"\\t\\t\\t\"\n                    ex += \"\\n\\t\\t\\t\".join(\n                        textwrap.wrap(' | '.join(keymeta[key]['examples']),\n                                      width=width3)) + \"\\n\"\n                    doc += ex\n            except:\n                pass\n            doc += '\\n'\n    return doc.expandtabs(TAB_SIZE)\n\n\ndef update_keys(keys):\n    \"\"\"Change keys we used to support to their new equivalent.\"\"\"\n    updated_keys = list()\n    for key in keys:\n        if key in translations:\n            updated_keys += [translations[key]]\n        else:\n            updated_keys += [key]\n    return updated_keys\n\ntranslations = dict(\n    scl=\"colorscale\",\n    reversescl=\"reversescale\"\n)\n\n\ndef curtail_val_repr(val, max_chars, add_delim=False):\n    delim = \", \"\n    end = \"..\"\n    if isinstance(val, six.string_types):\n        if max_chars <= len(\"'\" + end + \"'\"):\n            return ' ' * max_chars\n        elif add_delim and max_chars <= len(\"'\" + end + \"'\") + len(delim):\n            return \"'\" + end + \"'\" + ' ' * (max_chars - len(\"'\" + end + \"'\"))\n    else:\n        if max_chars <= len(end):\n            return ' ' * max_chars\n        elif add_delim and max_chars <= len(end) + len(delim):\n            return end + ' ' * (max_chars - len(end))\n    if add_delim:\n        max_chars -= len(delim)\n    r = repr(val)\n    if len(r) > max_chars:\n        if isinstance(val, six.string_types):\n            # TODO: can we assume this ends in \"'\"\n            r = r[:max_chars - len(end + \"'\")] + end + \"'\"\n        elif (isinstance(val, list) and\n              max_chars >= len(\"[{end}]\".format(end=end))):\n            r = r[:max_chars - len(end + ']')] + end + ']'\n        else:\n            r = r[:max_chars - len(end)] + end\n    if add_delim:\n        r += delim\n    return r\n", "path": "plotly/graph_objs/graph_objs_tools.py"}, {"content": "from setuptools import setup\n\nexec (open('plotly/version.py').read())\n\n\ndef readme():\n    with open('README.rst') as f:\n        return f.read()\n\n\nsetup(name='plotly',\n      version=__version__,\n      use_2to3=False,\n      author='Chris P',\n      author_email='chris@plot.ly',\n      maintainer='Chris P',\n      maintainer_email='chris@plot.ly',\n      url='https://plot.ly/api/python',\n      description=\"Python plotting library for collaborative, \"\n                  \"interactive, publication-quality graphs.\",\n      long_description=readme(),\n      classifiers=[\n          'Development Status :: 4 - Beta',\n          'Programming Language :: Python :: 2',\n          'Programming Language :: Python :: 2.6',\n          'Programming Language :: Python :: 2.7',\n          'Programming Language :: Python :: 3',\n          'Programming Language :: Python :: 3.2',\n          'Programming Language :: Python :: 3.3',\n          'Programming Language :: Python :: 3.4',\n          'Topic :: Scientific/Engineering :: Visualization',\n      ],\n      license='MIT',\n      packages=['plotly',\n                'plotly/plotly',\n                'plotly/plotly/chunked_requests',\n                'plotly/graph_objs',\n                'plotly/grid_objs',\n                'plotly/widgets',\n                'plotly/matplotlylib',\n                'plotly/matplotlylib/mplexporter',\n                'plotly/matplotlylib/mplexporter/renderers'],\n      package_data={'plotly': ['graph_reference/*.json', 'widgets/*.js']},\n      install_requires=['requests', 'six', 'pytz'],\n      extras_require={\"PY2.6\": ['simplejson', 'ordereddict']},\n      zip_safe=False)\n", "path": "setup.py"}, {"content": "__version__ = '1.6.10'\n", "path": "plotly/version.py"}]}