Last active
January 24, 2017 01:58
-
-
Save mitnk/d9385c60e113eef14e41d42509846a5c to your computer and use it in GitHub Desktop.
xonsh migrate history items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xonsh.history.json import JsonHistory | |
from xonsh.history.sqlite import SqliteHistory | |
hist_json = JsonHistory(gc=False) | |
# if you want to have a check first | |
print('have {} json items'.format(len(list(hist_json.all_items())))) # may very slow here | |
hist_db = SqliteHistory(gc=False) | |
for item in hist_json.all_items(): | |
if 'inp' not in item: | |
continue | |
if 'rtn' not in item: | |
item['rtn'] = 0 | |
hist_db.append(item) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment