##// END OF EJS Templates
Merge pull request #12433 from Carreau/reformat-1...
Matthias Bussonnier -
r25885:ba7c901e merge
parent child Browse files
Show More
@@ -62,7 +62,6 b' def _pseudo_sync_runner(coro):'
62 62 See discussion in https://github.com/python-trio/trio/issues/608,
63 63
64 64 Credit to Nathaniel Smith
65
66 65 """
67 66 try:
68 67 coro.send(None)
@@ -173,8 +173,8 b' def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module:'
173 173 """
174 174 Parse a cell with top-level await and modify the AST to be able to run it later.
175 175
176 Parameter
177 ---------
176 Parameters
177 ----------
178 178
179 179 cell: str
180 180 The code cell to asyncronify
@@ -183,28 +183,29 b' def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module:'
183 183 advised to **not** use a python identifier in order to not pollute the
184 184 global namespace in which the function will be ran.
185 185
186 Return
187 ------
188
189 A module object AST containing **one** function named `wrapper_name`.
190
191 The given code is wrapped in a async-def function, parsed into an AST, and
192 the resulting function definition AST is modified to return the last
193 expression.
194
195 The last expression or await node is moved into a return statement at the
196 end of the function, and removed from its original location. If the last
197 node is not Expr or Await nothing is done.
198
199 The function `__code__` will need to be later modified (by
200 ``removed_co_newlocals``) in a subsequent step to not create new `locals()`
201 meaning that the local and global scope are the same, ie as if the body of
202 the function was at module level.
203
204 Lastly a call to `locals()` is made just before the last expression of the
205 function, or just after the last assignment or statement to make sure the
206 global dict is updated as python function work with a local fast cache which
207 is updated only on `local()` calls.
186 Returns
187 -------
188
189 ModuleType:
190 A module object AST containing **one** function named `wrapper_name`.
191
192 The given code is wrapped in a async-def function, parsed into an AST, and
193 the resulting function definition AST is modified to return the last
194 expression.
195
196 The last expression or await node is moved into a return statement at the
197 end of the function, and removed from its original location. If the last
198 node is not Expr or Await nothing is done.
199
200 The function `__code__` will need to be later modified (by
201 ``removed_co_newlocals``) in a subsequent step to not create new `locals()`
202 meaning that the local and global scope are the same, ie as if the body of
203 the function was at module level.
204
205 Lastly a call to `locals()` is made just before the last expression of the
206 function, or just after the last assignment or statement to make sure the
207 global dict is updated as python function work with a local fast cache which
208 is updated only on `local()` calls.
208 209 """
209 210
210 211 from ast import Expr, Await, Return
@@ -141,7 +141,7 b' def check_package_data(package_data):'
141 141
142 142 def check_package_data_first(command):
143 143 """decorator for checking package_data before running a given command
144
144
145 145 Probably only needs to wrap build_py
146 146 """
147 147 class DecoratedCommand(command):
@@ -351,9 +351,9 b' class install_scripts_for_symlink(install_scripts):'
351 351
352 352 def git_prebuild(pkg_dir, build_cmd=build_py):
353 353 """Return extended build or sdist command class for recording commit
354
354
355 355 records git commit in IPython.utils._sysinfo.commit
356
356
357 357 for use in IPython.utils.sysinfo.sys_info() calls after installation.
358 358 """
359 359
General Comments 0
You need to be logged in to leave comments. Login now