Go back to `tomllib` for ledger loading, it's wayy faster
parent
97b2b25256
commit
a1a10676cd
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue