##// END OF EJS Templates
copy timeit.Timer.timeit from CPython 3.4...
copy timeit.Timer.timeit from CPython 3.4 we were relying on self.inner for %timeit, which is an undocumented implementation detail of Python, and no longer shared by PyPy. This copies the CPython implementation, so it is no longer an undocumented attribute. It will likely not be optimal for some PyPy timings, but at least it works.

File last commit:

r14044:c016ca7e
r19988:19b061c4
Show More
handlers.py
25 lines | 704 B | text/x-python | PythonLexer
import json
from tornado import web
from ...base.handlers import IPythonHandler, json_errors
class NbconvertRootHandler(IPythonHandler):
SUPPORTED_METHODS = ('GET',)
@web.authenticated
@json_errors
def get(self):
try:
from IPython.nbconvert.exporters.export import exporter_map
except ImportError as e:
raise web.HTTPError(500, "Could not import nbconvert: %s" % e)
res = {}
for format, exporter in exporter_map.items():
res[format] = info = {}
info['output_mimetype'] = exporter.output_mimetype
self.finish(json.dumps(res))
default_handlers = [
(r"/api/nbconvert", NbconvertRootHandler),
]