##// END OF EJS Templates
Merge pull request #12452 from Carreau/doc-reformat...
Matthias Bussonnier -
r25908:63244980 merge
parent child Browse files
Show More
@@ -128,11 +128,11 b' else:'
128 128 #-----------------------------------------------------------------------------
129 129
130 130 def removed_co_newlocals(function:types.FunctionType) -> types.FunctionType:
131 """Return a function that do not create a new local scope.
131 """Return a function that do not create a new local scope.
132 132
133 133 Given a function, create a clone of this function where the co_newlocal flag
134 134 has been removed, making this function code actually run in the sourounding
135 scope.
135 scope.
136 136
137 137 We need this in order to run asynchronous code in user level namespace.
138 138 """
@@ -175,7 +175,6 b' def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module:'
175 175
176 176 Parameters
177 177 ----------
178
179 178 cell: str
180 179 The code cell to asyncronify
181 180 wrapper_name: str
@@ -185,7 +184,6 b' def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module:'
185 184
186 185 Returns
187 186 -------
188
189 187 ModuleType:
190 188 A module object AST containing **one** function named `wrapper_name`.
191 189
@@ -896,9 +894,9 b' class InteractiveShell(SingletonConfigurable):'
896 894 virtualenv was built, and it ignores the --no-site-packages option. A
897 895 warning will appear suggesting the user installs IPython in the
898 896 virtualenv, but for many cases, it probably works well enough.
899
897
900 898 Adapted from code snippets online.
901
899
902 900 http://blog.ufsoft.org/2009/1/29/ipython-and-virtualenv
903 901 """
904 902 if 'VIRTUAL_ENV' not in os.environ:
@@ -1067,7 +1065,7 b' class InteractiveShell(SingletonConfigurable):'
1067 1065
1068 1066 def register_post_execute(self, func):
1069 1067 """DEPRECATED: Use ip.events.register('post_run_cell', func)
1070
1068
1071 1069 Register a function for calling after code execution.
1072 1070 """
1073 1071 warn("ip.register_post_execute is deprecated, use "
@@ -1087,14 +1085,14 b' class InteractiveShell(SingletonConfigurable):'
1087 1085
1088 1086 def new_main_mod(self, filename, modname):
1089 1087 """Return a new 'main' module object for user code execution.
1090
1088
1091 1089 ``filename`` should be the path of the script which will be run in the
1092 1090 module. Requests with the same filename will get the same module, with
1093 1091 its namespace cleared.
1094
1092
1095 1093 ``modname`` should be the module name - normally either '__main__' or
1096 1094 the basename of the file without the extension.
1097
1095
1098 1096 When scripts are executed via %run, we must keep a reference to their
1099 1097 __main__ module around so that Python doesn't
1100 1098 clear it, rendering references to module globals useless.
@@ -1130,7 +1128,6 b' class InteractiveShell(SingletonConfigurable):'
1130 1128
1131 1129 Examples
1132 1130 --------
1133
1134 1131 In [15]: import IPython
1135 1132
1136 1133 In [16]: m = _ip.new_main_mod(IPython.__file__, 'IPython')
@@ -1280,10 +1277,10 b' class InteractiveShell(SingletonConfigurable):'
1280 1277
1281 1278 def prepare_user_module(self, user_module=None, user_ns=None):
1282 1279 """Prepare the module and namespace in which user code will be run.
1283
1280
1284 1281 When IPython is started normally, both parameters are None: a new module
1285 1282 is created automatically, and its __dict__ used as the namespace.
1286
1283
1287 1284 If only user_module is provided, its __dict__ is used as the namespace.
1288 1285 If only user_ns is provided, a dummy module is created, and user_ns
1289 1286 becomes the global namespace. If both are provided (as they may be
@@ -1404,7 +1401,7 b' class InteractiveShell(SingletonConfigurable):'
1404 1401 def all_ns_refs(self):
1405 1402 """Get a list of references to all the namespace dictionaries in which
1406 1403 IPython might store a user-created object.
1407
1404
1408 1405 Note that this does not include the displayhook, which also caches
1409 1406 objects from the output."""
1410 1407 return [self.user_ns, self.user_global_ns, self.user_ns_hidden] + \
@@ -1582,15 +1579,15 b' class InteractiveShell(SingletonConfigurable):'
1582 1579 def drop_by_id(self, variables):
1583 1580 """Remove a dict of variables from the user namespace, if they are the
1584 1581 same as the values in the dictionary.
1585
1582
1586 1583 This is intended for use by extensions: variables that they've added can
1587 1584 be taken back out if they are unloaded, without removing any that the
1588 1585 user has overwritten.
1589
1586
1590 1587 Parameters
1591 1588 ----------
1592 1589 variables : dict
1593 A dictionary mapping object names (as strings) to the objects.
1590 A dictionary mapping object names (as strings) to the objects.
1594 1591 """
1595 1592 for name, obj in variables.items():
1596 1593 if name in self.user_ns and self.user_ns[name] is obj:
@@ -1884,10 +1881,10 b' class InteractiveShell(SingletonConfigurable):'
1884 1881
1885 1882 def validate_stb(stb):
1886 1883 """validate structured traceback return type
1887
1884
1888 1885 return type of CustomTB *should* be a list of strings, but allow
1889 1886 single strings or None, which are harmless.
1890
1887
1891 1888 This function will *always* return a list of strings,
1892 1889 and will raise a TypeError if stb is inappropriate.
1893 1890 """
@@ -2289,14 +2286,12 b' class InteractiveShell(SingletonConfigurable):'
2289 2286 Parameters
2290 2287 ----------
2291 2288 magic_name : str
2292 Name of the desired magic function, without '%' prefix.
2293
2289 Name of the desired magic function, without '%' prefix.
2294 2290 line : str
2295 The rest of the input line as a single string.
2296
2291 The rest of the input line as a single string.
2297 2292 _stack_depth : int
2298 If run_line_magic() is called from magic() then _stack_depth=2.
2299 This is added to ensure backward compatibility for use of 'get_ipython().magic()'
2293 If run_line_magic() is called from magic() then _stack_depth=2.
2294 This is added to ensure backward compatibility for use of 'get_ipython().magic()'
2300 2295 """
2301 2296 fn = self.find_line_magic(magic_name)
2302 2297 if fn is None:
@@ -2333,7 +2328,7 b' class InteractiveShell(SingletonConfigurable):'
2333 2328 Parameters
2334 2329 ----------
2335 2330 stack_depth : int
2336 Depth relative to calling frame
2331 Depth relative to calling frame
2337 2332 """
2338 2333 return sys._getframe(stack_depth + 1).f_locals
2339 2334
@@ -2343,13 +2338,11 b' class InteractiveShell(SingletonConfigurable):'
2343 2338 Parameters
2344 2339 ----------
2345 2340 magic_name : str
2346 Name of the desired magic function, without '%' prefix.
2347
2341 Name of the desired magic function, without '%' prefix.
2348 2342 line : str
2349 The rest of the first input line as a single string.
2350
2343 The rest of the first input line as a single string.
2351 2344 cell : str
2352 The body of the cell as a (possibly multiline) string.
2345 The body of the cell as a (possibly multiline) string.
2353 2346 """
2354 2347 fn = self.find_cell_magic(magic_name)
2355 2348 if fn is None:
General Comments 0
You need to be logged in to leave comments. Login now