diff --git a/IPython/core/async_helpers.py b/IPython/core/async_helpers.py index fb4cc19..67ff169 100644 --- a/IPython/core/async_helpers.py +++ b/IPython/core/async_helpers.py @@ -62,7 +62,6 @@ def _pseudo_sync_runner(coro): See discussion in https://github.com/python-trio/trio/issues/608, Credit to Nathaniel Smith - """ try: coro.send(None) diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index ab2dbaa..0bbc18a 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -173,8 +173,8 @@ def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module: """ Parse a cell with top-level await and modify the AST to be able to run it later. - Parameter - --------- + Parameters + ---------- cell: str The code cell to asyncronify @@ -183,28 +183,29 @@ def _ast_asyncify(cell:str, wrapper_name:str) -> ast.Module: advised to **not** use a python identifier in order to not pollute the global namespace in which the function will be ran. - Return - ------ - - A module object AST containing **one** function named `wrapper_name`. - - The given code is wrapped in a async-def function, parsed into an AST, and - the resulting function definition AST is modified to return the last - expression. - - The last expression or await node is moved into a return statement at the - end of the function, and removed from its original location. If the last - node is not Expr or Await nothing is done. - - The function `__code__` will need to be later modified (by - ``removed_co_newlocals``) in a subsequent step to not create new `locals()` - meaning that the local and global scope are the same, ie as if the body of - the function was at module level. - - Lastly a call to `locals()` is made just before the last expression of the - function, or just after the last assignment or statement to make sure the - global dict is updated as python function work with a local fast cache which - is updated only on `local()` calls. + Returns + ------- + + ModuleType: + A module object AST containing **one** function named `wrapper_name`. + + The given code is wrapped in a async-def function, parsed into an AST, and + the resulting function definition AST is modified to return the last + expression. + + The last expression or await node is moved into a return statement at the + end of the function, and removed from its original location. If the last + node is not Expr or Await nothing is done. + + The function `__code__` will need to be later modified (by + ``removed_co_newlocals``) in a subsequent step to not create new `locals()` + meaning that the local and global scope are the same, ie as if the body of + the function was at module level. + + Lastly a call to `locals()` is made just before the last expression of the + function, or just after the last assignment or statement to make sure the + global dict is updated as python function work with a local fast cache which + is updated only on `local()` calls. """ from ast import Expr, Await, Return diff --git a/setupbase.py b/setupbase.py index 084c341..fa05bb7 100644 --- a/setupbase.py +++ b/setupbase.py @@ -141,7 +141,7 @@ def check_package_data(package_data): def check_package_data_first(command): """decorator for checking package_data before running a given command - + Probably only needs to wrap build_py """ class DecoratedCommand(command): @@ -351,9 +351,9 @@ class install_scripts_for_symlink(install_scripts): def git_prebuild(pkg_dir, build_cmd=build_py): """Return extended build or sdist command class for recording commit - + records git commit in IPython.utils._sysinfo.commit - + for use in IPython.utils.sysinfo.sys_info() calls after installation. """