chevron removed
This commit is contained in:
parent
8ee950940e
commit
3c3be6d79c
2 changed files with 11 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from string import Template
|
||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
from injectable import injectable, autowired, Autowired
|
from injectable import injectable, autowired, Autowired
|
||||||
|
|
@ -13,4 +14,11 @@ class Mo:
|
||||||
self._passwords = passwords
|
self._passwords = passwords
|
||||||
|
|
||||||
def process(self, mo_file: Path):
|
def process(self, mo_file: Path):
|
||||||
pass
|
raw = ''
|
||||||
|
with open(mo_file, "r") as mo:
|
||||||
|
raw = mo.read()
|
||||||
|
tpl = Template(raw)
|
||||||
|
rendered = tpl.substitute(self._passwords.get_values(tpl.get_identifiers()))
|
||||||
|
de_mo_ified = str(mo_file).replace(".mo", "")
|
||||||
|
with open(de_mo_ified, "w") as mo:
|
||||||
|
mo.write(rendered)
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,8 @@ class Passwords:
|
||||||
shutil.copyfile(path, lock_path)
|
shutil.copyfile(path, lock_path)
|
||||||
return Passwords._open_or_create(lock_path, password)
|
return Passwords._open_or_create(lock_path, password)
|
||||||
|
|
||||||
@property
|
def get_values(self, keys: list[str]) -> dict[str, str]:
|
||||||
def kp(self) -> PyKeePass:
|
return {}
|
||||||
return self._kp
|
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
# nadpisz plik źródłowy zmianami z lock
|
# nadpisz plik źródłowy zmianami z lock
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue