Skip to content

Commit 4826f70

Browse files
committed
Remove definition of reload command (#38) from this patchset
1 parent 10d6480 commit 4826f70

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

pythonrc.py

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
from itertools import chain
8686
from operator import attrgetter
8787
from tempfile import NamedTemporaryFile
88-
from types import FunctionType, ModuleType, SimpleNamespace
88+
from types import FunctionType, SimpleNamespace
8989

9090
__version__ = "0.9.0"
9191

@@ -905,37 +905,6 @@ def process_list_cmd(self, arg):
905905
for line_no, line in enumerate(src_lines, offset + 1):
906906
self.write(cyan(f"{line_no:03d}: {line}"))
907907

908-
@_doc_to_usage
909-
def process_reload_cmd(self, arg):
910-
"""{config.RELOAD_CMD} <object> - Reload object, if possible.
911-
912-
- if argument is a module, simply call importlib.reload() for it.
913-
914-
- if argument is not a module, try hard to re-execute the
915-
(presumably updated) source code in the namespace of the object,
916-
in effect reloading it.
917-
918-
credit: inspired by the description at https://github.com/hoh/reloadr
919-
"""
920-
if not arg:
921-
return self.writeline(
922-
"reload command requires an " f"argument (eg: {config.RELOAD_CMD} foo)"
923-
)
924-
925-
try:
926-
obj = self.lookup(arg)
927-
if isinstance(obj, ModuleType):
928-
self.locals[arg] = importlib.reload(obj)
929-
else:
930-
namespace = inspect.getmodule(obj)
931-
exec(
932-
compile(inspect.getsource(obj), namespace.__file__, "exec"),
933-
namespace.__dict__,
934-
self.locals,
935-
)
936-
except OSError as e:
937-
self.writeline(e)
938-
939908
def process_help_cmd(self, arg):
940909
if arg:
941910
if keyword.iskeyword(arg):

0 commit comments

Comments
 (0)