##// END OF EJS Templates
Keep `magic_arguments` module vs function clear.
Bradley M. Froehle -
Show More
@@ -27,11 +27,9 except ImportError:
27 from distutils.core import Distribution, Extension
27 from distutils.core import Distribution, Extension
28 from distutils.command.build_ext import build_ext
28 from distutils.command.build_ext import build_ext
29
29
30 from IPython.core import magic_arguments
30 from IPython.core.magic import Magics, magics_class, cell_magic
31 from IPython.core.magic import Magics, magics_class, cell_magic
31 from IPython.testing.skipdoctest import skip_doctest
32 from IPython.testing.skipdoctest import skip_doctest
32 from IPython.core.magic_arguments import (
33 argument, magic_arguments, parse_argstring
34 )
35 from IPython.utils import py3compat
33 from IPython.utils import py3compat
36
34
37 import Cython
35 import Cython
@@ -105,20 +103,20 class CythonMagics(Magics):
105 self._reloads[module_name] = module
103 self._reloads[module_name] = module
106 self._import_all(module)
104 self._import_all(module)
107
105
108 @magic_arguments()
106 @magic_arguments.magic_arguments()
109 @argument(
107 @magic_arguments.argument(
110 '-c', '--compile-args', action='append', default=[],
108 '-c', '--compile-args', action='append', default=[],
111 help="Extra flags to pass to compiler via the `extra_compile_args` Extension flag (can be specified multiple times)."
109 help="Extra flags to pass to compiler via the `extra_compile_args` Extension flag (can be specified multiple times)."
112 )
110 )
113 @argument(
111 @magic_arguments.argument(
114 '-l', '--lib', action='append', default=[],
112 '-l', '--lib', action='append', default=[],
115 help="Add a library to link the extension against (can be specified multiple times)."
113 help="Add a library to link the extension against (can be specified multiple times)."
116 )
114 )
117 @argument(
115 @magic_arguments.argument(
118 '-I', '--include', action='append', default=[],
116 '-I', '--include', action='append', default=[],
119 help="Add a path to the list of include directories (can be specified multiple times)."
117 help="Add a path to the list of include directories (can be specified multiple times)."
120 )
118 )
121 @argument(
119 @magic_arguments.argument(
122 '-f', '--force', action='store_true', default=False,
120 '-f', '--force', action='store_true', default=False,
123 help="Force the compilation of the pyx module even if it hasn't changed"
121 help="Force the compilation of the pyx module even if it hasn't changed"
124 )
122 )
@@ -137,7 +135,7 class CythonMagics(Magics):
137 def f(x):
135 def f(x):
138 return 2.0*x
136 return 2.0*x
139 """
137 """
140 args = parse_argstring(self.cython, line)
138 args = magic_arguments.parse_argstring(self.cython, line)
141 code = cell if cell.endswith('\n') else cell+'\n'
139 code = cell if cell.endswith('\n') else cell+'\n'
142 lib_dir = os.path.join(self.shell.ipython_dir, 'cython')
140 lib_dir = os.path.join(self.shell.ipython_dir, 'cython')
143 cython_include_dirs = ['.']
141 cython_include_dirs = ['.']
General Comments 0
You need to be logged in to leave comments. Login now