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