MCPcopy Index your code
hub / github.com/ipython/ipython / new_session

Method new_session

IPython/core/history.py:758–770  ·  view source on GitHub ↗

Get a new session number.

(self, conn: Optional[sqlite3.Connection] = None)

Source from the content-addressed store, hash-verified

756
757 @only_when_enabled
758 def new_session(self, conn: Optional[sqlite3.Connection] = None) -> None:
759 """Get a new session number."""
760 if conn is None:
761 conn = self.db
762
763 with conn:
764 cur = conn.execute(
765 """INSERT INTO sessions VALUES (NULL, ?, NULL,
766 NULL, '') """,
767 (datetime.datetime.now().isoformat(" "),),
768 )
769 assert isinstance(cur.lastrowid, int)
770 self.session_number = cur.lastrowid
771
772 def end_session(self) -> None:
773 """Close the database session, filling in the end time and line count."""

Callers 4

__init__Method · 0.95
resetMethod · 0.95
writeout_cacheMethod · 0.95

Calls 1

executeMethod · 0.80

Tested by

no test coverage detected