Run an IPython magic while debugging.
505265
def dbg_exec_magic(self, magic, args=''):
        """"""
        code = "!get_ipython().kernel.shell.run_line_magic('{}', '{}')".format(
                    magic, args)
        self.kernel_client.input(code)
86568
def debug(method):
    """"""
    def new_method(*args, **kwargs):
        import pdb
        try:
            import pudb
        except ImportError:
            pudb = pdb
        try:
            pudb.runcall(method, *args, **kwargs)
        except pdb.bdb.BdbQuit:
            sys.exit('Normal quit from debugger')
    new_method.__doc__ = method.__doc__
    new_method.__name__ = 'debug(%s)' % method.__name__
    return new_method
498409
def run(self):
        '''  '''

        # Announce versions
        self.versions()

        # Sample/Tag info and Help
        self.tags()
        print '\n%s' % self.workbench.help('cli')

        # Now that we have the Workbench connection spun up, we register some stuff
        # with the embedded IPython interpreter and than spin it up
        # cfg = IPython.config.loader.Config()
        cfg = Config()
        cfg.InteractiveShellEmbed.autocall = 2
        cfg.InteractiveShellEmbed.colors = 'Linux'
        cfg.InteractiveShellEmbed.color_info = True
        cfg.InteractiveShellEmbed.autoindent = True
        cfg.InteractiveShellEmbed.deep_reload = True
        cfg.PromptManager.in_template = (
            r'{color.LightPurple}{short_md5}{color.Yellow}{prompt_deco}{color.LightBlue} Workbench{color.Green}[\#]> ')
        # cfg.PromptManager.out_template = ''

        # Create the IPython shell
        self.ipshell = IPython.terminal.embed.InteractiveShellEmbed(
            config=cfg, banner1='', exit_msg='\nWorkbench has SuperCowPowers...')

        # Register our transformer, the shell will use this for 'shortcut' commands
        auto_quoter = auto_quote_xform.AutoQuoteTransformer(self.ipshell, self.ipshell.prefilter_manager)
        auto_quoter.register_command_set(self.command_set)

        # Setting up some Pandas options
        pd.set_option('display.width', 140)
        pd.set_option('max_colwidth', 15)

        # Start up the shell with our set of workbench commands
        self.ipshell(local_ns=self.command_dict)
23217
def init_debug(self):
        """"""
        import signal

        def debug_trace(sig, frame):
            """Interrupt running process, and provide a python prompt for interactive
            debugging."""

            self.log('Trace signal received')
            self.log(''.join(traceback.format_stack(frame)))

        signal.signal(signal.SIGUSR2, debug_trace)
784623
def enable_debug(self):
        
        if self.args.foreground:
            self.config.application[config.DEBUG] = True
991689
def StartGdb(self):
    """"""
    if self.inferior.is_running:
      self.inferior.ShutDownGdb()
      program_arg = 'program %d ' % self.inferior.pid
    else:
      program_arg = ''
    os.system('gdb ' + program_arg + ' '.join(self.gdb_args))
    reset_position = raw_input('Reset debugger position? [y]/n ')
    if not reset_position or reset_position == 'y' or reset_position == 'yes':
      self.position = None
636529
def _at_debug(self, calculator, rule, scope, block):
        
        setting = block.argument.strip()
        if setting.lower() in ('1', 'true', 't', 'yes', 'y', 'on'):
            setting = True
        elif setting.lower() in ('0', 'false', 'f', 'no', 'n', 'off', 'undefined'):
            setting = False
        self.ignore_parse_errors = setting
        log.info("Debug mode is %s", 'On' if self.ignore_parse_errors else 'Off')
270781
function () {
        var prefix = 'DEBUG';
        this.output(prefix, prefix.blue, Array.prototype.slice.call(arguments));
    }
910930
def run_pylint(self):
        """"""
        if (self.get_option('save_before', True)
                and not self.main.editor.save()):
            return
        self.switch_to_plugin()
        self.analyze(self.main.editor.get_current_filename())
158421
def output_for_debugging(self, stream, data):
        """"""
        with open('%s.spec.out' % stream.name, 'w') as f: f.write(str(data))
