pep8
This commit is contained in:
parent
acca6d5a27
commit
707a215a2c
|
@ -187,9 +187,8 @@ class SubConfig(BaseInformation):
|
||||||
force_permissive=force_permissive)
|
force_permissive=force_permissive)
|
||||||
else:
|
else:
|
||||||
context = self.cfgimpl_get_context()
|
context = self.cfgimpl_get_context()
|
||||||
path = context.\
|
path = context.cfgimpl_get_description().impl_get_path_by_opt(
|
||||||
cfgimpl_get_description().\
|
child._opt)
|
||||||
impl_get_path_by_opt(child._opt)
|
|
||||||
context._setattr(path, value, force_permissive=force_permissive)
|
context._setattr(path, value, force_permissive=force_permissive)
|
||||||
|
|
||||||
def __delattr__(self, name):
|
def __delattr__(self, name):
|
||||||
|
@ -210,8 +209,8 @@ class SubConfig(BaseInformation):
|
||||||
# attribute access by passing a path,
|
# attribute access by passing a path,
|
||||||
# for instance getattr(self, "creole.general.family.adresse_ip_eth0")
|
# for instance getattr(self, "creole.general.family.adresse_ip_eth0")
|
||||||
if '.' in name:
|
if '.' in name:
|
||||||
homeconfig, name = self.cfgimpl_get_home_by_path(name,
|
homeconfig, name = self.cfgimpl_get_home_by_path(
|
||||||
force_permissive=force_permissive,
|
name, force_permissive=force_permissive,
|
||||||
force_properties=force_properties)
|
force_properties=force_properties)
|
||||||
return homeconfig._getattr(name, force_permissive=force_permissive,
|
return homeconfig._getattr(name, force_permissive=force_permissive,
|
||||||
force_properties=force_properties,
|
force_properties=force_properties,
|
||||||
|
@ -225,19 +224,19 @@ class SubConfig(BaseInformation):
|
||||||
# symlink options
|
# symlink options
|
||||||
if isinstance(opt_or_descr, SymLinkOption):
|
if isinstance(opt_or_descr, SymLinkOption):
|
||||||
context = self.cfgimpl_get_context()
|
context = self.cfgimpl_get_context()
|
||||||
path = context.cfgimpl_get_description(
|
path = context.cfgimpl_get_description().impl_get_path_by_opt(
|
||||||
).impl_get_path_by_opt(opt_or_descr._opt)
|
opt_or_descr._opt)
|
||||||
return context._getattr(path, validate=validate,
|
return context._getattr(path, validate=validate,
|
||||||
force_properties=force_properties,
|
force_properties=force_properties,
|
||||||
force_permissive=force_permissive)
|
force_permissive=force_permissive)
|
||||||
elif isinstance(opt_or_descr, OptionDescription):
|
elif isinstance(opt_or_descr, OptionDescription):
|
||||||
self.cfgimpl_get_settings().validate_properties(opt_or_descr,
|
self.cfgimpl_get_settings().validate_properties(
|
||||||
True, False,
|
opt_or_descr, True, False, force_permissive=force_permissive,
|
||||||
force_permissive=force_permissive,
|
|
||||||
force_properties=force_properties)
|
force_properties=force_properties)
|
||||||
return SubConfig(opt_or_descr, self.cfgimpl_get_context())
|
return SubConfig(opt_or_descr, self.cfgimpl_get_context())
|
||||||
else:
|
else:
|
||||||
return self.cfgimpl_get_values().getitem(opt_or_descr,
|
return self.cfgimpl_get_values().getitem(
|
||||||
|
opt_or_descr,
|
||||||
validate=validate,
|
validate=validate,
|
||||||
force_properties=force_properties,
|
force_properties=force_properties,
|
||||||
force_permissive=force_permissive)
|
force_permissive=force_permissive)
|
||||||
|
@ -267,11 +266,9 @@ class SubConfig(BaseInformation):
|
||||||
:param byvalue: filter by the option's value
|
:param byvalue: filter by the option's value
|
||||||
:returns: list of matching Option objects
|
:returns: list of matching Option objects
|
||||||
"""
|
"""
|
||||||
return self.cfgimpl_get_context()._find(bytype, byname, byvalue,
|
return self.cfgimpl_get_context()._find(
|
||||||
first=True,
|
bytype, byname, byvalue, first=True, type_=type_,
|
||||||
type_=type_,
|
_subpath=self.cfgimpl_get_path(), display_error=display_error)
|
||||||
_subpath=self.cfgimpl_get_path(),
|
|
||||||
display_error=display_error)
|
|
||||||
|
|
||||||
def _find(self, bytype, byname, byvalue, first, type_='option',
|
def _find(self, bytype, byname, byvalue, first, type_='option',
|
||||||
_subpath=None, check_properties=True, display_error=True):
|
_subpath=None, check_properties=True, display_error=True):
|
||||||
|
@ -422,8 +419,7 @@ class SubConfig(BaseInformation):
|
||||||
type_='path',
|
type_='path',
|
||||||
_subpath=mypath):
|
_subpath=mypath):
|
||||||
path = '.'.join(path.split('.')[:-1])
|
path = '.'.join(path.split('.')[:-1])
|
||||||
opt = self.cfgimpl_get_context(
|
opt = self.cfgimpl_get_context().cfgimpl_get_description(
|
||||||
).cfgimpl_get_description(
|
|
||||||
).impl_get_opt_by_path(path)
|
).impl_get_opt_by_path(path)
|
||||||
if mypath is not None:
|
if mypath is not None:
|
||||||
if mypath == path:
|
if mypath == path:
|
||||||
|
@ -511,8 +507,7 @@ class CommonConfig(SubConfig):
|
||||||
"""
|
"""
|
||||||
if '.' in path:
|
if '.' in path:
|
||||||
homeconfig, path = self.cfgimpl_get_home_by_path(
|
homeconfig, path = self.cfgimpl_get_home_by_path(
|
||||||
path,
|
path, force_permissive=force_permissive)
|
||||||
force_permissive=force_permissive)
|
|
||||||
return getattr(homeconfig.cfgimpl_get_description(), path)
|
return getattr(homeconfig.cfgimpl_get_description(), path)
|
||||||
return getattr(self.cfgimpl_get_description(), path)
|
return getattr(self.cfgimpl_get_description(), path)
|
||||||
|
|
||||||
|
@ -658,8 +653,8 @@ def mandatory_warnings(config):
|
||||||
"""
|
"""
|
||||||
#if value in cache, properties are not calculated
|
#if value in cache, properties are not calculated
|
||||||
config.cfgimpl_reset_cache(only=('values',))
|
config.cfgimpl_reset_cache(only=('values',))
|
||||||
for path in config.cfgimpl_get_description(
|
for path in config.cfgimpl_get_description().impl_getpaths(
|
||||||
).impl_getpaths(include_groups=True):
|
include_groups=True):
|
||||||
try:
|
try:
|
||||||
config._getattr(path, force_properties=frozenset(('mandatory',)))
|
config._getattr(path, force_properties=frozenset(('mandatory',)))
|
||||||
except PropertiesOptionError, err:
|
except PropertiesOptionError, err:
|
||||||
|
|
Loading…
Reference in New Issue