@@ -173,8 +173,8 @@ def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module:
173173 """
174174 Parse a cell with top-level await and modify the AST to be able to run it later.
175175
176- Parameter
177- ---------
176+ Parameters
177+ ----------
178178
179179 cell: str
180180 The code cell to asyncronify
@@ -183,28 +183,29 @@ def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module:
183183 advised to **not** use a python identifier in order to not pollute the
184184 global namespace in which the function will be ran.
185185
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.
208209 """
209210
210211 from ast import Expr , Await , Return
0 commit comments