##// END OF EJS Templates
Convert cpasted code to unicode on Python 2...
Convert cpasted code to unicode on Python 2 Closes gh-7676 No test, because this is very awkward code to test, but I can't reproduce the error manually after this change.

File last commit:

r18302:2042215b
r20327:f1ebed45
Show More
cythonmagic.py
43 lines | 1.4 KiB | text/x-python | PythonLexer
Brian Granger
Adding Cython extension and example notebook.
r7031 # -*- coding: utf-8 -*-
"""
Matthias Bussonnier
remove cython extension....
r17910 The cython magic has been integrated into Cython itself,
which is now released in version 0.21.
Bradley M. Froehle
Add %%cython magics to generated documentation.
r8893
Matthias Bussonnier
Fix version string comparison, capitalisation and typos.
r18302 cf github `Cython` organisation, `Cython` repo, under the
Matthias Bussonnier
remove cython extension....
r17910 file `Cython/Build/IpythonMagic.py`
Brian Granger
Adding Cython extension and example notebook.
r7031 """
#-----------------------------------------------------------------------------
# Copyright (C) 2010-2011, IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
Bradley M. Froehle
Print message on stderr if annotated html cannot be read.
r8095 from __future__ import print_function
Matthias Bussonnier
Fix version string comparison, capitalisation and typos.
r18302 import IPython.utils.version as version
Brian Granger
Adding Cython extension and example notebook.
r7031 try:
Matthias Bussonnier
remove cython extension....
r17910 import Cython
except:
Cython = None
MinRK
py3 workaround for reload in cythonmagic...
r9894
try:
Matthias Bussonnier
remove cython extension....
r17910 from Cython.Build.IpythonMagic import CythonMagics
except :
pass
Brian Granger
Adding docstrings to the cython magics.
r7037
Brian Granger
Adding Cython extension and example notebook.
r7031
Matthias Bussonnier
remove cython extension....
r17910 ## still load the magic in IPython 3.x, remove completely in future versions.
Brian Granger
Adding Cython extension and example notebook.
r7031 def load_ipython_extension(ip):
"""Load the extension in IPython."""
Matthias Bussonnier
remove cython extension....
r17910
print("""The Cython magic has been move to the Cython package, hence """)
Matthias Bussonnier
add whatsnew and uppercase C in load_ext...
r17915 print("""`%load_ext cythonmagic` is deprecated; Please use `%load_ext Cython` instead.""")
Matthias Bussonnier
remove cython extension....
r17910
Matthias Bussonnier
Fix version string comparison, capitalisation and typos.
r18302 if Cython is None or not version.check_version(Cython.__version__, "0.21"):
Matthias Bussonnier
remove cython extension....
r17910 print("You need Cython version >=0.21 to use the Cython magic")
return
Matthias Bussonnier
use Cython.load_ipython_ext to simplify
r17914 print("""\nThough, because I am nice, I'll still try to load it for you this time.""")
Cython.load_ipython_extension(ip)