def Func(arg_0):
        """Reimplemented to make a history request and load %guiref."""
        super(IPythonWidget, arg_0).Func()
        arg_0._load_guiref_magic()
        arg_0.kernel_manager.shell_channel.history(hist_access_type='tail',
                                                  n=1000)


def Func(arg_0, arg_1):
        """ Reimplemented for IPython-style traceback formatting.
        """
        arg_2 = arg_1['content']
        arg_3 = '\n'.join(arg_2['traceback']) + '\n'
        if False:
            # FIXME: For now, tracebacks come as plain text, so we can't use
            # the html renderer yet.  Once we refactor ultratb to produce
            # properly styled tracebacks, this branch should be the default
            arg_3 = arg_3.replace(' ', ' ')
            arg_3 = arg_3.replace('\n', '
')

            arg_4 = arg_2['ename']
            arg_5 = '%s' % arg_4
            arg_3 = arg_3.replace(arg_4, arg_5)

            arg_0._append_html(arg_3)
        else:
            # This is the fallback for now, using plain text with ansi escapes
            arg_0._append_plain_text(arg_3)


def Func(arg_0, arg_1):
        """ Reimplemented to dispatch payloads to handler methods.
        """
        arg_2 = arg_0._payload_handlers.get(arg_1['source'])
        if arg_2 is None:
            # We have no handler for this type of payload, simply ignore it
            return False
        else:
            arg_2(arg_1)
            return True


def Func(arg_0, arg_1='lightbg'):
        """ Sets the widget style to the class defaults.

        Parameters:
        -----------
        colors : str, optional (default lightbg)
            Whether to use the default IPython light background or dark
            background or B&W style.
        """
        arg_1 = arg_1.lower()
        if arg_1=='lightbg':
            arg_0.style_sheet = styles.default_light_style_sheet
            arg_0.syntax_style = styles.default_light_syntax_style
        elif arg_1=='linux':
            arg_0.style_sheet = styles.default_dark_style_sheet
            arg_0.syntax_style = styles.default_dark_syntax_style
        elif arg_1=='nocolor':
            arg_0.style_sheet = styles.default_bw_style_sheet
            arg_0.syntax_style = styles.default_bw_syntax_style
        else:
            raise KeyError("No such color scheme: %s"%arg_1)


def Func(arg_0, arg_1, arg_2=None):
        """ Opens a Python script for editing.

        Parameters:
        -----------
        filename : str
            A path to a local system file.

        line : int, optional
            A line of interest in the file.
        """
        if arg_0.customFunc:
            arg_0.customFunc_requested.emit(arg_1, arg_2)
        elif not arg_0.editor:
            arg_0._append_plain_text('No default editor available.\n'
            'Specify a GUI text editor in the `IPythonWidget.editor` '
            'configurable to enable the %edit magic')
        else:
            try:
                arg_1 = '"%s"' % arg_1
                if arg_2 and arg_0.editor_line:
                    arg_3 = arg_0.editor_line.format(arg_1=arg_1,
                                                      arg_2=arg_2)
                else:
                    try:
                        arg_3 = arg_0.editor.format()
                    except KeyError:
                        arg_3 = arg_0.editor.format(arg_1=arg_1)
                    else:
                        arg_3 += ' ' + arg_1
            except KeyError:
                arg_0._append_plain_text('Invalid editor command.\n')
            else:
                try:
                    Popen(arg_3, shell=True)
                except OSError:
                    arg_4 = 'Opening editor with command "%s" failed.\n'
                    arg_0._append_plain_text(arg_4 % arg_3)


def Func(arg_0):
        """ Set the style sheets of the underlying widgets.
        """
        arg_0.setStyleSheet(arg_0.style_sheet)
        if arg_0._control is not None:
            arg_0._control.document().setDefaultStyleSheet(arg_0.style_sheet)
            arg_1 = arg_0._control.palette().window().color()
            arg_0._ansi_processor.set_background_color(arg_1)

        if arg_0._page_control is not None:
            arg_0._page_control.document().setDefaultStyleSheet(arg_0.style_sheet)


def Func(arg_0):
        """ Set the style for the syntax highlighter.
        """
        if arg_0._highlighter is None:
            # ignore premature calls
            return
        if arg_0.syntax_style:
            arg_0._highlighter.set_style(arg_0.syntax_style)
        else:
            arg_0._highlighter.set_style_sheet(arg_0.style_sheet)


async def Func(arg_0, arg_1: arg_2.client_reqrep.ClientResponse, arg_5: arg_6) -> dict:
        """
        Handles the response returned from the CloudStack API. Some CloudStack API are implemented asynchronous, which
        means that the API call returns just a job id. The actually expected API response is postponed and a specific
        asyncJobResults API has to be polled using the job id to get the final result once the API call has been
        processed.

        :param response: The response returned by the aiohttp call.
        :type response: aiohttp.client_reqrep.ClientResponse
        :param await_final_result: Specifier that indicates whether the function should poll the asyncJobResult API
                                   until the asynchronous API call has been processed
        :type await_final_result: bool
        :return: Dictionary containing the JSON response of the API call
        :rtype: dict
        """
        try:
            arg_7 = await arg_1.json()
        except arg_2.client_exceptions.ContentTypeError:
            arg_8 = await arg_1.text()
            logging.debug('Content returned by server not of type "application/json"\n Content: {}'.format(arg_8))
            raise CloudStackClientException(message="Could not decode content. Server did not return json content!")
        else:
            arg_7 = arg_0._transform_data(arg_7)
            if arg_1.status != 200:
                raise CloudStackClientException(message="Async CloudStack call failed!",
                                                error_code=arg_7.get("errorcode", arg_1.status),
                                                error_text=arg_7.get("errortext"),
                                                arg_1=arg_7)

        while arg_5 and ('jobid' in arg_7):
            await asyncio.sleep(arg_0.async_poll_latency)
            arg_7 = await arg_0.queryAsyncJobResult(jobid=arg_7['jobid'])
            if arg_7['jobstatus']:  # jobstatus is 0 for pending async CloudStack calls
                if not arg_7['jobresultcode']:  # exit code is zero
                    try:
                        return arg_7['jobresult']
                    except KeyError:
                        pass
                logging.debug("Async CloudStack call returned {}".format(str(arg_7)))
                raise CloudStackClientException(message="Async CloudStack call failed!",
                                                error_code=arg_7.get("errorcode"),
                                                error_text=arg_7.get("errortext"),
                                                arg_1=arg_7)

        return arg_7


def Func(arg_0, arg_1: arg_2) -> arg_2:
        """
        According to the CloudStack documentation, each request needs to be signed in order to authenticate the user
        account executing the API command. The signature is generated using a combination of the api secret and a SHA-1
        hash of the url parameters including the command string. In order to generate a unique identifier, the url
        parameters have to be transformed to lower case and ordered alphabetically.

        :param url_parameters: The url parameters of the API call including the command string
        :type url_parameters: dict
        :return: The url parameters including a new key, which contains the signature
        :rtype: dict
        """
        if arg_1:
            arg_1.pop('signature', None)  # remove potential existing signature from url parameters
            arg_3 = urlencode(sorted(arg_1.items()), safe='.-*_', quote_via=quote).lower()
            arg_4 = hmac.new(arg_0.api_secret.encode('utf-8'), arg_3.encode('utf-8'), hashlib.sha1).digest()
            arg_1['signature'] = base64.b64encode(arg_4).decode('utf-8').strip()
        return arg_1


def Func(arg_0: arg_1) -> arg_1:
        """
        Each CloudStack API call returns a nested dictionary structure. The first level contains only one key indicating
        the API that originated the response. This function removes that first level from the data returned to the
        caller.

        :param data: Response of the API call
        :type data: dict
        :return: Simplified response without the information about the API that originated the response.
        :rtype: dict
        """
        for arg_2 in arg_0.keys():
            arg_3 = arg_0[arg_2]
            if isinstance(arg_3, arg_1):
                return arg_3
        return arg_0


def Func():
    """System virtual memory as a namedutple."""
    arg_0 =  _psutil_bsd.get_virtual_mem()
    arg_1, arg_2, arg_3, arg_4, arg_5, arg_6, arg_7, arg_8 = arg_0
    arg_9 = arg_4 + arg_6 + arg_2
    arg_10 =  arg_3 + arg_5 + arg_6
    arg_11 = usage_percent((arg_1 - arg_9), arg_1, _round=1)
    return nt_virtmem_info(arg_1, arg_9, arg_11, arg_10, arg_2,
                           arg_3, arg_4, arg_7, arg_6, arg_8, arg_5)


def Func():
    """Return system per-CPU times as a named tuple"""
    arg_0, arg_1, arg_2, arg_3, arg_4 = _psutil_bsd.Func()
    return _cputimes_ntuple(arg_0, arg_1, arg_2, arg_3, arg_4)


def Func(arg_0):
        """Return real, effective and saved group ids."""
        arg_1, arg_2, arg_3 = _psutil_bsd.Func(arg_0.pid)
        return nt_gids(arg_1, arg_2, arg_3)


def Func(arg_0):
        """Return the number of threads belonging to the process."""
        arg_1 = _psutil_bsd.Func(arg_0.pid)
        arg_2 = []
        for arg_3, arg_4, arg_5 in arg_1:
            arg_6 = nt_thread(arg_3, arg_4, arg_5)
            arg_2.append(arg_6)
        return arg_2


def Func(arg_0):
        """Return files opened by process as a list of namedtuples."""
        # XXX - C implementation available on FreeBSD >= 8 only
        # else fallback on lsof parser
        if hasattr(_psutil_bsd, "get_process_open_files"):
            arg_1 = _psutil_bsd.get_process_open_files(arg_0.pid)
            return [nt_openfile(arg_2, arg_3) for arg_2, arg_3 in arg_1]
        else:
            arg_4 = _psposix.LsofParser(arg_0.pid, arg_0._process_name)
            return arg_4.get_process_open_files()


def Func(arg_0):
    """Return dict describing the context of this package

    Parameters
    ----------
    pkg_path : str
       path containing __init__.py for package

    Returns
    -------
    context : dict
       with named parameters of interest
    """
    arg_1, arg_2 = pkg_commit_hash(arg_0)
    return dict(
        ipython_version=release.version,
        ipython_path=arg_0,
        commit_source=arg_1,
        commit_hash=arg_2,
        sys_version=sys.version,
        sys_executable=sys.executable,
        sys_platform=sys.platform,
        platform=platform.platform(),
        os_name=os.name,
        default_encoding=encoding.DEFAULT_ENCODING,
        )


def Func():
    """Return useful information about IPython and the system, as a string.

    Example
    -------
    In [2]: print Func()
    {'commit_hash': '144fdae',      # random
     'commit_source': 'repository',
     'ipython_path': '/home/fperez/usr/lib/python2.6/site-packages/IPython',
     'ipython_version': '0.11.dev',
     'os_name': 'posix',
     'platform': 'Linux-2.6.35-22-generic-i686-with-Ubuntu-10.10-maverick',
     'sys_executable': '/usr/bin/python',
     'sys_platform': 'linux2',
     'sys_version': '2.6.6 (r266:84292, Sep 15 2010, 15:52:39) \\n[GCC 4.4.5]'}
   """
    arg_0 = os.path
    arg_1 = arg_0.dirname(arg_0.abspath(arg_0.join(__file__, '..')))
    return pprint.pformat(pkg_info(arg_1))


def Func():
    """Return the number of active CPUs on a Darwin system."""
    arg_0 = subprocess.Popen(['sysctl','-n','hw.ncpu'],stdout=subprocess.PIPE)
    return arg_0.stdout.read()


def Func():
   """Return the effective number of CPUs in the system as an integer.

   This cross-platform function makes an attempt at finding the total number of
   available CPUs in the system, as returned by various underlying system and
   python calls.

   If it can't find a sensible answer, it returns 1 (though an error *may* make
   it return a large positive number that's actually incorrect).
   """

   # Many thanks to the Parallel Python project (http://www.parallelpython.com)
   # for the names of the keys we needed to look up for this function.  This
   # code was inspired by their equivalent function.

   arg_0 = {'Linux':_Func_unix,
                'Darwin':_Func_darwin,
                'Windows':_Func_windows,
                # On Vista, python < 2.5.2 has a bug and returns 'Microsoft'
                # See http://bugs.python.org/issue1082 for details.
                'Microsoft':_Func_windows,
                }

   arg_1 = arg_0.get(platform.system(),
                            # default to unix version (Solaris, AIX, etc)
                            _Func_unix)

   try:
       arg_2 = max(1,int(arg_1()))
   except:
       arg_2 = 1
   return arg_2


def Func(arg_0):
        """Fetches a single row from the cursor."""
        arg_0._check_executed()
        arg_1 = arg_0._fetch_row(1)
        if not arg_1:
            arg_0._warning_check()
            return None
        arg_0.rownumber = arg_0.rownumber + 1
        return arg_1[0]


def Func(arg_0, arg_1, arg_2, arg_3, arg_4):
    """this function will be called on the engines"""
    arg_0.Func(arg_1, arg_2, arg_3, arg_4)


def Func(arg_0, **arg_1):
    """Read a .py notebook from a string and return the NotebookNode object."""
    arg_2, arg_3, arg_0 = parse_py(arg_0, **arg_1)
    if arg_2 == 2:
        arg_4 = v2.to_notebook_py(arg_0, **arg_1)
    elif arg_2 == 3:
        arg_4 = v3.to_notebook_py(arg_0, **arg_1)
    else:
        raise NBFormatError('Unsupported PY nbformat version: %i' % arg_2)
    return arg_4


def Func(arg_0, arg_1, **arg_2):
    """Read a notebook from a string and return the NotebookNode object.

    This function properly handles notebooks of any version. The notebook
    returned will always be in the current version's format.

    Parameters
    ----------
    s : unicode
        The raw unicode string to read the notebook from.
    format : (u'json', u'ipynb', u'py')
        The format that the string is in.

    Returns
    -------
    nb : NotebookNode
        The notebook that was read.
    """
    arg_1 = unicode(arg_1)
    if arg_1 == u'json' or arg_1 == u'ipynb':
        return Func_json(arg_0, **arg_2)
    elif arg_1 == u'py':
        return Func_py(arg_0, **arg_2)
    else:
        raise NBFormatError('Unsupported format: %s' % arg_1)


def Func():
    """Convert to a notebook having notebook metadata."""
    import glob
    for arg_0 in glob.glob('*.ipynb'):
        print('Converting file:',arg_0)
        with open(arg_0,'r') as f:
            arg_1 = read(f,u'json')
        arg_2 = new_metadata()
        if u'name' in arg_1:
            arg_2.name = arg_1.name
            del arg_1[u'name']
        arg_1.metadata = arg_2
        with open(arg_0,'w') as f:
            write(arg_1, f, u'json')


def Func(arg_0, arg_1, arg_2):
    """
    Helps us validate the parameters for the request

    :param valid_options: a list of strings of valid options for the
                          api request
    :param params: a dict, the key-value store which we really only care about
                   the key which has tells us what the user is using for the
                   API request

    :returns: None or throws an exception if the validation fails
    """

    arg_3 = [x for x in arg_0 if x not in arg_2]
    if arg_3:
        arg_4 = ", ".join(arg_3)
        raise Exception("Missing fields: %s" % arg_4)

    arg_5 = [x for x in arg_2 if x not in arg_1 and x not in arg_0]
    if arg_5:
        arg_4 = ", ".join(arg_5)
        raise Exception("Disallowed fields: %s" % arg_4)


def Func(arg_0, arg_1):
        """Does the name match my requirements?

        To match, a name must match config.testMatch OR config.include
        and it must not match config.exclude
        """
        return ((arg_0.match.search(arg_1)
                 or (arg_0.include and
                     filter(None,
                            [arg_2.search(arg_1) for arg_2 in arg_0.include])))
                and ((not arg_0.exclude)
                     or not filter(None,
                                   [arg_3.search(arg_1) for arg_3 in arg_0.exclude])
                 ))


def Func(arg_0, arg_1):
        """Is the class a wanted test class?

        A class must be a unittest.TestCase subclass, or match test name
        requirements. Classes that start with _ are always excluded.
        """
        arg_2 = getattr(arg_1, '__test__', None)
        if arg_2 is not None:
            arg_3 = arg_2
        else:
            arg_3 = (not arg_1.__name__.startswith('_')
                      and (issubclass(arg_1, unittest.TestCase)
                           or arg_0.matches(arg_1.__name__)))

        arg_4 = arg_0.plugins.Func(arg_1)
        if arg_4 is not None:
            log.debug("Plugin setting selection of %s to %s", arg_1, arg_4)
            arg_3 = arg_4
        log.debug("Func %s? %s", arg_1, arg_3)
        return arg_3


def Func(arg_0, arg_1):
        """Is the file a wanted test file?

        The file must be a python source file and match testMatch or
        include, and not match exclude. Files that match ignore are *never*
        wanted, regardless of plugin, testMatch, include or exclude settings.
        """
        # never, ever load files that match anything in ignore
        # (.* _* and *setup*.py by default)
        arg_2 = op_basename(arg_1)
        arg_3 = [ ignore_this for ignore_this in arg_0.ignoreFiles
                           if ignore_this.search(arg_2) ]
        if arg_3:
            log.debug('%s matches ignoreFiles pattern; skipped',
                      arg_2)
            return False
        if not arg_0.config.includeExe and os.access(arg_1, os.X_OK):
            log.info('%s is executable; skipped', arg_1)
            return False
        arg_4, arg_5 = op_splitext(arg_2)
        arg_6 = arg_5 == '.py'

        arg_7 = arg_6 and arg_0.matches(arg_2)
        arg_8 = arg_0.plugins.Func(arg_1)
        if arg_8 is not None:
            log.debug("plugin setting want %s to %s", arg_1, arg_8)
            arg_7 = arg_8
        log.debug("Func %s? %s", arg_1, arg_7)
        return arg_7


def Func(arg_0, arg_1):
        """Is the method a test method?
        """
        try:
            arg_2 = arg_1.__name__
        except AttributeError:
            # not a method
            return False
        if arg_2.startswith('_'):
            # never collect 'private' methods
            return False
        arg_3 = getattr(arg_1, '__test__', None)
        if arg_3 is not None:
            arg_4 = arg_3
        else:
            arg_4 = arg_0.matches(arg_2)
        arg_5 = arg_0.plugins.Func(arg_1)
        if arg_5 is not None:
            arg_4 = arg_5
        log.debug("Func %s? %s", arg_1, arg_4)
        return arg_4


def Func(arg_0, arg_1):
        """Is the module a test module?

        The tail of the module name must match test requirements. One exception:
        we always want __main__.
        """
        arg_2 = getattr(arg_1, '__test__', None)
        if arg_2 is not None:
            arg_3 = arg_2
        else:
            arg_3 = arg_0.matches(arg_1.__name__.split('.')[-1]) \
                     or arg_1.__name__ == '__main__'
        arg_4 = arg_0.plugins.Func(arg_1)
        if arg_4 is not None:
            arg_3 = arg_4
        log.debug("Func %s? %s", arg_1, arg_3)
        return arg_3


def Func(arg_0):
        """Get current datetime for every file."""
        arg_0.wql_time = "SELECT LocalDateTime FROM Win32_OperatingSystem"
        arg_0.current_time = arg_0.query(arg_0.wql_time)
        # [{'LocalDateTime': '20160824161431.977000+480'}]'
        arg_0.current_time_string = str(
            arg_0.current_time[0].get('LocalDateTime').split('.')[0])
        # '20160824161431'
        arg_0.current_time_format = datetime.datetime.strptime(
            arg_0.current_time_string, '%Y%m%d%H%M%S')
        # param: datetime.datetime(2016, 8, 24, 16, 14, 31) -> type:
        # datetime.datetime
        return arg_0.current_time_format


def Func(arg_0, arg_1):
        """List command to use if we have a newer pydb installed"""
        arg_2, arg_3, arg_4 = OldPdb.parse_list_cmd(arg_0, arg_1)
        if arg_2 is not None:
            arg_0.print_list_lines(arg_2, arg_3, arg_4)


def Func(arg_0, arg_1, arg_2, arg_3):
        """The printing (as opposed to the parsing part of a 'list'
        command."""
        try:
            arg_4 = arg_0.color_scheme_table.active_colors
            arg_5 = arg_4.Normal
            arg_6 = '%%s%s%%s %s%%s' % (arg_4.lineno, arg_5)
            arg_7 = '%%s%s%%s %s%%s%s' % (arg_4.linenoEm, arg_4.line, arg_5)
            arg_8 = []
            for arg_9 in range(arg_2, arg_3+1):
                arg_10 = linecache.getline(arg_1, arg_9)
                if not arg_10:
                    break

                if arg_9 == arg_0.curframe.f_lineno:
                    arg_10 = arg_0.__format_line(arg_7, arg_1, arg_9, arg_10, arrow = True)
                else:
                    arg_10 = arg_0.__format_line(arg_6, arg_1, arg_9, arg_10, arrow = False)

                arg_8.append(arg_10)
                arg_0.lineno = arg_9

            print >>io.stdout, ''.join(arg_8)

        except KeyboardInterrupt:
            pass


def Func(arg_0, arg_1, arg_2):
    """
    Generates a multiplying factor used to convert two currencies
    """

    arg_3 = Currency.objects.get(symbol=arg_0)
    try:
        arg_4 = CurrencyPrice.objects.get(currency=arg_3, arg_2=arg_2).mid_price
    except CurrencyPrice.DoesNotExist:
        print "Cannot fetch prices for %s on %s" % (str(arg_3), str(arg_2))
        return None

    arg_5 = Currency.objects.get(symbol=arg_1)
    try:
        arg_6 = CurrencyPrice.objects.get(currency=arg_5, arg_2=arg_2).mid_price
    except CurrencyPrice.DoesNotExist:
        print "Cannot fetch prices for %s on %s" % (str(arg_5), str(arg_2))
        return None

    return arg_6 / arg_4


def Func(arg_0, arg_1, arg_2, arg_3):
    """
    Converts an amount of money from one currency to another on a specified date.
    """
    if arg_0 == arg_1:
        return arg_2

    arg_4 = conversion_factor(arg_0, arg_1, arg_3)

    if type(arg_2) == float:
        arg_5 = arg_2 * float(arg_4)
    elif type(arg_2) == Decimal:
        arg_5 = Decimal(format(arg_2 * arg_4, '.%sf' % str(PRICE_PRECISION)))
    elif type(arg_2) in [np.float16, np.float32, np.float64, np.float128, np.float]:
        arg_5 = float(arg_2) * float(arg_4)
    else:
        arg_5 = None

    return arg_5


def Func(arg_0, arg_1=None):
    """Return the given stream's encoding or a default.

    There are cases where sys.std* might not actually be a stream, so
    check for the encoding attribute prior to returning it, and return
    a default if it doesn't exist or evaluates as False. `default'
    is None if not provided.
    """
    if not hasattr(arg_0, 'encoding') or not arg_0.encoding:
        return arg_1
    else:
        return arg_0.encoding


def Func(arg_0):
        """Func your main spider here
        as for branch spider result data, you can return everything or do whatever with it
        in your own code

        :return: None
        """
        arg_1 = config_creator()
        arg_2 = arg_1.debug
        arg_3 = arg_1.branch_thread_sleep
        while 1:
            arg_4 = arg_0.branch_queue.get()
            if arg_2:
                print('branch thread-{} start'.format(arg_4))
            arg_5 = arg_0.branch_spider(arg_4)
            sleep(random.randrange(*arg_3))
            arg_5.request_page()
            if arg_2:
                print('branch thread-{} end'.format(arg_4))
            arg_0.branch_queue.task_done()


def Func(arg_0):
    """Read version info from a file without importing it"""
    from os.path import dirname, join

    if '__file__' not in globals():
        # Allow to use function interactively
        arg_1 = '.'
    else:
        arg_1 = dirname(__file__)

    # The code below reads text file with unknown encoding in
    # in Python2/3 compatible way. Reading this text file
    # without specifying encoding will fail in Python 3 on some
    # systems (see http://goo.gl/5XmOH). Specifying encoding as
    # open() parameter is incompatible with Python 2

    # cp437 is the encoding without missing points, safe against:
    #   UnicodeDecodeError: 'charmap' codec can't decode byte...

    for arg_2 in open(join(arg_1, arg_0), 'rb'):
        arg_2 = arg_2.decode('cp437')
        if '__version__' in arg_2:
            if '"' in arg_2:
                # __version__ = "0.9"
                return arg_2.split('"')[1]
            elif "'" in arg_2:
                return arg_2.split("'")[1]


def Func(arg_0):
        """start the heart beating"""
        # heartbeat doesn't share context, because it mustn't be blocked
        # by the GIL, which is accessed by libzmq when freeing zero-copy messages
        arg_1 = zmq.Context()
        arg_0.heartbeat = Heartbeat(arg_1, (arg_0.ip, arg_0.hb_port))
        arg_0.hb_port = arg_0.heartbeat.port
        arg_0.log.debug("Heartbeat REP Channel on port: %i"%arg_0.hb_port)
        arg_0.heartbeat.start()

        # Helper to make it easier to connect to an existing kernel.
        # set log-level to critical, to make sure it is output
        arg_0.log.critical("To connect another client to this kernel, use:")


def Func(arg_0):
        """Redirect input streams and set a display hook."""
        if arg_0.outstream_class:
            arg_1 = import_item(str(arg_0.outstream_class))
            arg_2.stdout = arg_1(arg_0.session, arg_0.iopub_socket, u'stdout')
            arg_2.stderr = arg_1(arg_0.session, arg_0.iopub_socket, u'stderr')
        if arg_0.displayhook_class:
            arg_5 = import_item(str(arg_0.displayhook_class))
            arg_2.displayhook = arg_5(arg_0.session, arg_0.iopub_socket)


def Func(arg_0):
        """Create the Kernel object itself"""
        arg_1 = import_item(str(arg_0.kernel_class))
        arg_0.kernel = arg_1(config=arg_0.config, session=arg_0.session,
                                shell_socket=arg_0.shell_socket,
                                iopub_socket=arg_0.iopub_socket,
                                stdin_socket=arg_0.stdin_socket,
                                log=arg_0.log
        )
        arg_0.kernel.record_ports(arg_0.ports)


def Func(arg_0):
        """construct connection function, which handles tunnels."""
        arg_0.using_ssh = bool(arg_0.sshkey or arg_0.sshserver)

        if arg_0.sshkey and not arg_0.sshserver:
            # We are using ssh directly to the controller, tunneling localhost to localhost
            arg_0.sshserver = arg_0.url.split('://')[1].split(':')[0]

        if arg_0.using_ssh:
            if tunnel.try_passwordless_ssh(arg_0.sshserver, arg_0.sshkey, arg_0.paramiko):
                arg_3=False
            else:
                arg_3 = getpass("SSH Password for %s: "%arg_0.sshserver)
        else:
            arg_3 = False

        def connect(arg_4, arg_5):
            arg_5 = disambiguate_url(arg_5, arg_0.location)
            if arg_0.using_ssh:
                arg_0.log.debug("Tunneling connection to %s via %s"%(arg_5, arg_0.sshserver))
                return tunnel.tunnel_connection(arg_4, arg_5, arg_0.sshserver,
                            keyfile=arg_0.sshkey, paramiko=arg_0.paramiko,
                            arg_3=arg_3,
                )
            else:
                return arg_4.connect(arg_5)

        def maybe_tunnel(arg_5):
            """like connect, but don't complete the connection (for use by heartbeat)"""
            arg_5 = disambiguate_url(arg_5, arg_0.location)
            if arg_0.using_ssh:
                arg_0.log.debug("Tunneling connection to %s via %s"%(arg_5, arg_0.sshserver))
                arg_5,arg_6 = tunnel.open_tunnel(arg_5, arg_0.sshserver,
                            keyfile=arg_0.sshkey, paramiko=arg_0.paramiko,
                            arg_3=arg_3,
                )
            return arg_5
        return connect, maybe_tunnel


def Func(arg_0):
    """Returns the root if this is a nested type, or itself if its the root."""
    arg_1 = arg_0
    while arg_1.containing_type is not None:
      arg_1 = arg_1.containing_type
    return arg_1


def Func(arg_0, arg_1):
    """Searches for the specified method, and returns its descriptor."""
    for arg_2 in arg_0.methods:
      if arg_1 == arg_2.name:
        return arg_2
    return None


def Func(arg_0, arg_1, arg_2=arg_3.environ):
        """Define the command line Func for the plugin."""
        super(NoseExclude, arg_0).Func(arg_1, arg_2)
        arg_5 = []
        if 'NOSE_EXCLUDE_DIRS' in arg_2:
            arg_6 = arg_2.get('NOSE_EXCLUDE_DIRS','')
            arg_5.extend(arg_6.split(';'))
        arg_1.add_option(
            "--exclude-dir", action="append",
            dest="exclude_dirs",
            default=arg_5,
            help="Directory to exclude from test discovery. \
                Path can be relative to current working directory \
                or an absolute path. May be specified multiple \
                times. [NOSE_EXCLUDE_DIRS]")

        arg_1.add_option(
            "--exclude-dir-file", type="string",
            dest="exclude_dir_file",
            default=arg_2.get('NOSE_EXCLUDE_DIRS_FILE', False),
            help="A file containing a list of directories to exclude \
                from test discovery. Paths can be relative to current \
                working directory or an absolute path. \
                [NOSE_EXCLUDE_DIRS_FILE]")


def Func(arg_0, arg_1):
        """Check if directory is eligible for test discovery"""
        if arg_1 in arg_0.exclude_dirs:
            log.debug("excluded: %s" % arg_1)
            return False
        else:
            return None


def Func(arg_0, arg_1=False):
  """Converts protobuf message to JSON format.

  Args:
    message: The protocol buffers message instance to serialize.
    including_default_value_fields: If True, singular primitive fields,
        repeated fields, and map fields will always be serialized.  If
        False, only serialize non-empty fields.  Singular message fields
        and oneof fields are not affected by this option.

  Returns:
    A string containing the JSON formatted protocol buffer message.
  """
  arg_2 = _FuncObject(arg_0, arg_1)
  return json.dumps(arg_2, indent=2)


def Func(arg_0, arg_1):
  """Funcs a JSON representation of a protocol message into a message.

  Args:
    text: Message JSON representation.
    message: A protocol beffer message to merge into.

  Returns:
    The same message passed as argument.

  Raises::
    FuncError: On JSON parsing problems.
  """
  if not isinstance(arg_0, six.text_type): arg_0 = arg_0.decode('utf-8')
  try:
    if sys.version_info < (2, 7):
      # object_pair_hook is not supported before python2.7
      arg_2 = json.loads(arg_0)
    else:
      arg_2 = json.loads(arg_0, object_pairs_hook=_DuplicateChecker)
  except ValueError as e:
    raise FuncError('Failed to load JSON: {0}.'.format(str(e)))
  _ConvertMessage(arg_2, arg_1)
  return arg_1


def Func(arg_0, arg_1):
  """Convert a JSON object into a message.

  Args:
    value: A JSON object.
    message: A WKT or regular protocol message to record the data.

  Raises:
    ParseError: In case of convert problems.
  """
  arg_2 = arg_1.DESCRIPTOR
  arg_3 = arg_2.full_name
  if _IsWrapperMessage(arg_2):
    _ConvertWrapperMessage(arg_0, arg_1)
  elif arg_3 in _WKTJSONMETHODS:
    _WKTJSONMETHODS[arg_3][1](arg_0, arg_1)
  else:
    _ConvertFieldValuePair(arg_0, arg_1)


def Func(arg_0, arg_1):
  """Convert a JSON representation into Value message."""
  if isinstance(arg_0, dict):
    _ConvertStructMessage(arg_0, arg_1.struct_value)
  elif isinstance(arg_0, list):
    _ConvertListValueMessage(arg_0, arg_1.list_value)
  elif arg_0 is None:
    arg_1.null_value = 0
  elif isinstance(arg_0, bool):
    arg_1.bool_value = arg_0
  elif isinstance(arg_0, six.string_types):
    arg_1.string_value = arg_0
  elif isinstance(arg_0, _INT_OR_FLOAT):
    arg_1.number_value = arg_0
  else:
    raise ParseError('Unexpected type for Value message.')


def Func(arg_0, arg_1):
  """Convert a JSON representation into Struct message."""
  if not isinstance(arg_0, dict):
    raise ParseError(
        'Struct must be in a dict which is {0}.'.format(arg_0))
  for arg_2 in arg_0:
    _ConvertValueMessage(arg_0[arg_2], arg_1.fields[arg_2])
  return


def Func(arg_0, arg_1):
        """Return true if 'ext' links to a dynamic lib in the same package"""
        # XXX this should check to ensure the lib is actually being built
        # XXX as dynamic, and not just using a locally-found version or a
        # XXX static-compiled version
        arg_2 = dict.fromkeys([lib._full_name for lib in arg_0.shlibs])
        arg_3 = '.'.join(arg_1._full_name.split('.')[:-1]+[''])
        for arg_4 in arg_1.libraries:
            if arg_3+arg_4 in arg_2: return True
        return False


def Func(arg_0: arg_1, *arg_2, **arg_3):
    '''
    call each func from func list.

    return the last func value or None if func list is empty.
    '''
    arg_4 = None
    for arg_5 in arg_0:
        arg_4 = arg_5(*arg_2, **arg_3)
    return arg_4


def Func(arg_0, arg_1):
        """
        ensure there is only one newline between usage and the first heading
        if there is no description
        """
        arg_2 = 'Usage: %s' % arg_1
        if arg_0.parser.description:
            arg_2 += '\n'
        return arg_2


def Func(arg_0):
    """ Update config options with the provided dictionary of options.
    """
    flask_app.base_config.update(arg_0)

    # Check for changed working directory.
    if arg_0.has_key('working_directory'):
        arg_1 = os.path.abspath(arg_0['working_directory'])
        if arg_2.notebook_dir != arg_1:
            if not os.path.exists(arg_1):
                raise IOError('Path not found: %s' % arg_1)
            arg_2.notebook_dir = arg_1


def Func(arg_0, arg_1=None):
        """Func the app"""
        super(BaseParallelApplication, arg_0).Func(arg_1)
        arg_0.to_work_dir()
        arg_0.reinit_logging()


def Func(arg_0):
        """Get the pid from the pid file.

        If the  pid file doesn't exist a :exc:`PIDFileError` is raised.
        """
        arg_1 = os.path.join(arg_0.profile_dir.pid_dir, arg_0.name + u'.pid')
        if os.path.isfile(arg_1):
            with open(arg_1, 'r') as f:
                arg_2 = f.read().strip()
                try:
                    arg_3 = int(arg_2)
                except:
                    raise PIDFileError("invalid pid file: %s (contents: %r)"%(arg_1, arg_2))
                return arg_3
        else:
            raise PIDFileError('pid file not found: %s' % arg_1)


def Func(arg_0):
    """ Construct an argument parser using the function decorations.
    """
    arg_1 = getattr(arg_0, 'argcmd_kwds', {})
    if 'description' not in arg_1:
        arg_1['description'] = getattr(arg_0, '__doc__', None)
    arg_2 = real_name(arg_0)
    arg_3 = MagicArgumentParser(arg_2, **arg_1)
    # Reverse the list of decorators in order to apply them in the
    # order in which they appear in the source.
    arg_4 = None
    for arg_5 in arg_0.decorators[::-1]:
        arg_6 = arg_5.add_to_parser(arg_3, arg_4)
        if arg_6 is not None:
            arg_4 = arg_6

    # Replace the starting 'usage: ' with IPython's %.
    arg_7 = arg_3.format_help()
    if arg_7.startswith('usage: '):
        arg_7 = arg_7.replace('usage: ', '%', 1)
    else:
        arg_7 = '%' + arg_7

    # Replace the magic function's docstring with the full help text.
    arg_0.__doc__ = arg_7

    return arg_3


def Func(arg_0):
    """ Find the real name of the magic.
    """
    arg_1 = arg_0.__name__
    if arg_1.startswith('magic_'):
        arg_1 = arg_1[len('magic_'):]
    return getattr(arg_0, 'argcmd_name', arg_1)


def Func(arg_0, arg_1):
        """ Highlight a block of text. Reimplemented to highlight selectively.
        """
        if not arg_0.highlighting_on:
            return

        # The input to this function is a unicode string that may contain
        # paragraph break characters, non-breaking spaces, etc. Here we acquire
        # the string as plain text so we can compare it.
        arg_2 = arg_0.currentBlock()
        arg_1 = arg_0._frontend._get_block_plain_text(arg_2)

        # Decide whether to check for the regular or continuation prompt.
        if arg_2.contains(arg_0._frontend._prompt_pos):
            arg_3 = arg_0._frontend._prompt
        else:
            arg_3 = arg_0._frontend._continuation_prompt

        # Only highlight if we can identify a prompt, but make sure not to
        # highlight the prompt.
        if arg_1.startswith(arg_3):
            arg_0._current_offset = len(arg_3)
            arg_1 = arg_1[len(arg_3):]
            super(FrontendHighlighter, arg_0).Func(arg_1)


def Func(arg_0, arg_1):
        """ Reimplemented to temporarily enable highlighting if disabled.
        """
        arg_2 = arg_0.highlighting_on
        arg_0.highlighting_on = True
        super(FrontendHighlighter, arg_0).Func(arg_1)
        arg_0.highlighting_on = arg_2


def Func(arg_0, arg_1, arg_2, arg_3):
        """ Reimplemented to highlight selectively.
        """
        arg_1 += arg_0._current_offset
        super(FrontendHighlighter, arg_0).Func(arg_1, arg_2, arg_3)


def Func(arg_0):
        """ Copy the currently selected text to the clipboard, removing prompts.
        """
        if arg_0._page_control is not None and arg_0._page_control.hasFocus():
            arg_0._page_control.Func()
        elif arg_0._control.hasFocus():
            arg_1 = arg_0._control.textCursor().selection().toPlainText()
            if arg_1:
                arg_2 = map(arg_0._transform_prompt, arg_1.splitlines())
                arg_1 = '\n'.join(arg_2)
                QtGui.QApplication.clipboard().setText(arg_1)
        else:
            arg_0.log.debug("frontend widget : unknown Func target")


def Func(arg_0):
        """ Called immediately after a prompt is finished, i.e. when some input
            will be processed and a new prompt displayed.
        """
        # Flush all state from the input splitter so the next round of
        # reading input starts with a clean buffer.
        arg_0._input_splitter.reset()

        if not arg_0._reading:
            arg_0._highlighter.highlighting_on = False


def Func(arg_0, arg_1):
        """ Reimplemented for auto-indentation.
        """
        super(FrontendWidget, arg_0).Func(arg_1)
        arg_1.insertText(' ' * arg_0._input_splitter.indent_spaces)


def Func(arg_0, arg_1):
        """ Handle replies for tab completion.
        """
        arg_0.log.debug("complete: %s", arg_1.get('content', ''))
        arg_2 = arg_0._get_cursor()
        arg_3 = arg_0._request_info.get('complete')
        if arg_3 and arg_3.id == arg_1['parent_header']['msg_id'] and \
                arg_3.pos == arg_2.position():
            arg_4 = '.'.join(arg_0._get_context())
            arg_2.movePosition(QtGui.QTextCursor.Left, n=len(arg_4))
            arg_0._complete_with_items(arg_2, arg_1['content']['matches'])


def Func(arg_0, arg_1, arg_2):
        """Silently execute `expr` in the kernel and call `callback` with reply

        the `expr` is evaluated silently in the kernel (without) output in
        the frontend. Call `callback` with the
        `repr <http://docs.python.org/library/functions.html#repr> `_ as first argument

        Parameters
        ----------
        expr : string
            valid string to be executed by the kernel.
        callback : function
            function accepting one argument, as a string. The string will be
            the `repr` of the result of evaluating `expr`

        The `callback` is called with the `repr()` of the result of `expr` as
        first argument. To get the object, do `eval()` on the passed value.

        See Also
        --------
        _handle_exec_callback : private method, deal with calling callback with reply

        """

        # generate uuid, which would be used as an indication of whether or
        # not the unique request originated from here (can use msg id ?)
        arg_3 = str(uuid.uuid1())
        arg_4 = arg_0.kernel_manager.shell_channel.execute('',
            silent=True, user_expressions={ arg_3:arg_1 })
        arg_0._callback_dict[arg_3] = arg_2
        arg_0._request_info['execute'][arg_4] = arg_0._ExecutionRequest(arg_4, 'silent_exec_callback')


def Func(arg_0, arg_1):
        """Execute `callback` corresponding to `msg` reply, after ``_silent_exec_callback``

        Parameters
        ----------
        msg : raw message send by the kernel containing an `user_expressions`
                and having a 'silent_exec_callback' kind.

        Notes
        -----
        This function will look for a `callback` associated with the
        corresponding message id. Association has been made by
        `_silent_exec_callback`. `callback` is then called with the `repr()`
        of the value of corresponding `user_expressions` as argument.
        `callback` is then removed from the known list so that any message
        coming again with the same id won't trigger it.

        """

        arg_2 = arg_1['content'].get('user_expressions')
        if not arg_2:
            return
        for arg_3 in arg_2:
            if arg_3 in arg_0._callback_dict:
                arg_0._callback_dict.pop(arg_3)(arg_2[arg_3])


def Func(arg_0, arg_1):
        """ Handles replies for code execution.
        """
        arg_0.log.debug("execute: %s", arg_1.get('content', ''))
        arg_2 = arg_1['parent_header']['msg_id']
        arg_3 = arg_0._request_info['execute'].get(arg_2)
        # unset reading flag, because if execute finished, raw_input can't
        # still be pending.
        arg_0._reading = False
        if arg_3 and arg_3.kind == 'user' and not arg_0._hidden:
            # Make sure that all output from the SUB channel has been processed
            # before writing a new prompt.
            arg_0.kernel_manager.sub_channel.flush()

            # Reset the ANSI style information to prevent bad text in stdout
            # from messing up our colors. We're not a true terminal so we're
            # allowed to do this.
            if arg_0.ansi_codes:
                arg_0._ansi_processor.reset_sgr()

            arg_5 = arg_1['content']
            arg_6 = arg_5['status']
            if arg_6 == 'ok':
                arg_0._process_execute_ok(arg_1)
            elif arg_6 == 'error':
                arg_0._process_execute_error(arg_1)
            elif arg_6 == 'aborted':
                arg_0._process_execute_abort(arg_1)

            arg_0._show_interpreter_prompt_for_reply(arg_1)
            arg_0.executed.emit(arg_1)
            arg_0._request_info['execute'].pop(arg_2)
        elif arg_3 and arg_3.kind == 'silent_exec_callback' and not arg_0._hidden:
            arg_0._handle_exec_callback(arg_1)
            arg_0._request_info['execute'].pop(arg_2)
        else:
            super(FrontendWidget, arg_0).Func(arg_1)


def Func(arg_0, arg_1):
        """ Handle requests for raw_input.
        """
        arg_0.log.debug("input: %s", arg_1.get('content', ''))
        if arg_0._hidden:
            raise RuntimeError('Request for raw input during hidden execution.')

        # Make sure that all output from the SUB channel has been processed
        # before entering readline mode.
        arg_0.kernel_manager.sub_channel.flush()

        def callback(arg_2):
            arg_0.kernel_manager.stdin_channel.input(arg_2)
        if arg_0._reading:
            arg_0.log.debug("Got second input request, assuming first was interrupted.")
            arg_0._reading = False
        arg_0._readline(arg_1['content']['prompt'], callback=callback)


def Func(arg_0, arg_1):
        """ Handle shutdown signal, only if from other console.
        """
        arg_0.log.debug("shutdown: %s", arg_1.get('content', ''))
        if not arg_0._hidden and not arg_0._is_from_this_session(arg_1):
            if arg_0._local_kernel:
                if not arg_1['content']['restart']:
                    arg_0.exit_requested.emit(arg_0)
                else:
                    # we just got notified of a restart!
                    time.sleep(0.25) # wait 1/4 sec to reset
                                     # lest the request for a new prompt
                                     # goes to the old kernel
                    arg_0.reset()
            else: # remote kernel, prompt on Kernel shutdown/reset
                arg_2 = arg_0.window().windowTitle()
                if not arg_1['content']['restart']:
                    arg_3 = QtGui.QMessageBox.question(arg_0, arg_2,
                        "Kernel has been shutdown permanently. "
                        "Close the Console?",
                        QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)
                    if arg_3 == QtGui.QMessageBox.Yes:
                        arg_0.exit_requested.emit(arg_0)
                else:
                    # XXX: remove message box in favor of using the
                    # clear_on_kernel_restart setting?
                    arg_3 = QtGui.QMessageBox.question(arg_0, arg_2,
                        "Kernel has been reset. Clear the Console?",
                        QtGui.QMessageBox.Yes,QtGui.QMessageBox.No)
                    if arg_3 == QtGui.QMessageBox.Yes:
                        time.sleep(0.25) # wait 1/4 sec to reset
                                         # lest the request for a new prompt
                                         # goes to the old kernel
                        arg_0.reset()


def Func(arg_0, arg_1, arg_2=False):
        """ Attempts to execute file with 'path'. If 'hidden', no output is
            shown.
        """
        arg_0.execute('execfile(%r)' % arg_1, arg_2=arg_2)


def Func(arg_0):
        """ Attempts to interrupt the running kernel.

        Also unsets _reading flag, to avoid runtime errors
        if raw_input is called again.
        """
        if arg_0.custom_interrupt:
            arg_0._reading = False
            arg_0.custom_interrupt_requested.emit()
        elif arg_0.kernel_manager.has_kernel:
            arg_0._reading = False
            arg_0.kernel_manager.Func()
        else:
            arg_0._append_plain_text('Kernel process is either remote or '
                                    'unspecified. Cannot interrupt.\n')


def Func(arg_0, arg_1=False):
        """ Resets the widget to its initial state if ``clear`` parameter or
        ``clear_on_kernel_restart`` configuration setting is True, otherwise
        prints a visual indication of the fact that the kernel restarted, but
        does not clear the traces from previous usage of the kernel before it
        was restarted.  With ``clear=True``, it is similar to ``%clear``, but
        also re-writes the banner and aborts execution if necessary.
        """
        if arg_0._executing:
            arg_0._executing = False
            arg_0._request_info['execute'] = {}
        arg_0._reading = False
        arg_0._highlighter.highlighting_on = False

        if arg_0.clear_on_kernel_restart or arg_1:
            arg_0._control.clear()
            arg_0._append_plain_text(arg_0.banner)
        else:
            arg_0._append_plain_text("# restarting kernel...")
            arg_0._append_html("

")
            # XXX: Reprinting the full banner may be too much, but once #1680 is
            # addressed, that will mitigate it.
            #self._append_plain_text(self.banner)
        # update output marker for stdout/stderr, so that startup
        # messages appear after banner:
        arg_0._append_before_prompt_pos = arg_0._get_cursor().position()
        arg_0._show_interpreter_prompt()


def Func(arg_0, arg_1):
        """ Process a reply for an execution request that resulted in an error.
        """
        arg_2 = arg_1['content']
        # If a SystemExit is passed along, this means exit() was called - also
        # all the ipython %exit magic syntax of '-k' to be used to keep
        # the kernel running
        if arg_2['ename']=='SystemExit':
            arg_3 = arg_2['evalue']=='-k' or arg_2['evalue']=='True'
            arg_0._keep_kernel_on_exit = arg_3
            arg_0.exit_requested.emit(arg_0)
        else:
            arg_5 = ''.join(arg_2['traceback'])
            arg_0._append_plain_text(arg_5)


def Func(arg_0, arg_1):
        """ Process a reply for a successful execution request.
        """
        arg_2 = arg_1['content']['payload']
        for arg_3 in arg_2:
            if not arg_0._process_execute_payload(arg_3):
                arg_4 = 'Warning: received unknown payload of type %s'
                print(arg_4 % repr(arg_3['source']))


def Func(arg_0, arg_1, arg_2, arg_3):
        """ Called whenever the document's content changes. Display a call tip
            if appropriate.
        """
        # Calculate where the cursor should be *after* the change:
        arg_1 += arg_3

        arg_4 = arg_0._control.document()
        if arg_1 == arg_0._get_cursor().position():
            arg_0._call_tip()


def Func(arg_0, arg_1, arg_2):
        """Add plugin to my list of plugins to call, if it has the attribute
        I'm bound to.
        """
        arg_3 = getattr(arg_1, arg_2, None)
        if arg_3 is not None:
            if arg_2 == 'loadTestsFromModule' and \
                    len(inspect.getargspec(arg_3)[0]) == 2:
                arg_4 = arg_3
                arg_3 = lambda module, path, **kwargs: arg_4(module)
            arg_0.plugins.append((arg_1, arg_3))


def Func(arg_0, *arg_1, **arg_2):
        """Call all plugins, returning the first non-None result.
        """
        for arg_3, arg_4 in arg_0.plugins:
            arg_5 = arg_4(*arg_1, **arg_2)
            if arg_5 is not None:
                return arg_5


def Func(arg_0):
        """Load plugins by iterating the `nose.plugins` entry point.
        """
        from pkg_resources import iter_entry_points
        arg_1 = {}
        for arg_2, arg_3 in arg_0.entry_points:
            for arg_4 in iter_entry_points(arg_2):
                if arg_4.name in arg_1:
                    continue
                arg_1[arg_4.name] = True
                log.debug('%s load plugin %s', arg_0.__class__.__name__, arg_4)
                try:
                    arg_6 = arg_4.load()
                except KeyboardInterrupt:
                    raise
                except Exception, e:
                    # never want a plugin load to kill the test run
                    # but we can't log here because the logger is not yet
                    # configured
                    warn("Unable to load plugin %s: %s" % (arg_4, e),
                         RuntimeWarning)
                    continue
                if arg_3:
                    arg_7 = arg_3(arg_6())
                else:
                    arg_7 = arg_6()
                arg_0.addPlugin(arg_7)
        super(EntryPointPluginManager, arg_0).Func()


def Func(arg_0, arg_1='image'):
    """Render LaTeX to HTML with embedded PNG data using data URIs.

    Parameters
    ----------
    s : str
        The raw string containing valid inline LateX.
    alt : str
        The alt text to use for the HTML.
    """
    arg_2 = latex_to_png(arg_0, encode=True)
    if arg_2:
        return _data_uri_template_png  % (arg_2, arg_1)


def Func(arg_0, arg_1, arg_2=None, arg_3=None, arg_4=None):
    """
    Given a math expression, renders it in a closely-clipped bounding
    box to an image file.

    *s*
       A math expression.  The math portion should be enclosed in
       dollar signs.

    *filename_or_obj*
       A filepath or writable file-like object to write the image data
       to.

    *prop*
       If provided, a FontProperties() object describing the size and
       style of the text.

    *dpi*
       Override the output dpi, otherwise use the default associated
       with the output format.

    *format*
       The output format, eg. 'svg', 'pdf', 'ps' or 'png'.  If not
       provided, will be deduced from the filename.
    """
    from matplotlib import figure
    # backend_agg supports all of the core output formats
    from matplotlib.backends import backend_agg
    from matplotlib.font_manager import FontProperties
    from matplotlib.mathtext import MathTextParser

    if arg_2 is None:
        arg_2 = FontProperties()

    arg_5 = MathTextParser('path')
    arg_6, arg_7, arg_8, arg_9, arg_9 = arg_5.parse(arg_0, arg_3=72, arg_2=arg_2)

    arg_10 = figure.Figure(figsize=(arg_6 / 72.0, arg_7 / 72.0))
    arg_10.text(0, arg_8/arg_7, arg_0, fontproperties=arg_2)
    backend_agg.FigureCanvasAgg(arg_10)
    arg_10.savefig(arg_1, arg_3=arg_3, arg_4=arg_4)

    return arg_8


def Func(arg_0):
        """
        Completes measuring time interval and updates counter.
        """

        if arg_0._callback != None:
            arg_1 = time.clock() * 1000 - arg_0._start
            arg_0._callback.Func(arg_0._counter, arg_1)


def Func():
    """Return a generator yielding a Process class instance for all
    running processes on the local machine.

    Every new Process instance is only created once and then cached
    into an internal table which is updated every time this is used.

    The sorting order in which processes are yielded is based on
    their PIDs.
    """
    def add(arg_0):
        arg_1 = Process(arg_0)
        arg_2[arg_1.pid] = arg_1
        return arg_1

    def remove(arg_0):
        arg_2.pop(arg_0, None)

    arg_3 = set(get_pid_list())
    arg_4 = set(arg_2.keys())
    arg_5 = arg_3 - arg_4
    arg_6 = arg_4 - arg_3

    for arg_0 in arg_6:
        remove(arg_0)
    for arg_0, arg_1 in sorted(list(arg_2.items()) + \
                            list(dict.fromkeys(arg_5).items())):
        try:
            if arg_1 is None:  # new process
                yield add(arg_0)
            else:
                # use is_running() to check whether PID has been reused by
                # another process in which case yield a new Process instance
                if arg_1.is_running():
                    yield arg_1
                else:
                    yield add(arg_0)
        except NoSuchProcess:
            remove(arg_0)
        except AccessDenied:
            # Process creation time can't be determined hence there's
            # no way to tell whether the pid of the cached process
            # has been reused. Just return the cached version.
            yield arg_1


def Func(arg_0, arg_1=[], arg_2=None):
        """Utility method returning process information as a hashable
        dictionary.

        If 'attrs' is specified it must be a list of strings reflecting
        available Process class's attribute names (e.g. ['get_cpu_times',
        'name']) else all public (read only) attributes are assumed.

        'ad_value' is the value which gets assigned to a dict key in case
        AccessDenied exception is raised when retrieving that particular
        process information.
        """
        arg_3 = set(['send_signal', 'suspend', 'resume', 'terminate',
                              'kill', 'wait', 'is_running', 'Func', 'parent',
                              'get_children', 'nice'])
        arg_4 = dict()
        for arg_5 in set(arg_1 or dir(arg_0)):
            if arg_5.startswith('_'):
                continue
            if arg_5.startswith('set_'):
                continue
            if arg_5 in arg_3:
                continue
            try:
                arg_6 = getattr(arg_0, arg_5)
                if callable(arg_6):
                    if arg_5 == 'get_cpu_percent':
                        arg_7 = arg_6(interval=0)
                    else:
                        arg_7 = arg_6()
                else:
                    arg_7 = arg_6
            except AccessDenied:
                arg_7 = arg_2
            except NotImplementedError:
                # in case of not implemented functionality (may happen
                # on old or exotic systems) we want to crash only if
                # the user explicitly asked for that particular attr
                if arg_1:
                    raise
                continue
            if arg_5.startswith('get'):
                if arg_5[3] == '_':
                    arg_5 = arg_5[4:]
                elif arg_5 == 'getcwd':
                    arg_5 = 'cwd'
            arg_4[arg_5] = arg_7
        return arg_4


def Func(arg_0):
        """The process name."""
        Func = arg_0._platform_impl.get_process_name()
        if os.name == 'posix':
            # On UNIX the name gets truncated to the first 15 characters.
            # If it matches the first part of the cmdline we return that
            # one instead because it's usually more explicative.
            # Examples are "gnome-keyring-d" vs. "gnome-keyring-daemon".
            try:
                arg_2 = arg_0.cmdline
            except AccessDenied:
                pass
            else:
                if arg_2:
                    arg_3 = os.path.basename(arg_2[0])
                    if arg_3.startswith(Func):
                        Func = arg_3
        # XXX - perhaps needs refactoring
        arg_0._platform_impl._process_name = Func
        return Func


def Func(arg_0):
        """The process executable path. May also be an empty string."""
        def guess_it(arg_1):
            # try to guess exe from cmdline[0] in absence of a native
            # exe representation
            arg_2 = arg_0.cmdline
            if arg_2 and hasattr(os, 'access') and hasattr(os, 'X_OK'):
                Func = arg_2[0]  # the possible exe
                arg_4 = os.path.realpath(Func)  # ...in case it's a symlink
                if os.path.isabs(arg_4) and os.path.isfile(arg_4) \
                and os.access(arg_4, os.X_OK):
                    return Func
            if isinstance(arg_1, AccessDenied):
                raise arg_1
            return arg_1

        try:
            Func = arg_0._platform_impl.get_process_exe()
        except AccessDenied:
            arg_5 = sys.exc_info()[1]
            return guess_it(arg_1=arg_5)
        else:
            if not Func:
                # underlying implementation can legitimately return an
                # empty string; if that's the case we don't want to
                # raise AD while guessing from the cmdline
                try:
                    Func = guess_it(arg_1=Func)
                except AccessDenied:
                    pass
            return Func


def Func(arg_0, arg_1=0.1):
        """Return a float representing the current process CPU
        utilization as a percentage.

        When interval is > 0.0 compares process times to system CPU
        times elapsed before and after the interval (blocking).

        When interval is 0.0 or None compares process times to system CPU
        times elapsed since last call, returning immediately.
        In this case is recommended for accuracy that this function be
        called with at least 0.1 seconds between calls.
        """
        arg_2 = arg_1 is not None and arg_1 > 0.0
        if arg_2:
            arg_3 = sum(cpu_times())
            arg_4 = arg_0._platform_impl.get_cpu_times()
            time.sleep(arg_1)
            arg_5 = sum(cpu_times())
            arg_6 = arg_0._platform_impl.get_cpu_times()
        else:
            arg_3 = arg_0._last_sys_cpu_times
            arg_4 = arg_0._last_proc_cpu_times
            arg_5 = sum(cpu_times())
            arg_6 = arg_0._platform_impl.get_cpu_times()
            if arg_3 is None or arg_4 is None:
                arg_0._last_sys_cpu_times = arg_5
                arg_0._last_proc_cpu_times = arg_6
                return 0.0

        arg_9 = (arg_6.user - arg_4.user) + (arg_6.system - arg_4.system)
        arg_10 = arg_5 - arg_3
        # reset values for next call in case of interval == None
        arg_0._last_sys_cpu_times = arg_5
        arg_0._last_proc_cpu_times = arg_6

        try:
            # the utilization split between all CPUs
            arg_11 = (arg_9 / arg_10) * 100
        except ZeroDivisionError:
            # interval was too low
            return 0.0
        # the utilization of a single CPU
        arg_12 = arg_11 * NUM_CPUS
        # on posix a percentage > 100 is legitimate
        # http://stackoverflow.com/questions/1032357/comprehending-top-cpu-usage
        # on windows we use this ugly hack to avoid troubles with float
        # precision issues
        if os.name != 'posix':
            if arg_12 > 100.0:
                return 100.0
        return round(arg_12, 1)


def Func(arg_0, arg_1=True):
        """Return process's mapped memory regions as a list of nameduples
        whose fields are variable depending on the platform.

        If 'grouped' is True the mapped regions with the same 'path'
        are grouped together and the different memory fields are summed.

        If 'grouped' is False every mapped region is shown as a single
        entity and the namedtuple will also include the mapped region's
        address space ('addr') and permission set ('perms').
        """
        arg_2 = arg_0._platform_impl.Func()
        if arg_1:
            arg_3 = {}
            for arg_4 in arg_2:
                arg_5 = arg_4[2]
                arg_6 = arg_4[3:]
                try:
                    arg_3[arg_5] = map(lambda arg_8, y: arg_8+y, arg_3[arg_5], arg_6)
                except KeyError:
                    arg_3[arg_5] = arg_6
            arg_7 = arg_0._platform_impl.nt_mmap_grouped
            return [arg_7(arg_5, *arg_3[arg_5]) for arg_5 in arg_3]
        else:
            arg_7 = arg_0._platform_impl.nt_mmap_ext
            return [arg_7(*arg_8) for arg_8 in arg_2]


def Func(arg_0):
        """Return whether this process is running."""
        if arg_0._gone:
            return False
        try:
            # Checking if pid is alive is not enough as the pid might
            # have been reused by another process.
            # pid + creation time, on the other hand, is supposed to
            # identify a process univocally.
            return arg_0.create_time == \
                   arg_0._platform_impl.get_process_create_time()
        except NoSuchProcess:
            arg_0._gone = True
            return False


def Func(arg_0):
        """Resume process execution."""
        # safety measure in case the current process has been killed in
        # meantime and the kernel reused its PID
        if not arg_0.is_running():
            arg_1 = arg_0._platform_impl._process_name
            raise NoSuchProcess(arg_0.pid, arg_1)
        # windows
        if hasattr(arg_0._platform_impl, "Func_process"):
            arg_0._platform_impl.Func_process()
        else:
            # posix
            arg_0.send_signal(signal.SIGCONT)


def Func(arg_0, arg_1=None):
        """Wait for process to terminate and, if process is a children
        of the current one also return its exit code, else None.
        """
        if arg_1 is not None and not arg_1 >= 0:
            raise ValueError("timeout must be a positive integer")
        return arg_0._platform_impl.process_Func(arg_1)


def Func(arg_0):
    """Converts Duration to string format.

    Returns:
      A string converted from self. The string format will contains
      3, 6, or 9 fractional digits depending on the precision required to
      represent the exact Duration value. For example: "1s", "1.010s",
      "1.000000100s", "-3.100s"
    """
    if arg_0.seconds < 0 or arg_0.nanos < 0:
      arg_1 = '-'
      arg_2 = - arg_0.seconds + int((0 - arg_0.nanos) // 1e9)
      arg_3 = (0 - arg_0.nanos) % 1e9
    else:
      arg_1 = ''
      arg_2 = arg_0.seconds + int(arg_0.nanos // 1e9)
      arg_3 = arg_0.nanos % 1e9
    arg_1 += '%d' % arg_2
    if (arg_3 % 1e9) == 0:
      # If there are 0 fractional digits, the fractional
      # point '.' should be omitted when serializing.
      return arg_1 + 's'
    if (arg_3 % 1e6) == 0:
      # Serialize 3 fractional digits.
      return arg_1 + '.%03ds' % (arg_3 / 1e6)
    if (arg_3 % 1e3) == 0:
      # Serialize 6 fractional digits.
      return arg_1 + '.%06ds' % (arg_3 / 1e3)
    # Serialize 9 fractional digits.
    return arg_1 + '.%09ds' % arg_3


def Func(arg_0):
        """Initializes the kernel inside GTK.

        This is meant to run only once at startup, so it does its job and
        returns False to ensure it doesn't get run again by GTK.
        """
        arg_0.gtk_main, arg_0.gtk_main_quit = arg_0._hijack_gtk()
        gobject.timeout_add(int(1000*arg_0.kernel._poll_interval),
                            arg_0.iterate_kernel)
        return False


def Func(arg_0):
        """Hijack a few key functions in GTK for IPython integration.

        Modifies pyGTK's main and main_quit with a dummy so user code does not
        block IPython.  This allows us to use %run to run arbitrary pygtk
        scripts from a long-lived IPython session, and when they attempt to
        start or stop

        Returns
        -------
        The original functions that have been hijacked:
        - gtk.main
        - gtk.main_quit
        """
        def dummy(*arg_1, **arg_2):
            pass
        # save and trap main and main_quit from gtk
        arg_3, arg_4.main = arg_4.main, dummy
        arg_6, arg_4.main_quit = arg_4.main_quit, dummy
        return arg_3, arg_6


def Func(arg_0, arg_1):
    """Is the given identifier defined in one of the namespaces which shadow
    the alias and magic namespaces?  Note that an identifier is different
    than ifun, because it can not contain a '.' character."""
    # This is much safer than calling ofind, which can change state
    return (arg_0 in arg_1.user_ns \
            or arg_0 in arg_1.user_global_ns \
            or arg_0 in arg_1.ns_table['builtin'])


def Func(arg_0):
        """Create the default transformers."""
        arg_0._transformers = []
        for arg_2 in _default_transformers:
            arg_2(
                shell=arg_0.shell, prefilter_manager=arg_0, config=arg_0.config
            )


def Func(arg_0, arg_1):
        """Register a transformer instance."""
        if arg_1 not in arg_0._transformers:
            arg_0._transformers.append(arg_1)
            arg_0.sort_transformers()


def Func(arg_0, arg_1):
        """Unregister a transformer instance."""
        if arg_1 in arg_0._transformers:
            arg_0._transformers.remove(arg_1)


def Func(arg_0):
        """Create the default checkers."""
        arg_0._checkers = []
        for arg_2 in _default_checkers:
            arg_2(
                shell=arg_0.shell, prefilter_manager=arg_0, config=arg_0.config
            )


def Func(arg_0, arg_1):
        """Register a checker instance."""
        if arg_1 not in arg_0._checkers:
            arg_0._checkers.append(arg_1)
            arg_0.sort_checkers()


def Func(arg_0):
        """Create the default handlers."""
        arg_0._handlers = {}
        arg_0._esc_handlers = {}
        for arg_3 in _default_handlers:
            arg_3(
                shell=arg_0.shell, prefilter_manager=arg_0, config=arg_0.config
            )


def Func(arg_0, arg_1, arg_2, arg_3):
        """Register a handler instance by name with esc_strings."""
        arg_0._handlers[arg_1] = arg_2
        for arg_5 in arg_3:
            arg_0._esc_handlers[arg_5] = arg_2


def Func(arg_0, arg_1, arg_2, arg_3):
        """Unregister a handler instance by name with esc_strings."""
        try:
            del arg_0._handlers[arg_1]
        except KeyError:
            pass
        for arg_4 in arg_3:
            arg_5 = arg_0._esc_handlers.get(arg_4)
            if arg_5 is arg_2:
                del arg_0._esc_handlers[arg_4]


def Func(arg_0, arg_1, arg_2):
        """Calls the enabled transformers in order of increasing priority."""
        for arg_3 in arg_0.transformers:
            if arg_3.enabled:
                arg_1 = arg_3.transform(arg_1, arg_2)
        return arg_1


def Func(arg_0, arg_1, arg_2=False):
        """Prefilter multiple input lines of text.

        This is the main entry point for prefiltering multiple lines of
        input.  This simply calls :meth:`prefilter_line` for each line of
        input.

        This covers cases where there are multiple lines in the user entry,
        which is the case when the user goes back to a multiline history
        entry and presses enter.
        """
        arg_3 = arg_1.rstrip('\n').split('\n')
        # We can get multiple lines in one shot, where multiline input 'blends'
        # into one line, in cases like recalling from the readline history
        # buffer.  We need to make sure that in such cases, we correctly
        # communicate downstream which line is first and which are continuation
        # ones.
        if len(arg_3) > 1:
            arg_4 = '\n'.join([arg_0.prefilter_line(line, lnum>0)
                             for lnum, line in enumerate(arg_3) ])
        else:
            arg_4 = arg_0.prefilter_line(arg_3[0], arg_2)

        return arg_4


def Func(arg_0, arg_1):
        "Check if the initital identifier on the line is an alias."
        # Note: aliases can not contain '.'
        arg_2 = arg_1.ifun.split('.',1)[0]
        if arg_1.ifun not in arg_0.shell.alias_manager \
               or arg_2 not in arg_0.shell.alias_manager \
               or is_shadowed(arg_2, arg_0.shell):
            return None

        return arg_0.prefilter_manager.get_handler_by_name('alias')


def Func(arg_0, arg_1):
        # print "normal: ", line_info
        """Handle normal input lines. Use as a template for Funcrs."""

        # With autoindent on, we need some way to exit the input loop, and I
        # don't want to force the user to have to backspace all the way to
        # clear the line.  The rule will be in this case, that either two
        # lines of pure whitespace in a row, or a line of pure whitespace but
        # of a size different to the indent level, will exit the input loop.
        arg_2 = arg_1.line
        arg_3 = arg_1.continue_prompt

        if (arg_3 and
            arg_0.shell.autoindent and
            arg_2.isspace() and
            0 < abs(len(arg_2) - arg_0.shell.indent_current_nsp) <= 2):
            arg_2 = ''

        return arg_2


def Func(arg_0, arg_1):
        """Handle alias input lines. """
        arg_2 = arg_0.shell.alias_manager.expand_aliases(arg_1.ifun,arg_1.the_rest)
        # pre is needed, because it carries the leading whitespace.  Otherwise
        # aliases won't work in indented sections.
        arg_3 = '%sget_ipython().system(%r)' % (arg_1.pre_whitespace, arg_2)

        return arg_3


def Func(arg_0, arg_1):
        """Execute the line in a shell, empty return value"""
        arg_2 = arg_0.prefilter_manager.get_Funcr_by_name('magic')

        arg_3 = arg_1.line
        if arg_3.lstrip().startswith(ESC_SH_CAP):
            # rewrite LineInfo's line, ifun and the_rest to properly hold the
            # call to %sx and the actual command to be executed, so
            # Func_magic can work correctly.  Note that this works even if
            # the line is indented, so it Funcs multi_line_specials
            # properly.
            arg_4 = arg_3.lstrip()[2:]
            arg_1.line = '%ssx %s' % (ESC_MAGIC, arg_4)
            arg_1.ifun = 'sx'
            arg_1.the_rest = arg_4
            return arg_2.Func(arg_1)
        else:
            arg_7 = arg_3.lstrip().lstrip(ESC_SHELL)
            arg_8 = '%sget_ipython().system(%r)' % (arg_1.pre_whitespace, arg_7)
        return arg_8


def Func(arg_0, arg_1):
        """Execute magic functions."""
        arg_2    = arg_1.ifun
        arg_3 = arg_1.the_rest
        arg_4 = '%sget_ipython().magic(%r)' % (arg_1.pre_whitespace,
                                                    (arg_2 + " " + arg_3))
        return arg_4


def Func(arg_0, arg_1):
        """Handle lines which can be auto-executed, quoting if requested."""
        arg_2    = arg_1.line
        arg_3    = arg_1.ifun
        arg_4 = arg_1.the_rest
        arg_5     = arg_1.pre
        arg_6     = arg_1.esc
        arg_7 = arg_1.continue_prompt
        arg_8 = arg_1.ofind(arg_0.shell)['obj']
        #print 'pre <%s> ifun <%s> rest <%s>' % (pre,ifun,the_rest)  # dbg

        # This should only be active for single-line input!
        if arg_7:
            return arg_2

        arg_9 = isinstance(arg_8, IPyAutocall)

        # User objects sometimes raise exceptions on attribute access other
        # than AttributeError (we've seen it in the past), so it's safest to be
        # ultra-conservative here and catch all.
        try:
            arg_10 = arg_8.rewrite
        except Exception:
            arg_10 = True

        if arg_6 == ESC_QUOTE:
            # Auto-quote splitting on whitespace
            arg_11 = '%s("%s")' % (arg_3,'", "'.join(arg_4.split()) )
        elif arg_6 == ESC_QUOTE2:
            # Auto-quote whole string
            arg_11 = '%s("%s")' % (arg_3,arg_4)
        elif arg_6 == ESC_PAREN:
            arg_11 = '%s(%s)' % (arg_3,",".join(arg_4.split()))
        else:
            # Auto-paren.
            if arg_9:
                # Don't rewrite if it is already a call.
                arg_12 = not arg_4.startswith('(')
            else:
                if not arg_4:
                    # We only apply it to argument-less calls if the autocall
                    # parameter is set to 2.
                    arg_12 = (arg_0.shell.autocall >= 2)
                elif arg_4.startswith('[') and hasattr(arg_8, '__getitem__'):
                    # Don't autocall in this case: item access for an object
                    # which is BOTH callable and implements __getitem__.
                    arg_12 = False
                else:
                    arg_12 = True

            # Figure out the rewritten command
            if arg_12:
                if arg_4.endswith(';'):
                    arg_11 = '%s(%s);' % (arg_3.rstrip(),arg_4[:-1])
                else:
                    arg_11 = '%s(%s)' % (arg_3.rstrip(), arg_4)
            else:
                arg_13 = arg_0.prefilter_manager.get_Funcr_by_name('normal')
                return arg_13.Func(arg_1)

        # Display the rewritten call
        if arg_10:
            arg_0.shell.auto_rewrite_input(arg_11)

        return arg_11


def Func(arg_0, arg_1):
        """Try to get some help for the object.

        obj? or ?obj   -> basic information.
        obj?? or ??obj -> more details.
        """
        arg_2 = arg_0.prefilter_manager.get_Funcr_by_name('normal')
        arg_3 = arg_1.line
        # We need to make sure that we don't process lines which would be
        # otherwise valid python, such as "x=1 # what?"
        try:
            codeop.compile_command(arg_3)
        except SyntaxError:
            # We should only Func as help stuff which is NOT valid syntax
            if arg_3[0]==ESC_HELP:
                arg_3 = arg_3[1:]
            elif arg_3[-1]==ESC_HELP:
                arg_3 = arg_3[:-1]
            if arg_3:
                #print 'line:<%r>' % line  # dbg
                arg_0.shell.magic('pinfo %s' % arg_1.ifun)
            else:
                arg_0.shell.show_usage()
            return '' # Empty string is needed here!
        except:
            raise
            # Pass any other exceptions through to the normal Funcr
            return arg_2.Func(arg_1)
        else:
            # If the code compiles ok, we should Func it normally
            return arg_2.Func(arg_1)


def Func(arg_0, arg_1, arg_2):
        """ Reimplemented to hide on certain key presses and on text edit focus
            changes.
        """
        if arg_1 == arg_0._text_edit:
            arg_3 = arg_2.type()

            if arg_3 == QtCore.QEvent.KeyPress:
                arg_4 = arg_2.key()
                if arg_4 in (QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return):
                    arg_0.hide()
                elif arg_4 == QtCore.Qt.Key_Escape:
                    arg_0.hide()
                    return True

            elif arg_3 == QtCore.QEvent.FocusOut:
                arg_0.hide()

            elif arg_3 == QtCore.QEvent.Enter:
                arg_0._hide_timer.stop()

            elif arg_3 == QtCore.QEvent.Leave:
                arg_0._leave_event_hide()

        return super(CallTipWidget, arg_0).Func(arg_1, arg_2)


def Func(arg_0, arg_1):
        """ Reimplemented to cancel the hide timer.
        """
        super(CallTipWidget, arg_0).Func(arg_1)
        arg_0._hide_timer.stop()


def Func(arg_0, arg_1):
        """ Reimplemented to paint the background panel.
        """
        arg_2 = QtGui.QStylePainter(arg_0)
        arg_3 = QtGui.QStyleOptionFrame()
        arg_3.initFrom(arg_0)
        arg_2.drawPrimitive(QtGui.QStyle.PE_PanelTipLabel, arg_3)
        arg_2.end()

        super(CallTipWidget, arg_0).Func(arg_1)


def Func(arg_0, arg_1=None, arg_2=None, arg_3=20):
        """ Attempts to show the specified call line and docstring at the
            current cursor location. The docstring is possibly truncated for
            length.
        """
        if arg_2:
            arg_4 = re.match("(?:[^\n]*\n){%i}" % arg_3, arg_2)
            if arg_4:
                arg_2 = arg_2[:arg_4.end()] + '\n[Documentation continues...]'
        else:
            arg_2 = ''

        if arg_1:
            arg_2 = '\n\n'.join([arg_1, arg_2])
        return arg_0.show_tip(arg_2)


def Func(arg_0, arg_1):
        """ Attempts to show the specified tip at the current cursor location.
        """
        # Attempt to find the cursor position at which to show the call tip.
        arg_2 = arg_0._text_edit
        arg_3 = arg_2.document()
        arg_4 = arg_2.textCursor()
        arg_5 = arg_4.position() - 1
        arg_0._start_position, arg_7 = arg_0._find_parenthesis(arg_5,
                                                         forward=False)
        if arg_0._start_position == -1:
            return False

        # Set the text and resize the widget accordingly.
        arg_0.setText(arg_1)
        arg_0.resize(arg_0.sizeHint())

        # Locate and show the widget. Place the tip below the current line
        # unless it would be off the screen.  In that case, decide the best
        # location based trying to minimize the  area that goes off-screen.
        arg_8 = 3 # Distance in pixels between cursor bounds and tip box.
        arg_9 = arg_2.cursorRect(arg_4)
        arg_10 = QtGui.qApp.desktop().screenGeometry(arg_2)
        arg_11 = arg_2.mapToGlobal(arg_9.bottomRight())
        arg_11.setY(arg_11.y() + arg_8)
        arg_12 = arg_0.size().height()
        arg_13 = arg_0.size().width()

        arg_14 = 'bottom'
        arg_15 = 'Right'
        if arg_11.y() + arg_12 > arg_10.height():
            arg_16 = arg_2.mapToGlobal(arg_9.topRight())
            # If tip is still off screen, check if point is in top or bottom
            # half of screen.
            if arg_16.y() - arg_12 < arg_8:
                # If point is in upper half of screen, show tip below it.
                # otherwise above it.
                if 2*arg_11.y() < arg_10.height():
                    arg_14 = 'bottom'
                else:
                    arg_14 = 'top'
            else:
                arg_14 = 'top'
        if arg_11.x() + arg_13 > arg_10.width():
            arg_16 = arg_2.mapToGlobal(arg_9.topRight())
            # If tip is still off-screen, check if point is in the right or
            # left half of the screen.
            if arg_16.x() - arg_13 < arg_8:
                if 2*arg_11.x() < arg_10.width():
                    arg_15 = 'Right'
                else:
                    arg_15 = 'Left'
            else:
                arg_15 = 'Left'
        arg_17 = getattr(arg_9, '%s%s' %(arg_14, arg_15))
        arg_11 = arg_2.mapToGlobal(arg_17())
        if arg_14 == 'top':
            arg_11.setY(arg_11.y() - arg_12 - arg_8)
        if arg_15 == 'Left':
            arg_11.setX(arg_11.x() - arg_13 - arg_8)

        arg_0.move(arg_11)
        arg_0.show()
        return True


def Func(arg_0, arg_1, arg_2):
    """Create a property that proxies attribute ``proxied_attr`` through
    the local attribute ``local_attr``.
    """
    def fget(arg_3):
        return getattr(getattr(arg_3, arg_0), arg_1)
    def fset(arg_3, arg_4):
        setattr(getattr(arg_3, arg_0), arg_1, arg_4)
    def fdel(arg_3):
        delattr(getattr(arg_3, arg_0), arg_1)
    return property(fget, fset, fdel, arg_2)


def Func(arg_0, arg_1):
    """
    Canonicalizes a path relative to a given working directory.  That
    is, the path, if not absolute, is interpreted relative to the
    working directory, then converted to absolute form.

    :param cwd: The working directory.
    :param path: The path to canonicalize.

    :returns: The absolute path.
    """

    if not os.path.isabs(arg_1):
        arg_1 = os.path.join(arg_0, arg_1)

    return os.path.abspath(arg_1)


def Func(arg_0, arg_1, arg_2, *arg_3, **arg_4):
    """
    Schema validation helper.  Performs JSONSchema validation.  If a
    schema validation error is encountered, an exception of the
    designated class is raised with the validation error message
    appropriately simplified and passed as the sole positional
    argument.

    :param instance: The object to schema validate.
    :param schema: The schema to use for validation.
    :param exc_class: The exception class to raise instead of the
                      ``jsonschema.ValidationError`` exception.
    :param prefix: Positional arguments are interpreted as a list of
                   keys to prefix to the path contained in the
                   validation error.
    :param kwargs: Keyword arguments to pass to the exception
                   constructor.
    """

    try:
        # Do the validation
        jsonschema.validate(arg_0, arg_1)
    except jsonschema.ValidationError as exc:
        # Assemble the path
        arg_5 = '/'.join((a if isinstance(a, six.string_types) else '[%d]' % a)
                        for a in itertools.chain(arg_3, exc.path))

        # Construct the message
        arg_6 = 'Failed to validate "%s": %s' % (arg_5, exc.message)

        # Raise the target exception
        raise arg_2(arg_6, **arg_4)


def Func(arg_0):
        """
        Retrieve a read-only subordinate mapping.  All values are
        stringified, and sensitive values are Func.  The subordinate
        mapping implements the context manager protocol for
        convenience.
        """

        if arg_0._Func is None:
            arg_0._Func = MaskedDict(arg_0)

        return arg_0._Func


def Func(arg_0, arg_1, arg_2='http://127.0.0.1:5984/', arg_3=None):
    """Return a CouchDB document, given its ID, revision and database name."""
    arg_4 = get_server(arg_2)[arg_1]
    if arg_3:
        arg_5, arg_6 = arg_4.resource.get(arg_0, arg_3=arg_3)
        return couchdb.client.Document(arg_6)
    return arg_4[arg_0]


def Func(arg_0):
    """Give reST format README for pypi."""
    arg_1 = os.path.splitext(arg_0)[1]
    if (arg_1 == '.rst'):
        import codecs
        return codecs.open(arg_0, 'r', 'utf-8').Func()
    elif (arg_1 == '.md'):
        import pypandoc
        return pypandoc.convert(arg_0, 'rst')


def Func():
    """
    Return True if in a venv and no system site packages.
    """
    #this mirrors the logic in virtualenv.py for locating the no-global-site-packages.txt file
    arg_0 = os.path.dirname(os.path.abspath(site.__file__))
    arg_1 = os.path.join(arg_0, 'no-global-site-packages.txt')
    if running_under_virtualenv() and os.path.isfile(arg_1):
        return True


def Func(arg_0, arg_1):
    """Parallel word frequency counter.

    view - An IPython DirectView
    fnames - The filenames containing the split data.
    """
    assert len(arg_1) == len(arg_0.targets)
    arg_0.scatter('fname', arg_1, flatten=True)
    arg_2 = arg_0.apply(wordfreq, Reference('fname'))
    arg_3 = arg_2.get()
    arg_4 = set()
    for arg_5 in arg_3:
        arg_4.update(arg_5.keys())
    arg_6 = dict(zip(arg_4, repeat(0)))
    for arg_5 in arg_3:
        for arg_7, arg_8 in arg_5.iteritems():
            arg_6[arg_7] += arg_8
    return arg_6


def Func(arg_0):
	"""Convert a function based decorator into a class based decorator usable
	on class based Views.

	Can't subclass the `View` as it breaks inheritance (super in particular),
	so we monkey-patch instead.

	Based on http://stackoverflow.com/a/8429311
	"""

	def simple_decorator(arg_1):
		arg_1.dispatch = method_decorator(arg_0)(arg_1.dispatch)
		return arg_1

	return simple_decorator


def Func():
    """Return list of shell aliases to auto-define.
    """
    # Note: the aliases defined here should be safe to use on a kernel
    # regardless of what frontend it is attached to.  Frontends that use a
    # kernel in-process can define additional aliases that will only work in
    # their case.  For example, things like 'less' or 'clear' that manipulate
    # the terminal should NOT be declared here, as they will only work if the
    # kernel is running inside a true terminal, and not over the network.

    if os.name == 'posix':
        Func = [('mkdir', 'mkdir'), ('rmdir', 'rmdir'),
                           ('mv', 'mv -i'), ('rm', 'rm -i'), ('cp', 'cp -i'),
                           ('cat', 'cat'),
                           ]
        # Useful set of ls aliases.  The GNU and BSD options are a little
        # different, so we make aliases that provide as similar as possible
        # behavior in ipython, by passing the right flags for each platform
        if sys.platform.startswith('linux'):
            arg_1 = [('ls', 'ls -F --color'),
                          # long ls
                          ('ll', 'ls -F -o --color'),
                          # ls normal files only
                          ('lf', 'ls -F -o --color %l | grep ^-'),
                          # ls symbolic links
                          ('lk', 'ls -F -o --color %l | grep ^l'),
                          # directories or links to directories,
                          ('ldir', 'ls -F -o --color %l | grep /$'),
                          # things which are executable
                          ('lx', 'ls -F -o --color %l | grep ^-..x'),
                          ]
        else:
            # BSD, OSX, etc.
            arg_1 = [('ls', 'ls -F'),
                          # long ls
                          ('ll', 'ls -F -l'),
                          # ls normal files only
                          ('lf', 'ls -F -l %l | grep ^-'),
                          # ls symbolic links
                          ('lk', 'ls -F -l %l | grep ^l'),
                          # directories or links to directories,
                          ('ldir', 'ls -F -l %l | grep /$'),
                          # things which are executable
                          ('lx', 'ls -F -l %l | grep ^-..x'),
                          ]
        Func = Func + arg_1
    elif os.name in ['nt', 'dos']:
        Func = [('ls', 'dir /on'),
                           ('ddir', 'dir /ad /on'), ('ldir', 'dir /ad /on'),
                           ('mkdir', 'mkdir'), ('rmdir', 'rmdir'),
                           ('echo', 'echo'), ('ren', 'ren'), ('copy', 'copy'),
                           ]
    else:
        Func = []

    return Func


def Func(arg_0, arg_1, arg_2):
        """Define a new alias after validating it.

        This will raise an :exc:`AliasError` if there are validation
        problems.
        """
        arg_3 = arg_0.validate_alias(arg_1, arg_2)
        arg_0.alias_table[arg_1] = (arg_3, arg_2)


def Func(arg_0, arg_1, arg_2=''):
        """Call an alias given its name and the rest of the line."""
        arg_3 = arg_0.transform_alias(arg_1, arg_2)
        try:
            arg_0.shell.system(arg_3)
        except:
            arg_0.shell.showtraceback()


def Func(arg_0, arg_1,arg_2=''):
        """Transform alias to system command string."""
        arg_3, arg_4 = arg_0.alias_table[arg_1]

        if ' ' in arg_4 and os.path.isfile(arg_4):
            arg_4 = '"%s"' % arg_4

        # Expand the %l special to be the user's input line
        if arg_4.find('%l') >= 0:
            arg_4 = arg_4.replace('%l', arg_2)
            arg_2 = ''
        if arg_3==0:
            # Simple, argument-less aliases
            arg_4 = '%s %s' % (arg_4, arg_2)
        else:
            # Handle aliases with positional arguments
            arg_5 = arg_2.split(None, arg_3)
            if len(arg_5) < arg_3:
                raise AliasError('Alias <%s> requires %s arguments, %s given.' %
                      (arg_1, arg_3, len(arg_5)))
            arg_4 = '%s %s' % (arg_4 % tuple(arg_5[:arg_3]),' '.join(arg_5[arg_3:]))
        return arg_4


def Func(arg_0, arg_1):
        """ Expand an alias in the command line

        Returns the provided command line, possibly with the first word
        (command) translated according to alias expansion rules.

        [ipython]|16> _ip.Funces("np myfile.txt")
                 <16> 'q:/opt/np/notepad++.exe myfile.txt'
        """

        arg_2,arg_3,arg_4,arg_5 = split_user_input(arg_1)
        arg_6 = arg_2 + arg_0.Funces(arg_4, arg_5)
        return arg_6


def Func(arg_0, arg_1, arg_2, arg_3, arg_4,
                       arg_5, arg_6, arg_7, arg_8):
    """produces rst from nose help"""
    arg_9 = Config(parserClass=OptBucket,
                    plugins=BuiltinPluginManager())
    arg_10 = arg_9.getParser(TestProgram.usage())
    arg_11 = ViewList()
    for arg_12 in arg_10.format_help().split('\n'):
        arg_11.append(arg_12, '<autodoc>')

    arg_11.append('Options', '<autodoc>')
    arg_11.append('-------', '<autodoc>')
    arg_11.append('', '<autodoc>')
    for arg_13 in arg_10:
        arg_11.append(arg_13.options(), '<autodoc>')
        arg_11.append('   \n', '<autodoc>')
        arg_11.append('   ' + arg_13.help + '\n', '<autodoc>')
        arg_11.append('\n', '<autodoc>')
    arg_14 = nodes.section()
    arg_14.document = arg_7.document
    arg_16 = arg_7.memo.title_styles
    arg_17 = arg_7.memo.section_level
    arg_7.memo.title_styles = []
    arg_7.memo.section_level = 0
    arg_7.nested_parse(arg_11, 0, arg_14, match_titles=1)
    arg_7.memo.title_styles = arg_16
    arg_7.memo.section_level = arg_17

    return arg_14.children


def Func(arg_0, arg_1):
        """ Yields substrings for which the same escape code applies.
        """
        arg_0.actions = []
        arg_3 = 0

        # strings ending with \r are assumed to be ending in \r\n since
        # \n is appended to output strings automatically.  Accounting
        # for that, here.
        arg_4 = '\n' if len(arg_1) > 0 and arg_1[-1] == '\n' else None
        arg_1 = arg_1[:-1] if arg_4 is not None else arg_1

        for arg_5 in ANSI_OR_SPECIAL_PATTERN.finditer(arg_1):
            arg_6 = arg_1[arg_3:arg_5.start()]
            arg_7 = SPECIAL_PATTERN.sub(arg_0._replace_special, arg_6)
            if arg_7 or arg_0.actions:
                yield arg_7
                arg_0.actions = []
            arg_3 = arg_5.end()

            arg_8 = filter(lambda x: x is not None, arg_5.groups())
            arg_9 = arg_8[0]
            if arg_9 == '\a':
                arg_0.actions.append(BeepAction('beep'))
                yield None
                arg_0.actions = []
            elif arg_9 == '\r':
                arg_0.actions.append(CarriageReturnAction('carriage-return'))
                yield None
                arg_0.actions = []
            elif arg_9 == '\b':
                arg_0.actions.append(BackSpaceAction('backspace'))
                yield None
                arg_0.actions = []
            elif arg_9 == '\n' or arg_9 == '\r\n':
                arg_0.actions.append(NewLineAction('newline'))
                yield arg_9
                arg_0.actions = []
            else:
                arg_10 = [ param for param in arg_8[1].split(';') if param ]
                if arg_9.startswith('['):
                    # Case 1: CSI code.
                    try:
                        arg_10 = map(int, arg_10)
                    except ValueError:
                        # Silently discard badly formed codes.
                        pass
                    else:
                        arg_0.set_csi_code(arg_8[2], arg_10)

                elif arg_9.startswith(']'):
                    # Case 2: OSC code.
                    arg_0.set_osc_code(arg_10)

        arg_6 = arg_1[arg_3:]
        arg_7 = SPECIAL_PATTERN.sub(arg_0._replace_special, arg_6)
        if arg_7 or arg_0.actions:
            yield arg_7

        if arg_4 is not None:
            arg_0.actions.append(NewLineAction('newline'))
            yield arg_4


def Func(arg_0, arg_1, arg_2=0):
        """ Returns a QColor for a given color code, or None if one cannot be
            constructed.
        """
        if arg_1 is None:
            return None

        # Adjust for intensity, if possible.
        if arg_1 < 8 and arg_2 > 0:
            arg_1 += 8

        arg_3 = arg_0.color_map.get(arg_1, None)
        if isinstance(arg_3, basestring):
            # If this is an X11 color name, we just hope there is a close SVG
            # color name. We could use QColor's static method
            # 'setAllowX11ColorNames()', but this is global and only available
            # on X11. It seems cleaner to aim for uniformity of behavior.
            return QtGui.QColor(arg_3)

        elif isinstance(arg_3, (tuple, list)):
            return QtGui.QColor(*arg_3)

        return None


def Func(arg_0):
        """ Returns a QTextCharFormat that encodes the current style attributes.
        """
        arg_1 = QtGui.QTextCharFormat()

        # Set foreground color
        arg_2 = arg_0.get_color(arg_0.foreground_color, arg_0.intensity)
        if arg_2 is not None:
            arg_1.setForeground(arg_2)

        # Set background color
        arg_2 = arg_0.get_color(arg_0.background_color, arg_0.intensity)
        if arg_2 is not None:
            arg_1.setBackground(arg_2)

        # Set font weight/style options
        if arg_0.bold:
            arg_1.setFontWeight(QtGui.QFont.Bold)
        else:
            arg_1.setFontWeight(QtGui.QFont.Normal)
        arg_1.setFontItalic(arg_0.italic)
        arg_1.setFontUnderline(arg_0.underline)

        return arg_1


def Func(arg_0, arg_1, **arg_2):
    """Generate a one-time jwt with an age in seconds"""
    arg_3 = str(uuid.uuid1()) # random id
    if not arg_2:
        arg_2 = {}
    arg_2['exp'] = int(time.time() + arg_1)
    arg_2['jti'] = arg_3
    return jwt.encode(arg_2, decode_secret(arg_0))


def Func(arg_0):
        """Run by housekeeper thread"""
        arg_1 = time.time()
        for arg_2 in arg_0.jwts.keys():
            if (arg_1 - arg_0.jwts[arg_2]) > (arg_0.age * 2):
                del arg_0.jwts[arg_2]


def Func(arg_0):
    """Get common prefix for completions

    Return the longest common prefix of a list of strings, but with special
    treatment of escape characters that might precede commands in IPython,
    such as %magic functions. Used in tab completion.

    For a more general function, see os.path.Func
    """
    # the last item will always have the least leading % symbol
    # min / max are first/last in alphabetical order
    arg_1  = ESCAPE_RE.match(min(arg_0))
    arg_2  = ESCAPE_RE.match(max(arg_0))
    # common suffix is (common prefix of reversed items) reversed
    if arg_1 and arg_2:
        arg_3 = os.path.Func((arg_1.group(0)[::-1], arg_2.group(0)[::-1]))[::-1]
    else:
        arg_3 = ''

    arg_0 = [s.lstrip(ESCAPE_CHARS) for s in arg_0]
    return arg_3+os.path.Func(arg_0)