Skip to content
Back to top
View this page
Edit this page

# xonsh.history.dummy

Implements the xonsh history backend.

class xonsh.history.dummy.DummyHistory(sessionid=None, **kwargs)

  A dummy implement of history backend.

  Represents a xonsh session’s history.

  Parameters:
    remember_history bool

      Сontrols whether entered commands are saved to the command history. If True, commands are saved; if False, command history is not kept.

    sessionid int, uuid, str, optional

      Current session identifier, will generate a new sessionid if not set.

  all_items(newest_first=False)

    Get all history items.

  append(cmd)

    Append a command item into history.

    Parameters:
      cmd: dict

        This dict contains information about the command that is to be added to the history list. It should contain the keys `inp`, `rtn` and `ts`. These key names mirror the same names defined as instance variables in the `HistoryEntry` class.

  clear()

    Clears the history of the current session from both the disk and memory.

  delete(pattern)

    Deletes the history of the current session for commands that match a user-provided pattern.

    Parameters:
      pattern: str

        The regex pattern to match commands against.

    Returns:
      int

        The number of commands deleted from history.

  flush(**kwargs)

    Flush the history items to disk from a buffer.

  info()

    A collection of information about the shell history.

    Returns:
      dict or collections.OrderedDict

        Contains history information as str key pairs.

  is_ignored(cmd)

    Determines if a history item should be added to the event history. Call this in your append method.

    Parameters:
      cmd: dict

        The prospective item to append (structure is the same as the append method).

    Returns:
      bool

        True if the item should be appended, False if not.

  items(newest_first=False)

    Get history items of current session.

  pull(**kwargs)

    Pull history from other parallel sessions.

  run_gc(size=None, blocking=True, **_)

    Run the garbage collector.

    Parameters:
      size: None or tuple of a int and a string

        Determines the size and units of what would be allowed to remain.

      blocking: bool

        If set blocking, then wait until gc action finished.

  property ignore_regex