1074934
def print_debug(self, text, indent=0):
        """"""
        if self.debug:
            if indent > 0:
                print(" "*self.debug, text)
            self.debug += indent
            if indent <= 0:
                print(" "*self.debug, text)
1044229
def run_script(self, filename, wdir, args, debug, post_mortem,
                   current_client, clear_variables):
        """"""
        norm = lambda text: remove_backslashes(to_text_string(text))

        # Run Cython files in a dedicated console
        is_cython = osp.splitext(filename)[1] == '.pyx'
        if is_cython:
            current_client = False

        # Select client to execute code on it
        is_new_client = False
        if current_client:
            client = self.get_current_client()
        else:
            client = self.get_client_for_file(filename)
            if client is None:
                self.create_client_for_file(filename, is_cython=is_cython)
                client = self.get_current_client()
                is_new_client = True

        if client is not None:
            # Internal kernels, use runfile
            if client.get_kernel() is not None:
                line = "%s('%s'" % ('debugfile' if debug else 'runfile',
                                    norm(filename))
                if args:
                    line += ", args='%s'" % norm(args)
                if wdir:
                    line += ", wdir='%s'" % norm(wdir)
                if post_mortem:
                    line += ", post_mortem=True"
                line += ")"
            else: # External kernels, use %run
                line = "%run "
                if debug:
                    line += "-d "
                line += "\"%s\"" % to_text_string(filename)
                if args:
                    line += " %s" % norm(args)

            try:
                if client.shellwidget._executing:
                    # Don't allow multiple executions when there's
                    # still an execution taking place
                    # Fixes issue 7293
                    pass
                elif client.shellwidget._reading:
                    client.shellwidget._append_html(
                        _("<br><b>Please exit from debugging before trying to "
                          "run a file in this console.</b>\n<hr><br>"),
                        before_prompt=True)
                    return
                elif current_client:
                    self.execute_code(line, current_client, clear_variables)
                else:
                    if is_new_client:
                        client.shellwidget.silent_execute('%clear')
                    else:
                        client.shellwidget.execute('%clear')
                    client.shellwidget.sig_prompt_ready.connect(
                            lambda: self.execute_code(line, current_client,
                                                      clear_variables))
            except AttributeError:
                pass
            self.switch_to_plugin()
        else:
            #XXX: not sure it can really happen
            QMessageBox.warning(self, _('Warning'),
                _("No IPython console is currently available to run <b>%s</b>."
                  "<br><br>Please open a new one and try again."
                  ) % osp.basename(filename), QMessageBox.Ok)
1058840
def print_debug(self, msg):
        """"""
        assert isinstance(msg, bytes)
        state = STATE_NAMES[self.state].encode()
        console_output(b'[dbg] ' + self.display_name.encode() + b'[' + state +
                       b']: ' + msg + b'\n')
407302
def launch_debugger(frame, stream=None):
    

    d = {'_frame': frame}  # Allow access to frame object.
    d.update(frame.f_globals)  # Unless shadowed by global
    d.update(frame.f_locals)

    import code, traceback

    i = code.InteractiveConsole(d)
    message = "Signal received : entering python shell.\nTraceback:\n"
    message += ''.join(traceback.format_stack(frame))
    i.interact(message)
219319
def set_debug(self, debug=1):
        
        self._check_if_ready()
        self.debug = debug
        self.main_loop.debug = debug
94812
def debugging():
    """"""
    print("In debugging")
    json_file = r"C:\Scripting\Processing\Cell" \
                r"data\outdata\SiBEC\cellpy_batch_bec_exp02.json"

    b = init(default_log_level="DEBUG")
    b.load_info_df(json_file)
    print(b.info_df.head())

    # setting some variables
    b.export_raw = False
    b.export_cycles = False
    b.export_ica = False
    b.save_cellpy_file = True
    b.force_raw_file = False
    b.force_cellpy_file = True

    b.load_and_save_raw(parent_level="cellpydata")
794349
def init_drivers(enable_debug_driver=False):
    """"""
    for driver in DRIVERS:
        try:
            if driver != DebugDriver or enable_debug_driver:
                CLASSES.append(driver)
        except Exception:  # pylint: disable=W0703
            continue