Dealt with a couple todos.
This commit is contained in:
parent
63b3109800
commit
fe01e04001
|
|
@ -111,7 +111,7 @@ class ExportManager:
|
||||||
level='CRITICAL'
|
level='CRITICAL'
|
||||||
)
|
)
|
||||||
# future: allow for template selection
|
# future: allow for template selection
|
||||||
optionals = format_optionals(export_request.optionals) # TODO : Extensive testing
|
optionals = format_optionals(export_request.optionals) # FUTURE : More Extensive testing
|
||||||
|
|
||||||
return start, end, optionals
|
return start, end, optionals
|
||||||
|
|
||||||
|
|
@ -188,7 +188,7 @@ class ContextConverter:
|
||||||
"""
|
"""
|
||||||
Transforms output form context manager into final, printable versions of the containers.
|
Transforms output form context manager into final, printable versions of the containers.
|
||||||
"""
|
"""
|
||||||
def __init__(self, pile, exporter):
|
def __init__(self, pile, exporter, destination):
|
||||||
"""
|
"""
|
||||||
Takes a pile and the exporter object
|
Takes a pile and the exporter object
|
||||||
Parameters
|
Parameters
|
||||||
|
|
@ -202,6 +202,7 @@ class ContextConverter:
|
||||||
self.pile = pile
|
self.pile = pile
|
||||||
self.exporter = exporter
|
self.exporter = exporter
|
||||||
self.io_initialized = False
|
self.io_initialized = False
|
||||||
|
self.destination = destination
|
||||||
|
|
||||||
def process_pile(self):
|
def process_pile(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -227,9 +228,8 @@ class ContextConverter:
|
||||||
return self.io_output.readlines()
|
return self.io_output.readlines()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"ContextConverter[FileName] <{len(self.pile)}> " \
|
return f"ContextConverter[{self.destination}] <{len(self.pile)}> " \
|
||||||
f"Status: {'initialized' if self.io_initialized else 'uninitialized'}"
|
f"Status: {'initialized' if self.io_initialized else 'uninitialized'}"
|
||||||
# TODO: deal with filename
|
|
||||||
|
|
||||||
def print_all(self):
|
def print_all(self):
|
||||||
print(self)
|
print(self)
|
||||||
|
|
@ -249,7 +249,7 @@ if __name__ == '__main__': # pragma: no cover
|
||||||
__templates = config.ConfigLoader(pathresolver.b_path("templates/"))
|
__templates = config.ConfigLoader(pathresolver.b_path("templates/"))
|
||||||
exm = ExportManager(__config, __templates)
|
exm = ExportManager(__config, __templates)
|
||||||
cxm = context_mngr.ContextManager(test)
|
cxm = context_mngr.ContextManager(test)
|
||||||
cxc = ContextConverter(cxm(), exm)
|
cxc = ContextConverter(cxm(), exm, "Undefined")
|
||||||
rich.inspect(cxc)
|
rich.inspect(cxc)
|
||||||
cxc.process_pile()
|
cxc.process_pile()
|
||||||
rich.inspect(cxc.pile[0])
|
rich.inspect(cxc.pile[0])
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ def preparse_parse(preparser):
|
||||||
|
|
||||||
def save(list_of_containers, destination, env):
|
def save(list_of_containers, destination, env):
|
||||||
with open(destination, "w") as output_file:
|
with open(destination, "w") as output_file:
|
||||||
output_file.write(export.ContextConverter(list_of_containers, env.export_mngr).process_pile().read())
|
output_file.write(export.ContextConverter(list_of_containers, env.export_mngr, destination).process_pile().read())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
if __name__ == "__main__": # pragma: no cover
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ def test_context_cov():
|
||||||
# base = context_mngr.ContextManager(lst)
|
# base = context_mngr.ContextManager(lst)
|
||||||
# base.pile = lst
|
# base.pile = lst
|
||||||
# return base
|
# return base
|
||||||
convr = export.ContextConverter(lst, em)
|
convr = export.ContextConverter(lst, em, "Undefined")
|
||||||
convr.process_pile()
|
convr.process_pile()
|
||||||
convr.__repr__()
|
convr.__repr__()
|
||||||
convr.readlines()
|
convr.readlines()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue