Show More
@@ -9,7 +9,6 b' import datetime' | |||||
9 | from pathlib import Path |
|
9 | from pathlib import Path | |
10 | import re |
|
10 | import re | |
11 | import sqlite3 |
|
11 | import sqlite3 | |
12 | import sys |
|
|||
13 | import threading |
|
12 | import threading | |
14 |
|
13 | |||
15 | from traitlets.config.configurable import LoggingConfigurable |
|
14 | from traitlets.config.configurable import LoggingConfigurable | |
@@ -30,14 +29,6 b' from traitlets import (' | |||||
30 | observe, |
|
29 | observe, | |
31 | ) |
|
30 | ) | |
32 |
|
31 | |||
33 |
|
||||
34 | if sys.version_info >= (3, 12): |
|
|||
35 |
|
||||
36 | def _adapt_datetime(val): |
|
|||
37 | return val.isoformat(" ") |
|
|||
38 |
|
||||
39 | sqlite3.register_adapter(datetime.datetime, _adapt_datetime) |
|
|||
40 |
|
||||
41 | #----------------------------------------------------------------------------- |
|
32 | #----------------------------------------------------------------------------- | |
42 | # Classes and functions |
|
33 | # Classes and functions | |
43 | #----------------------------------------------------------------------------- |
|
34 | #----------------------------------------------------------------------------- | |
@@ -583,7 +574,7 b' class HistoryManager(HistoryAccessor):' | |||||
583 | cur = conn.execute( |
|
574 | cur = conn.execute( | |
584 | """INSERT INTO sessions VALUES (NULL, ?, NULL, |
|
575 | """INSERT INTO sessions VALUES (NULL, ?, NULL, | |
585 | NULL, '') """, |
|
576 | NULL, '') """, | |
586 | (datetime.datetime.now(),), |
|
577 | (datetime.datetime.now().isoformat(" "),), | |
587 | ) |
|
578 | ) | |
588 | self.session_number = cur.lastrowid |
|
579 | self.session_number = cur.lastrowid | |
589 |
|
580 | |||
@@ -591,9 +582,15 b' class HistoryManager(HistoryAccessor):' | |||||
591 | """Close the database session, filling in the end time and line count.""" |
|
582 | """Close the database session, filling in the end time and line count.""" | |
592 | self.writeout_cache() |
|
583 | self.writeout_cache() | |
593 | with self.db: |
|
584 | with self.db: | |
594 | self.db.execute("""UPDATE sessions SET end=?, num_cmds=? WHERE |
|
585 | self.db.execute( | |
595 | session==?""", (datetime.datetime.now(), |
|
586 | """UPDATE sessions SET end=?, num_cmds=? WHERE | |
596 | len(self.input_hist_parsed)-1, self.session_number)) |
|
587 | session==?""", | |
|
588 | ( | |||
|
589 | datetime.datetime.now().isoformat(" "), | |||
|
590 | len(self.input_hist_parsed) - 1, | |||
|
591 | self.session_number, | |||
|
592 | ), | |||
|
593 | ) | |||
597 | self.session_number = 0 |
|
594 | self.session_number = 0 | |
598 |
|
595 | |||
599 | def name_session(self, name): |
|
596 | def name_session(self, name): |
@@ -20,7 +20,6 b' import os' | |||||
20 | import time |
|
20 | import time | |
21 |
|
21 | |||
22 |
|
22 | |||
23 |
|
||||
24 | # prevent jedi/parso's debug messages pipe into interactiveshell |
|
23 | # prevent jedi/parso's debug messages pipe into interactiveshell | |
25 | logging.getLogger("parso").setLevel(logging.WARNING) |
|
24 | logging.getLogger("parso").setLevel(logging.WARNING) | |
26 |
|
25 |
General Comments 0
You need to be logged in to leave comments.
Login now