MCPcopy Index your code
hub / github.com/ipython/ipython / AutoreloadMagics

Class AutoreloadMagics

IPython/extensions/autoreload.py:641–907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

639
640@magics_class
641class AutoreloadMagics(Magics):
642 def __init__(self, *a, **kw):
643 super().__init__(*a, **kw)
644 self._reloader = ModuleReloader(self.shell)
645 self._reloader.check_all = False
646 self._reloader.autoload_obj = False
647 self.loaded_modules = set(sys.modules)
648
649 @line_magic
650 @magic_arguments.magic_arguments()
651 @magic_arguments.argument(
652 "mode",
653 type=str,
654 default="now",
655 nargs="?",
656 help="""blank or 'now' - Reload all modules (except those excluded by %%aimport)
657 automatically now.
658
659 '0' or 'off' - Disable automatic reloading.
660
661 '1' or 'explicit' - Reload only modules imported with %%aimport every
662 time before executing the Python code typed.
663
664 '2' or 'all' - Reload all modules (except those excluded by %%aimport)
665 every time before executing the Python code typed.
666
667 '3' or 'complete' - Same as 2/all, but also adds any new
668 objects in the module.
669
670 By default, a newer autoreload algorithm that diffs the module's source code
671 with the previous version and only reloads changed parts is applied for modes
672 2 and below. To use the original algorithm, add the `-` suffix to the mode,
673 e.g. '%autoreload 2-', or pass in --full.
674 """,
675 )
676 @magic_arguments.argument(
677 "-p",
678 "--print",
679 action="store_true",
680 default=False,
681 help="Show autoreload activity using `print` statements",
682 )
683 @magic_arguments.argument(
684 "-l",
685 "--log",
686 action="store_true",
687 default=False,
688 help="Show autoreload activity using the logger",
689 )
690 @magic_arguments.argument(
691 "--hide-errors",
692 action="store_true",
693 default=False,
694 help="Hide autoreload errors",
695 )
696 @magic_arguments.argument(
697 "--full",
698 action="store_true",

Callers 3

__init__Method · 0.90
__init__Method · 0.90
load_ipython_extensionFunction · 0.85

Calls

no outgoing calls

Tested by 2

__init__Method · 0.72
__init__Method · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…