# Buggy code
def env_before_read_docs(app, env, docnames):
    docnames.sort(key=lambda x: 2 if "extension" in x else 0 if "examples" in x else 1)
    for name in [x for x in docnames if env.doc2path(x).endswith(".py")]:
        if not name.startswith(tuple(env.app.config.bokeh_plot_pyfile_include_dirs)):
            env.found_docs.remove(name)
            docnames.remove(name)


# Traceback (ValueError)
2016-08-16 15:16:51,365 error handling message Message 'PATCH-DOC' (revision 1): ValueError('Unknown string format',)
2016-08-16 15:16:51,365   message header {'msgid': '8B5BE6EBF7044F8793268769745D6C7A', 'msgtype': 'PATCH-DOC'} content {'events': [{'new': 'Mon Aug 01 2016 00:00:00 GMT-0400 (Eastern Daylight Time)', 'model': {'type': 'DatePicker', 'id': '5f8ecfc4-a06e-428f-b21d-6ed1a34cefff'}, 'attr': 'value', 'kind': 'ModelChanged'}], 'references': []}
Traceback (most recent call last):
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/server/protocol/server_handler.py", line 38, in handle
work = yield handler(message, connection)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/tornado/gen.py", line 1008, in run
value = future.result()
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/tornado/concurrent.py", line 232, in result
raise_exc_info(self._exc_info)
File "<string>", line 3, in raise_exc_info
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/tornado/gen.py", line 1017, in run
yielded = self.gen.send(value)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/server/session.py", line 45, in _needs_document_lock_wrapper
result = yield yield_for_all_futures(func(self, *args, **kwargs))
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/server/session.py", line 217, in _handle_patch
message.apply_to_document(self.document)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/server/protocol/messages/patch_doc.py", line 92, in apply_to_document
doc.apply_json_patch(self.content)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/document.py", line 955, in apply_json_patch
patched_obj.set_from_json(attr, value, models=references)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/core/properties.py", line 735, in set_from_json
prop.set_from_json(self, json, models)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/core/properties.py", line 371, in set_from_json
models)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/core/properties.py", line 323, in set_from_json
return self.__set__(obj, json)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/core/properties.py", line 455, in __set__
value = self.descriptor.prepare_value(obj.__class__, self.name, value)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/core/properties.py", line 274, in prepare_value
value = self.transform(value)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/bokeh/core/properties.py", line 1529, in transform
value = dateutil.parser.parse(value).date()
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/dateutil/parser.py", line 1164, in parse
return DEFAULTPARSER.parse(timestr, **kwargs)
File "/Users/rheineke/anaconda/lib/python3.5/site-packages/dateutil/parser.py", line 555, in parse
raise ValueError("Unknown string format")

# Fixed code
def env_before_read_docs(app, env, docnames):
    docnames.sort(key=lambda x: 0 if "examples" in x else 1)
    for name in [x for x in docnames if env.doc2path(x).endswith(".py")]:
        if not name.startswith(tuple(env.app.config.bokeh_plot_pyfile_include_dirs)):
            env.found_docs.remove(name)
            docnames.remove(name)