Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions timetracker/cfg/cfg_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from collections import namedtuple

import tomlkit
from tomlkit.toml_file import TOMLFile

from timetracker.consts import DIRTRK
from timetracker.consts import DIRCSV
Expand Down Expand Up @@ -69,7 +68,7 @@ def set_filename_csv(self, filename_str):
"""Write the config file, replacing [csv][filename] value"""
filenamecfg = self.get_filename_cfg()
if exists(filenamecfg):
doc = TOMLFile(filenamecfg).read()
doc = tomlkit.toml_file.TOMLFile(filenamecfg).read()
doc['csv']['filename'] = filename_str
return self._wr_cfg(filenamecfg, doc)
raise RuntimeError(f"CAN NOT WRITE {filenamecfg}")
Expand Down Expand Up @@ -144,7 +143,7 @@ def reinit(self, project, dircsv, fcfg_global=None, ntdoc=None):
self._update_doc_globalcfgname(doc, fcfg_global)
chgd = True
if chgd:
TOMLFile(fname).write(doc)
tomlkit.toml_file.TOMLFile(fname).write(doc)
else:
print(f'No changes needed to local config: {self.filename}')

Expand Down Expand Up @@ -173,7 +172,8 @@ def _wr_cfg(fname, doc):
def _rd_doc(self):
"""Read a config file and load it into a TOML doc"""
fin_cfglocal = self.get_filename_cfg()
return TOMLFile(fin_cfglocal).read() if exists(fin_cfglocal) else None
# pylint: disable=line-too-long
return tomlkit.toml_file.TOMLFile(fin_cfglocal).read() if exists(fin_cfglocal) else None

#@staticmethod
#def _strdbg_cfg_global(doc):
Expand Down
7 changes: 4 additions & 3 deletions timetracker/cfg/docutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
__author__ = "DV Klopfenstein, PhD"

from collections import namedtuple
from tomlkit.exceptions import NonExistentKey
from tomlkit.exceptions import ParseError
import tomlkit.exceptions


NTKEYVAL = namedtuple('RdKey', 'value error')
Expand All @@ -22,7 +21,9 @@ def get_ntvalue(doc, key, key2=None):
value = doc[key]
if key2 is not None:
value = value[key2]
except (TypeError,NonExistentKey,ParseError) as err:
except (TypeError,
tomlkit.exceptions.NonExistentKey,
tomlkit.exceptions.ParseError) as err:
error = err
#print(f'{type(err).__name__}{err.args}')
else:
Expand Down
2 changes: 1 addition & 1 deletion timetracker/cmd/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def run_start(cfgproj, name=None, start_at=None, last=None, **kwargs):
# Informational message
elif not force:
if start_at is not None:
print(f'Run `trk start --at {start_at} --force` to force restart')
print(f'Run `trk start --at "{start_at}" --force` to force restart')
return startobj


Expand Down
Loading