Beispiel #1
0
def load_ipython_extension(ip):
    global _loaded
    if not _loaded:
        ip.register_magics(MDFMagics)

        # create the ambient context
        today = datetools.normalize_date(datetime.now())
        ctx = MDFContext(today)
        ctx._activate_ctx()

        _loaded = True

        print("""Use the magic function %mdf_help for a list of commands""")
Beispiel #2
0
def load_ipython_extension(ip):
    global _loaded
    if not _loaded:
        ip.register_magics(MDFMagics)

        # create the ambient context
        today = datetools.normalize_date(datetime.now())
        ctx = MDFContext(today)
        ctx._activate_ctx()

        _loaded = True

        print("""Use the magic function %mdf_help for a list of commands""")
Beispiel #3
0
 def mdf_reset(self, parameter_s=""):
     """
     Resets the current mdf context, and optionally sets the current date.
     
     %mdf_reset [date]
     
     eg: %mdf_reset
     or: %mdf_reset 2010-01-01
     """
     if parameter_s:
         now = _parse_datetime(parameter_s, self.shell.user_global_ns, self.shell.user_ns)
     else:
         now = datetools.normalize_date(datetime.now())
     ctx = MDFContext(now)
     ctx._activate_ctx()
Beispiel #4
0
 def mdf_reset(self, parameter_s=""):
     """
     Resets the current mdf context, and optionally sets the current date.
     
     %mdf_reset [date]
     
     eg: %mdf_reset
     or: %mdf_reset 2010-01-01
     """
     if parameter_s:
         now = _parse_datetime(parameter_s, self.shell.user_global_ns,
                               self.shell.user_ns)
     else:
         now = datetools.normalize_date(datetime.now())
     ctx = MDFContext(now)
     ctx._activate_ctx()