summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-20 17:29:39 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-20 17:29:39 -0400
commitc58807934de73cfc2a53ae1c6d8f4ef38a982872 (patch)
treed81cab914a66df4cac3c8ed2bb5a2dd4fd54727c /cmd2
parent4ed15ba0433c0ee1a6fea1edef865fa9bd241c6e (diff)
downloadcmd2-git-c58807934de73cfc2a53ae1c6d8f4ef38a982872.tar.gz
Removed need to suppress flake8 warning
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/cmd2.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index 24de85a8..9d8c67dc 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3345,26 +3345,26 @@ class Cmd(cmd.Cmd):
'Run Python code from external files with: run filename.py\n')
exit_msg = 'Leaving IPython, back to {}'.format(sys.argv[0])
- def load_ipy(cmd2_app: Cmd):
+ def load_ipy(cmd2_app: Cmd, bridge: PyBridge):
"""
Embed an IPython shell in an environment that is restricted to only the variables in this function
- :param cmd2_app: the instance of the cmd2 app
+ :param cmd2_app: instance of the cmd2 app
+ :param bridge: a PyscriptBridge
"""
- # Create a variable pointing to a PyBridge and name it using the value of py_bridge_name
- bridge = PyBridge(cmd2_app) # noqa: F841
+ # Create a variable pointing to bridge and name it using the value of py_bridge_name
exec("{} = bridge".format(cmd2_app.py_bridge_name))
# Add self variable pointing to cmd2_app, if allowed
if cmd2_app.locals_in_py:
exec("self = cmd2_app")
- # Delete these names from the environment
- del bridge
+ # Delete these names from the environment so IPython can't use them
del cmd2_app
+ del bridge
embed(banner1=banner, exit_msg=exit_msg)
- load_ipy(self)
+ load_ipy(self, PyBridge(self))
history_description = "View, run, edit, save, or clear previously entered commands"