Show More
@@ -45,7 +45,7 b' class MagicsDisplay(object):' | |||
|
45 | 45 | |
|
46 | 46 | def _jsonable(self): |
|
47 | 47 | """turn magics dict into jsonable dict of the same structure |
|
48 | ||
|
48 | ||
|
49 | 49 | replaces object instances with their class names as strings |
|
50 | 50 | """ |
|
51 | 51 | magic_dict = {} |
@@ -123,7 +123,7 b' class BasicMagics(Magics):' | |||
|
123 | 123 | |
|
124 | 124 | In [6]: %whereami |
|
125 | 125 | Out[6]: u'/home/testuser' |
|
126 | ||
|
126 | ||
|
127 | 127 | In [7]: %alias_magic h history "-p -l 30" --line |
|
128 | 128 | Created `%h` as an alias for `%history -l 30`. |
|
129 | 129 | """ |
@@ -367,7 +367,7 b' Currently the magic system has the following functions:""",' | |||
|
367 | 367 | |
|
368 | 368 | If called without arguments, acts as a toggle. |
|
369 | 369 | |
|
370 |
When in verbose mode the value --show (and --hide) |
|
|
370 | When in verbose mode the value --show (and --hide) | |
|
371 | 371 | will respectively show (or hide) frames with ``__tracebackhide__ = |
|
372 | 372 | True`` value set. |
|
373 | 373 | """ |
@@ -616,12 +616,11 b' class AsyncMagics(BasicMagics):' | |||
|
616 | 616 | |
|
617 | 617 | If the passed parameter does not match any of the above and is a python |
|
618 | 618 | identifier, get said object from user namespace and set it as the |
|
619 |
runner, and activate autoawait. |
|
|
619 | runner, and activate autoawait. | |
|
620 | 620 | |
|
621 | 621 | If the object is a fully qualified object name, attempt to import it and |
|
622 | 622 | set it as the runner, and activate autoawait. |
|
623 | ||
|
624 | ||
|
623 | ||
|
625 | 624 | The exact behavior of autoawait is experimental and subject to change |
|
626 | 625 | across version of IPython and Python. |
|
627 | 626 | """ |
@@ -1067,7 +1067,6 b' class ExecutionMagics(Magics):' | |||
|
1067 | 1067 | |
|
1068 | 1068 | In [6]: %timeit -n1 time.sleep(2) |
|
1069 | 1069 | |
|
1070 | ||
|
1071 | 1070 | The times reported by %timeit will be slightly higher than those |
|
1072 | 1071 | reported by the timeit.py script when variables are accessed. This is |
|
1073 | 1072 | due to the fact that %timeit executes the statement in the namespace |
@@ -1201,7 +1200,7 b' class ExecutionMagics(Magics):' | |||
|
1201 | 1200 | The CPU and wall clock times are printed, and the value of the |
|
1202 | 1201 | expression (if any) is returned. Note that under Win32, system time |
|
1203 | 1202 | is always reported as 0, since it can not be measured. |
|
1204 | ||
|
1203 | ||
|
1205 | 1204 | This function can be used both as a line and cell magic: |
|
1206 | 1205 | |
|
1207 | 1206 | - In line mode you can time a single-line statement (though multiple |
@@ -1238,7 +1237,6 b' class ExecutionMagics(Magics):' | |||
|
1238 | 1237 | CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s |
|
1239 | 1238 | Wall time: 0.00 |
|
1240 | 1239 | |
|
1241 | ||
|
1242 | 1240 | .. note:: |
|
1243 | 1241 | The time needed by Python to compile the given expression will be |
|
1244 | 1242 | reported if it is more than 0.1s. |
@@ -41,7 +41,7 b' class ExtensionMagics(Magics):' | |||
|
41 | 41 | @line_magic |
|
42 | 42 | def unload_ext(self, module_str): |
|
43 | 43 | """Unload an IPython extension by its module name. |
|
44 | ||
|
44 | ||
|
45 | 45 | Not all extensions can be unloaded, only those which define an |
|
46 | 46 | ``unload_ipython_extension`` function. |
|
47 | 47 | """ |
@@ -105,7 +105,7 b' class HistoryMagics(Magics):' | |||
|
105 | 105 | |
|
106 | 106 | By default, all input history from the current session is displayed. |
|
107 | 107 | Ranges of history can be indicated using the syntax: |
|
108 | ||
|
108 | ||
|
109 | 109 | ``4`` |
|
110 | 110 | Line 4, current session |
|
111 | 111 | ``4-6`` |
@@ -117,7 +117,7 b' class HistoryMagics(Magics):' | |||
|
117 | 117 | ``~8/1-~6/5`` |
|
118 | 118 | From the first line of 8 sessions ago, to the fifth line of 6 |
|
119 | 119 | sessions ago. |
|
120 | ||
|
120 | ||
|
121 | 121 | Multiple ranges can be entered, separated by spaces |
|
122 | 122 | |
|
123 | 123 | The same syntax is used by %macro, %save, %edit, %rerun |
@@ -173,7 +173,7 b' class NamespaceMagics(Magics):' | |||
|
173 | 173 | 'builtin', 'user', 'user_global','internal', 'alias', where |
|
174 | 174 | 'builtin' and 'user' are the search defaults. Note that you should |
|
175 | 175 | not use quotes when specifying namespaces. |
|
176 | ||
|
176 | ||
|
177 | 177 | -l: List all available object types for object matching. This function |
|
178 | 178 | can be used without arguments. |
|
179 | 179 | |
@@ -203,9 +203,9 b' class NamespaceMagics(Magics):' | |||
|
203 | 203 | Show objects beginning with a single _:: |
|
204 | 204 | |
|
205 | 205 | %psearch -a _* list objects beginning with a single underscore |
|
206 | ||
|
206 | ||
|
207 | 207 | List available objects:: |
|
208 | ||
|
208 | ||
|
209 | 209 | %psearch -l list all available object types |
|
210 | 210 | """ |
|
211 | 211 | # default namespaces to be searched |
@@ -252,7 +252,6 b' class NamespaceMagics(Magics):' | |||
|
252 | 252 | |
|
253 | 253 | Examples |
|
254 | 254 | -------- |
|
255 | ||
|
256 | 255 | Define two variables and list them with who_ls:: |
|
257 | 256 | |
|
258 | 257 | In [1]: alpha = 123 |
@@ -367,7 +366,6 b' class NamespaceMagics(Magics):' | |||
|
367 | 366 | |
|
368 | 367 | Examples |
|
369 | 368 | -------- |
|
370 | ||
|
371 | 369 | Define two variables and list them with whos:: |
|
372 | 370 | |
|
373 | 371 | In [1]: alpha = 123 |
@@ -485,22 +483,16 b' class NamespaceMagics(Magics):' | |||
|
485 | 483 | Parameters |
|
486 | 484 | ---------- |
|
487 | 485 | -f : force reset without asking for confirmation. |
|
488 | ||
|
489 | 486 | -s : 'Soft' reset: Only clears your namespace, leaving history intact. |
|
490 | 487 | References to objects may be kept. By default (without this option), |
|
491 | 488 | we do a 'hard' reset, giving you a new session and removing all |
|
492 | 489 | references to objects from the current session. |
|
493 | ||
|
494 | --aggressive: Try to aggressively remove modules from sys.modules ; this | |
|
490 | --aggressive : Try to aggressively remove modules from sys.modules ; this | |
|
495 | 491 | may allow you to reimport Python modules that have been updated and |
|
496 | 492 | pick up changes, but can have unattended consequences. |
|
497 | ||
|
498 | 493 | in : reset input history |
|
499 | ||
|
500 | 494 | out : reset output history |
|
501 | ||
|
502 | 495 | dhist : reset directory history |
|
503 | ||
|
504 | 496 | array : reset only variables that are NumPy arrays |
|
505 | 497 | |
|
506 | 498 | See Also |
@@ -624,7 +616,6 b' class NamespaceMagics(Magics):' | |||
|
624 | 616 | |
|
625 | 617 | Examples |
|
626 | 618 | -------- |
|
627 | ||
|
628 | 619 | We first fully reset the namespace so your output looks identical to |
|
629 | 620 | this example for pedagogical reasons; in practice you do not need a |
|
630 | 621 | full reset:: |
@@ -65,7 +65,7 b' class OSMagics(Magics):' | |||
|
65 | 65 | |
|
66 | 66 | def _isexec_POSIX(self, file): |
|
67 | 67 | """ |
|
68 |
|
|
|
68 | Test for executable on a POSIX system | |
|
69 | 69 | """ |
|
70 | 70 | if os.access(file.path, os.X_OK): |
|
71 | 71 | # will fail on maxOS if access is not X_OK |
@@ -76,13 +76,13 b' class OSMagics(Magics):' | |||
|
76 | 76 | |
|
77 | 77 | def _isexec_WIN(self, file): |
|
78 | 78 | """ |
|
79 |
|
|
|
79 | Test for executable file on non POSIX system | |
|
80 | 80 | """ |
|
81 | 81 | return file.is_file() and self.execre.match(file.name) is not None |
|
82 | 82 | |
|
83 | 83 | def isexec(self, file): |
|
84 | 84 | """ |
|
85 |
|
|
|
85 | Test for executable file on non POSIX system | |
|
86 | 86 | """ |
|
87 | 87 | if self.is_posix: |
|
88 | 88 | return self._isexec_POSIX(file) |
@@ -316,7 +316,6 b' class OSMagics(Magics):' | |||
|
316 | 316 | ``cd <bookmark_name>`` is enough if there is no directory |
|
317 | 317 | ``<bookmark_name>``, but a bookmark with the name exists. |
|
318 | 318 | |
|
319 | ||
|
320 | 319 | Options: |
|
321 | 320 | |
|
322 | 321 | -q Be quiet. Do not print the working directory after the |
@@ -329,7 +328,6 b' class OSMagics(Magics):' | |||
|
329 | 328 | where ``!command`` runs is immediately discarded after executing |
|
330 | 329 | 'command'. |
|
331 | 330 | |
|
332 | ||
|
333 | 331 | Examples |
|
334 | 332 | -------- |
|
335 | 333 | :: |
@@ -834,7 +832,7 b' class OSMagics(Magics):' | |||
|
834 | 832 | @cell_magic |
|
835 | 833 | def writefile(self, line, cell): |
|
836 | 834 | """Write the contents of the cell to a file. |
|
837 | ||
|
835 | ||
|
838 | 836 | The file will be overwritten unless the -a (--append) flag is specified. |
|
839 | 837 | """ |
|
840 | 838 | args = magic_arguments.parse_argstring(self.writefile, line) |
@@ -202,16 +202,16 b' class ScriptMagics(Magics):' | |||
|
202 | 202 | @dec_safe_watcher |
|
203 | 203 | def shebang(self, line, cell): |
|
204 | 204 | """Run a cell via a shell command |
|
205 | ||
|
205 | ||
|
206 | 206 | The `%%script` line is like the #! line of script, |
|
207 | 207 | specifying a program (bash, perl, ruby, etc.) with which to run. |
|
208 | ||
|
208 | ||
|
209 | 209 | The rest of the cell is run by that program. |
|
210 | ||
|
210 | ||
|
211 | 211 | Examples |
|
212 | 212 | -------- |
|
213 | 213 | :: |
|
214 | ||
|
214 | ||
|
215 | 215 | In [1]: %%script bash |
|
216 | 216 | ...: for i in 1 2 3; do |
|
217 | 217 | ...: echo $i |
General Comments 0
You need to be logged in to leave comments.
Login now