##// END OF EJS Templates
Clean up docstrings.
Bradley M. Froehle -
Show More
@@ -61,7 +61,7 b' class CythonMagics(Magics):'
61 and returns the result. If the variables `a` and `b` are defined
61 and returns the result. If the variables `a` and `b` are defined
62 in the user's namespace, here is a simple example that returns
62 in the user's namespace, here is a simple example that returns
63 their sum::
63 their sum::
64
64
65 %%cython_inline
65 %%cython_inline
66 return a+b
66 return a+b
67
67
@@ -78,14 +78,14 b' class CythonMagics(Magics):'
78 The contents of the cell are written to a `.pyx` file in the current
78 The contents of the cell are written to a `.pyx` file in the current
79 working directory, which is then imported using `pyximport`. This
79 working directory, which is then imported using `pyximport`. This
80 magic requires a module name to be passed::
80 magic requires a module name to be passed::
81
81
82 %%cython_pyximport modulename
82 %%cython_pyximport modulename
83 def f(x):
83 def f(x):
84 return 2.0*x
84 return 2.0*x
85
85
86 The compiled module is then imported and all of its symbols are injected into
86 The compiled module is then imported and all of its symbols are
87 the user's namespace. For most purposes, we recommend the usage of the
87 injected into the user's namespace. For most purposes, we recommend
88 `%%cython` magic.
88 the usage of the `%%cython` magic.
89 """
89 """
90 module_name = line.strip()
90 module_name = line.strip()
91 if not module_name:
91 if not module_name:
@@ -108,35 +108,41 b' class CythonMagics(Magics):'
108 @magic_arguments.magic_arguments()
108 @magic_arguments.magic_arguments()
109 @magic_arguments.argument(
109 @magic_arguments.argument(
110 '-c', '--compile-args', action='append', default=[],
110 '-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)."
111 help="Extra flags to pass to compiler via the `extra_compile_args` "
112 "Extension flag (can be specified multiple times)."
112 )
113 )
113 @magic_arguments.argument(
114 @magic_arguments.argument(
114 '-la', '--link-args', action='append', default=[],
115 '-la', '--link-args', action='append', default=[],
115 help="Extra flags to pass to linker via the `extra_link_args` Extension flag (can be specified multiple times)."
116 help="Extra flags to pass to linker via the `extra_link_args` "
117 "Extension flag (can be specified multiple times)."
116 )
118 )
117 @magic_arguments.argument(
119 @magic_arguments.argument(
118 '-l', '--lib', action='append', default=[],
120 '-l', '--lib', action='append', default=[],
119 help="Add a library to link the extension against (can be specified multiple times)."
121 help="Add a library to link the extension against (can be specified "
122 "multiple times)."
120 )
123 )
121 @magic_arguments.argument(
124 @magic_arguments.argument(
122 '-I', '--include', action='append', default=[],
125 '-I', '--include', action='append', default=[],
123 help="Add a path to the list of include directories (can be specified multiple times)."
126 help="Add a path to the list of include directories (can be specified "
127 "multiple times)."
124 )
128 )
125 @magic_arguments.argument(
129 @magic_arguments.argument(
126 '-f', '--force', action='store_true', default=False,
130 '-f', '--force', action='store_true', default=False,
127 help="Force the compilation of the pyx module even if it hasn't changed"
131 help="Force the compilation of the pyx module even if it hasn't "
132 "changed"
128 )
133 )
129 @magic_arguments.argument(
134 @magic_arguments.argument(
130 '-a', '--annotate', action='store_true', default=False,
135 '-a', '--annotate', action='store_true', default=False,
131 help="Produce a colorized HTML version of the source. (Implies --force)."
136 help="Produce a colorized HTML version of the source. "
137 "(Implies --force)."
132 )
138 )
133 @cell_magic
139 @cell_magic
134 def cython(self, line, cell):
140 def cython(self, line, cell):
135 """Compile and import everything from a Cython code cell.
141 """Compile and import everything from a Cython code cell.
136
142
137 The contents of the cell are written to a `.pyx` file in the
143 The contents of the cell are written to a `.pyx` file in the
138 directory `IPYTHONDIR/cython` using a filename with the hash of the code.
144 directory `IPYTHONDIR/cython` using a filename with the hash of the
139 This file is then cythonized and compiled. The resulting module
145 code. This file is then cythonized and compiled. The resulting module
140 is imported and all of its symbols are injected into the user's
146 is imported and all of its symbols are injected into the user's
141 namespace. The usage is similar to that of `%%cython_pyximport` but
147 namespace. The usage is similar to that of `%%cython_pyximport` but
142 you don't have to pass a module name::
148 you don't have to pass a module name::
@@ -179,7 +185,7 b' class CythonMagics(Magics):'
179 )
185 )
180 dist = Distribution()
186 dist = Distribution()
181 config_files = dist.find_config_files()
187 config_files = dist.find_config_files()
182 try:
188 try:
183 config_files.remove('setup.cfg')
189 config_files.remove('setup.cfg')
184 except ValueError:
190 except ValueError:
185 pass
191 pass
General Comments 0
You need to be logged in to leave comments. Login now