This commit is contained in:
2019-02-25 20:30:20 +01:00
parent a248e114de
commit da015d3af0
6 changed files with 57 additions and 13 deletions

View File

@ -1198,12 +1198,13 @@ class KernelMetaConfig(KernelMixConfig):
if not isinstance(child, _CommonConfig):
try:
child = child._config
except:
except Exception:
raise TypeError(_("{}config's children "
"should be config, not {}"
).format(self.impl_type,
type(child)))
if not isinstance(child, (KernelConfig, KernelMetaConfig)):
if __debug__ and not isinstance(child, (KernelConfig,
KernelMetaConfig)):
raise TypeError(_("child must be a Config or MetaConfig"))
if descr is None:
descr = child.cfgimpl_get_description()

View File

@ -19,6 +19,7 @@
# the whole pypy projet is under MIT licence
# ____________________________________________________________
from ipaddress import ip_interface, ip_network
from typing import List
from ..error import ConfigError
from ..setting import undefined, OptionBag, Undefined
@ -49,11 +50,11 @@ class NetmaskOption(StrOption):
raise ValueError()
def _cons_network_netmask(self,
current_opt,
opts,
vals,
warnings_only,
context):
current_opt: Option,
opts: List[Option],
vals: List[str],
warnings_only: bool,
context: 'Config'):
if context is undefined and len(vals) != 2:
raise ConfigError(_('network_netmask needs a network and a netmask'))
if None in vals or len(vals) != 2:
@ -71,12 +72,12 @@ class NetmaskOption(StrOption):
opt_network.impl_get_display_name()))
def _cons_ip_netmask(self,
current_opt,
opts,
vals,
warnings_only,
context,
_cidr=False):
current_opt: Option,
opts: List[Option],
vals: List[str],
warnings_only: bool,
context: 'config',
_cidr: bool=False):
if context is undefined and len(vals) != 2:
raise ConfigError(_('ip_netmask needs an IP and a netmask'))
if None in vals or len(vals) != 2: