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