Beispiel #1
0
 def add_completer(self, fxn, **kargs):
     """ adds (and logs the addition of) a completion hook,
         probably with run-priority mentioned in the kargs
     """
     completion_log.info("adding new completer: {0}".format(fxn))
     self.completers[get_caller(2)['class']].append(fxn)
     get_ipython().set_hook('complete_command', fxn, **kargs)
Beispiel #2
0
def embed(argv=tuple(), **kargs):
    hijack_ipython_module()
    # if os.environ.get('SMASH', None):
    #    print "..detected nesting.. this may cause problems"
    context = kargs.pop('user_ns', {})
    caller_context = get_caller(2)
    if context is not None:
        context.update(caller_context['globals'])
        context.update(caller_context['locals'])
    if '--no-confirm-exit' not in argv:
        argv = ['--no-confirm-exit'] + list(argv)
    try:
        start_ipython(argv=argv, user_ns=context, **kargs)
    except KeyboardInterrupt:
        pass
Beispiel #3
0
 def ignoreHandlers(*args, **kargs):
     from goulash._inspect import get_caller
     caller_context = get_caller(4)
     global last_change
     last_change = caller_context
     print 'LOGGING SETUP CHANGED BY:', caller_context['__file__']