Exemplo n.º 1
0
 def history(self,
             raw=True,
             output=False,
             hist_access_type='range',
             _header=None,
             **kwargs):
     msg = history_request(raw=raw,
                           output=output,
                           hist_access_type=hist_access_type,
                           **kwargs)
     self._send('shell', msg)
     return msg.header['msg_id']
Exemplo n.º 2
0
    def history(self,
                raw=True,
                output=False,
                hist_access_type='range',
                _header=None,
                **kwargs):
        """Get entries from the kernel's history list.

        Parameters
        ----------
        raw : bool
            If True, return the raw input.
        output : bool
            If True, then return the output as well.
        hist_access_type : str
            'range' (fill in session, start and stop params), 'tail' (fill in n)
             or 'search' (fill in pattern param).

        session : int
            For a range request, the session from which to get lines. Session
            numbers are positive integers; negative ones count back from the
            current session.
        start : int
            The first line number of a history range.
        stop : int
            The final (excluded) line number of a history range.

        n : int
            The number of lines of history to get for a tail request.

        pattern : str
            The glob-syntax pattern for a search request.

        Returns
        -------
        The ID of the message sent.
        """
        msg = history_request(raw=raw,
                              output=output,
                              hist_access_type=hist_access_type,
                              **kwargs)
        if _header:
            msg.header = _header
        self.messaging.send('shell', msg)
        return msg.header['msg_id']