Go back to `tomllib` for ledger loading, it's wayy faster

master
Tyler Goodlet 2023-05-18 11:27:31 -04:00
parent 97b2b25256
commit a1a10676cd
2 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,7 @@ from pendulum import (
parse,
)
import tomlkit
import tomli
from .. import config
from ..data.types import Struct
@ -141,8 +142,10 @@ class TransactionLedger(UserDict):
if fqme:
txdict['fqme'] = fqme
print(f'WRITING LEDGER {self.file_path}')
with self.file_path.open(mode='w') as fp:
tomlkit.dump(towrite, fp)
print(f'FINISHED WRITING LEDGER {self.file_path}')
def update_from_t(
self,

View File

@ -345,7 +345,7 @@ def load_ledger(
with fpath.open(mode='rb') as cf:
start = time.time()
ledger_dict = tomlkit.parse(cf.read())
ledger_dict = tomllib.load(cf)
log.debug(f'Ledger load took {time.time() - start}s')
return ledger_dict, fpath