corrections
This commit is contained in:
parent
4017bf7840
commit
3741a0b548
2 changed files with 32 additions and 4 deletions
|
@ -28,7 +28,7 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
from tiramisu import Config
|
from tiramisu import Config
|
||||||
from copy import copy
|
from warnings import warn
|
||||||
|
|
||||||
from .convert import RougailConvert
|
from .convert import RougailConvert
|
||||||
from .config import RougailConfig
|
from .config import RougailConfig
|
||||||
|
@ -69,7 +69,7 @@ class Rougail:
|
||||||
"""Add a prefix"""
|
"""Add a prefix"""
|
||||||
self.converted.parse_directories(path_prefix)
|
self.converted.parse_directories(path_prefix)
|
||||||
|
|
||||||
def get_config(self):
|
def run(self):
|
||||||
"""Get Tiramisu Config"""
|
"""Get Tiramisu Config"""
|
||||||
if not self.config:
|
if not self.config:
|
||||||
tiram_obj = self.converted.save(self.rougailconfig["tiramisu_cache"])
|
tiram_obj = self.converted.save(self.rougailconfig["tiramisu_cache"])
|
||||||
|
@ -83,5 +83,9 @@ class Rougail:
|
||||||
self.config.property.read_write()
|
self.config.property.read_write()
|
||||||
return self.config
|
return self.config
|
||||||
|
|
||||||
|
def get_config(self):
|
||||||
|
warn("get_config is deprecated, use run instead", DeprecationWarning, stacklevel=2)
|
||||||
|
return self.run()
|
||||||
|
|
||||||
|
|
||||||
__ALL__ = ("Rougail", "RougailConfig", "RougailUpgrade")
|
__ALL__ = ("Rougail", "RougailConfig", "RougailUpgrade")
|
||||||
|
|
|
@ -131,9 +131,33 @@ class _RougailConfig:
|
||||||
def get_leadership(self,
|
def get_leadership(self,
|
||||||
option
|
option
|
||||||
) -> dict:
|
) -> dict:
|
||||||
leader, *followers = option.value.get().values()
|
leader = None
|
||||||
|
followers = []
|
||||||
|
for opt, value in option.value.get().items():
|
||||||
|
if opt.issymlinkoption():
|
||||||
|
continue
|
||||||
|
if leader is None:
|
||||||
|
leader = value
|
||||||
|
else:
|
||||||
|
followers.append(value)
|
||||||
return dict(zip(leader, followers))
|
return dict(zip(leader, followers))
|
||||||
|
|
||||||
|
def parse(self, config) -> str:
|
||||||
|
for option in config:
|
||||||
|
if option.isoptiondescription():
|
||||||
|
yield from self.parse(option)
|
||||||
|
elif not option.issymlinkoption():
|
||||||
|
yield f'{option.path()}: {option.value.get()}'
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
self.config.property.read_write()
|
||||||
|
try:
|
||||||
|
values = "\n".join(self.parse(self.config))
|
||||||
|
except Exception as err:
|
||||||
|
values = str(err)
|
||||||
|
self.config.property.read_only()
|
||||||
|
return values
|
||||||
|
|
||||||
|
|
||||||
class FakeRougailConvert(RougailConvert):
|
class FakeRougailConvert(RougailConvert):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
|
@ -199,7 +223,7 @@ extra_dictionaries:
|
||||||
{% endif %}
|
{% endif %}
|
||||||
names:
|
names:
|
||||||
description: 'Extra namespace name'
|
description: 'Extra namespace name'
|
||||||
alternative_name: e
|
alternative_name: x
|
||||||
multi: true
|
multi: true
|
||||||
mandatory: false
|
mandatory: false
|
||||||
directories:
|
directories:
|
||||||
|
|
Loading…
Reference in a new issue