Compare commits
4 commits
897d4dd216
...
f4f5fb79e4
| Author | SHA1 | Date | |
|---|---|---|---|
| f4f5fb79e4 | |||
| c2e3bf86f1 | |||
| f2893aaacd | |||
| 4e1053bba9 |
42 changed files with 190 additions and 101 deletions
|
|
@ -864,7 +864,7 @@ def _test_value_normal(name, cfg, option, unrestraint, without_index):
|
||||||
assert option.value.valid() is True
|
assert option.value.valid() is True
|
||||||
# list
|
# list
|
||||||
if 'choice' in name:
|
if 'choice' in name:
|
||||||
assert option.value.list() == ('val1', 'val2')
|
assert option.value.list() == ['val1', 'val2']
|
||||||
else:
|
else:
|
||||||
with pytest.raises(ConfigError):
|
with pytest.raises(ConfigError):
|
||||||
option.value.list()
|
option.value.list()
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ def test_choiceoption_function(config_type):
|
||||||
assert cfg.option('choice').owner.isdefault()
|
assert cfg.option('choice').owner.isdefault()
|
||||||
#
|
#
|
||||||
assert value_list(cfg.option('choice').value.list()) == ('val1', 'val2')
|
assert value_list(cfg.option('choice').value.list()) == ('val1', 'val2')
|
||||||
|
assert isinstance(cfg.option('choice').value.list(uncalculated=True), Calculation)
|
||||||
# assert not list_sessions()
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,14 @@ do_autopath()
|
||||||
from .config import config_type, get_config, value_list, global_owner
|
from .config import config_type, get_config, value_list, global_owner
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from tiramisu import Config
|
from tiramisu import Config, Calculation, Params, ParamSelfInformation, calc_value
|
||||||
from tiramisu.i18n import _
|
from tiramisu.i18n import _
|
||||||
from tiramisu import Config, IntOption, FloatOption, ChoiceOption, \
|
from tiramisu import Config, IntOption, FloatOption, ChoiceOption, \
|
||||||
BoolOption, StrOption, SymLinkOption, OptionDescription, undefined
|
BoolOption, StrOption, SymLinkOption, OptionDescription, undefined, \
|
||||||
|
DomainnameOption, EmailOption, URLOption, RegexpOption, IPOption, \
|
||||||
|
PortOption, NetworkOption, NetmaskOption, BroadcastOption, UsernameOption, \
|
||||||
|
GroupnameOption, DateOption, FilenameOption, PasswordOption, MACOption, \
|
||||||
|
PermissionsOption
|
||||||
from tiramisu.error import ConflictError, ConfigError, PropertiesOptionError
|
from tiramisu.error import ConflictError, ConfigError, PropertiesOptionError
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -129,6 +133,29 @@ def test_not_valid_properties():
|
||||||
# assert not list_sessions()
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
|
def test_information_load():
|
||||||
|
ChoiceOption('a', '', ('a', 'b'), informations={'info': 'value'})
|
||||||
|
BoolOption('a', '', informations={'info': 'value'})
|
||||||
|
IntOption('a', '', informations={'info': 'value'})
|
||||||
|
FloatOption('a', '', informations={'info': 'value'})
|
||||||
|
StrOption('a', '', informations={'info': 'value'})
|
||||||
|
RegexpOption('a', '', informations={'info': 'value'})
|
||||||
|
IPOption('a', '', informations={'info': 'value'})
|
||||||
|
PortOption('a', '', informations={'info': 'value'})
|
||||||
|
NetworkOption('a', '', informations={'info': 'value'})
|
||||||
|
NetmaskOption('a', '', informations={'info': 'value'})
|
||||||
|
BroadcastOption('a', '', informations={'info': 'value'})
|
||||||
|
DomainnameOption('a', '', informations={'info': 'value'})
|
||||||
|
EmailOption('a', '', informations={'info': 'value'})
|
||||||
|
URLOption('a', '', informations={'info': 'value'})
|
||||||
|
UsernameOption('a', '', informations={'info': 'value'})
|
||||||
|
GroupnameOption('a', '', informations={'info': 'value'})
|
||||||
|
DateOption('a', '', informations={'info': 'value'})
|
||||||
|
FilenameOption('a', '', informations={'info': 'value'})
|
||||||
|
PasswordOption('a', '', informations={'info': 'value'})
|
||||||
|
MACOption('a', '', informations={'info': 'value'})
|
||||||
|
PermissionsOption('a', '', informations={'info': 'value'})
|
||||||
|
|
||||||
def test_information_config():
|
def test_information_config():
|
||||||
od1 = make_description()
|
od1 = make_description()
|
||||||
cfg = Config(od1)
|
cfg = Config(od1)
|
||||||
|
|
@ -217,6 +244,17 @@ def test_information_option_2():
|
||||||
# assert not list_sessions()
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
|
def test_information_option_symlink():
|
||||||
|
i1 = IntOption('test1', '', Calculation(calc_value, Params(ParamSelfInformation('info'))), informations={'info': 'value'})
|
||||||
|
i2 = SymLinkOption('test2', i1)
|
||||||
|
od1 = OptionDescription('test', '', [i2, i1])
|
||||||
|
cfg = Config(od1)
|
||||||
|
# it's tuples
|
||||||
|
assert set(cfg.option('test1').information.list()) == {'info', 'doc'}
|
||||||
|
assert set(cfg.option('test2').information.list()) == {'info', 'doc'}
|
||||||
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
def test_information_optiondescription():
|
def test_information_optiondescription():
|
||||||
od1 = make_description()
|
od1 = make_description()
|
||||||
cfg = Config(od1)
|
cfg = Config(od1)
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,22 @@ def test_build_dyndescription():
|
||||||
assert parse_od_get(cfg.value.get()) == {'dodval1.st': None, 'dodval2.st': None}
|
assert parse_od_get(cfg.value.get()) == {'dodval1.st': None, 'dodval2.st': None}
|
||||||
assert cfg.option('dodval1').isdynamic()
|
assert cfg.option('dodval1').isdynamic()
|
||||||
assert cfg.option('dodval1.st').isdynamic()
|
assert cfg.option('dodval1.st').isdynamic()
|
||||||
|
assert cfg.option('dodval1').isdynamic(only_self=True)
|
||||||
|
assert not cfg.option('dodval1.st').isdynamic(only_self=True)
|
||||||
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
|
def test_dyndescription_suffixes():
|
||||||
|
st1 = StrOption('st', '')
|
||||||
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list))
|
||||||
|
od1 = OptionDescription('od', '', [dod])
|
||||||
|
cfg = Config(od1)
|
||||||
|
assert parse_od_get(cfg.value.get()) == {'dodval1.st': None, 'dodval2.st': None}
|
||||||
|
assert cfg.option('dodval1').suffixes() == ['val1']
|
||||||
|
assert cfg.option('dodval1.st').suffixes() == ['val1']
|
||||||
|
assert cfg.option('dodval1').suffixes(only_self=True) == ['val1', 'val2']
|
||||||
|
with pytest.raises(ConfigError):
|
||||||
|
cfg.option('dodval1.st').suffixes(only_self=True)
|
||||||
# assert not list_sessions()
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -164,8 +180,10 @@ def test_getdoc_dyndescription():
|
||||||
cfg = Config(od2)
|
cfg = Config(od2)
|
||||||
assert cfg.option('od.dodval1.st').name() == 'st'
|
assert cfg.option('od.dodval1.st').name() == 'st'
|
||||||
assert cfg.option('od.dodval2.st').name() == 'st'
|
assert cfg.option('od.dodval2.st').name() == 'st'
|
||||||
|
assert cfg.option('od.dodval1.st').name(uncalculated=True) == cfg.option('od.dodval2.st').name(uncalculated=True) == 'st'
|
||||||
assert cfg.option('od.dodval1').name() == 'dodval1'
|
assert cfg.option('od.dodval1').name() == 'dodval1'
|
||||||
assert cfg.option('od.dodval2').name() == 'dodval2'
|
assert cfg.option('od.dodval2').name() == 'dodval2'
|
||||||
|
assert cfg.option('od.dodval1').name(uncalculated=True) == cfg.option('od.dodval2').name(uncalculated=True) == 'dod'
|
||||||
assert cfg.option('od.dodval1.st').doc() == 'doc1'
|
assert cfg.option('od.dodval1.st').doc() == 'doc1'
|
||||||
assert cfg.option('od.dodval2.st').doc() == 'doc1'
|
assert cfg.option('od.dodval2.st').doc() == 'doc1'
|
||||||
assert cfg.option('od.dodval1').doc() == 'doc2'
|
assert cfg.option('od.dodval1').doc() == 'doc2'
|
||||||
|
|
@ -173,6 +191,20 @@ def test_getdoc_dyndescription():
|
||||||
# assert not list_sessions()
|
# assert not list_sessions()
|
||||||
|
|
||||||
|
|
||||||
|
def test_dyndescription_path():
|
||||||
|
st1 = StrOption('st', 'doc1')
|
||||||
|
dod = DynOptionDescription('dod', 'doc2', [st1], suffixes=Calculation(return_list))
|
||||||
|
od1 = OptionDescription('od', '', [dod])
|
||||||
|
od2 = OptionDescription('od', '', [od1])
|
||||||
|
cfg = Config(od2)
|
||||||
|
assert cfg.option('od.dodval1.st').path() == 'od.dodval1.st'
|
||||||
|
assert cfg.option('od.dodval2.st').path() == 'od.dodval2.st'
|
||||||
|
assert cfg.option('od.dodval1.st').path(uncalculated=True) == cfg.option('od.dodval2.st').path(uncalculated=True) == 'od.dod.st'
|
||||||
|
assert cfg.option('od.dodval1').path() == 'od.dodval1'
|
||||||
|
assert cfg.option('od.dodval2').path() == 'od.dodval2'
|
||||||
|
assert cfg.option('od.dodval1').path(uncalculated=True) == cfg.option('od.dodval2').path(uncalculated=True) == 'od.dod'
|
||||||
|
|
||||||
|
|
||||||
def test_mod_dyndescription():
|
def test_mod_dyndescription():
|
||||||
st = StrOption('st', '')
|
st = StrOption('st', '')
|
||||||
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
||||||
|
|
|
||||||
|
|
@ -289,6 +289,7 @@ def test_callback(config_type):
|
||||||
cfg = Config(od1)
|
cfg = Config(od1)
|
||||||
cfg.property.read_write()
|
cfg.property.read_write()
|
||||||
cfg = get_config(cfg, config_type)
|
cfg = get_config(cfg, config_type)
|
||||||
|
assert isinstance(cfg.option('val1').value.get(uncalculated=True), Calculation)
|
||||||
assert cfg.option('val1').value.get() == 'val'
|
assert cfg.option('val1').value.get() == 'val'
|
||||||
cfg.option('val1').value.set('new-val')
|
cfg.option('val1').value.set('new-val')
|
||||||
assert cfg.option('val1').value.get() == 'new-val'
|
assert cfg.option('val1').value.get() == 'new-val'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -199,9 +199,11 @@ class _TiramisuOptionWalk:
|
||||||
def _list(self,
|
def _list(self,
|
||||||
subconfig: SubConfig,
|
subconfig: SubConfig,
|
||||||
validate_properties: bool,
|
validate_properties: bool,
|
||||||
|
*,
|
||||||
|
uncalculated: bool=False,
|
||||||
):
|
):
|
||||||
options = []
|
options = []
|
||||||
for sub_subconfig in subconfig.get_children(validate_properties=validate_properties):
|
for sub_subconfig in subconfig.get_children(validate_properties, uncalculated=uncalculated):
|
||||||
options.append(TiramisuOption(sub_subconfig.path,
|
options.append(TiramisuOption(sub_subconfig.path,
|
||||||
sub_subconfig.index,
|
sub_subconfig.index,
|
||||||
self._config_bag,
|
self._config_bag,
|
||||||
|
|
@ -243,15 +245,23 @@ class _TiramisuOptionOptionDescription:
|
||||||
)
|
)
|
||||||
|
|
||||||
@option_type(['optiondescription', 'option', 'symlink', 'with_or_without_index'])
|
@option_type(['optiondescription', 'option', 'symlink', 'with_or_without_index'])
|
||||||
def name(self) -> str:
|
def name(self,
|
||||||
|
*,
|
||||||
|
uncalculated: bool=False,
|
||||||
|
) -> str:
|
||||||
"""Get option name"""
|
"""Get option name"""
|
||||||
#FIXME impl_getname ?
|
if uncalculated:
|
||||||
|
return self._subconfig.option.impl_getname()
|
||||||
return self._subconfig.true_path.rsplit('.', 1)[-1]
|
return self._subconfig.true_path.rsplit('.', 1)[-1]
|
||||||
|
|
||||||
@option_type(['optiondescription', 'option', 'with_or_without_index', 'symlink'])
|
@option_type(['optiondescription', 'option', 'with_or_without_index', 'symlink'])
|
||||||
def path(self,
|
def path(self,
|
||||||
|
*,
|
||||||
|
uncalculated: bool=False,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Get option path"""
|
"""Get option path"""
|
||||||
|
if uncalculated:
|
||||||
|
return self._subconfig.option.impl_getpath()
|
||||||
return self._subconfig.true_path
|
return self._subconfig.true_path
|
||||||
|
|
||||||
@option_type(['optiondescription', 'option', 'symlink', 'with_or_without_index'])
|
@option_type(['optiondescription', 'option', 'symlink', 'with_or_without_index'])
|
||||||
|
|
@ -281,9 +291,14 @@ class _TiramisuOptionOptionDescription:
|
||||||
return option.get_type()
|
return option.get_type()
|
||||||
|
|
||||||
@option_type(['option', 'optiondescription', 'symlink', 'with_or_without_index'])
|
@option_type(['option', 'optiondescription', 'symlink', 'with_or_without_index'])
|
||||||
def isdynamic(self):
|
def isdynamic(self,
|
||||||
|
*,
|
||||||
|
only_self: bool=False):
|
||||||
"""Test if option is a dynamic optiondescription"""
|
"""Test if option is a dynamic optiondescription"""
|
||||||
|
if not only_self:
|
||||||
return self._subconfig.is_dynamic
|
return self._subconfig.is_dynamic
|
||||||
|
return self._subconfig.option.impl_is_optiondescription() and \
|
||||||
|
self._subconfig.option.impl_is_dynoptiondescription()
|
||||||
|
|
||||||
@option_type(['option', 'leadership'])
|
@option_type(['option', 'leadership'])
|
||||||
def leader(self):
|
def leader(self):
|
||||||
|
|
@ -304,9 +319,16 @@ class _TiramisuOptionOptionDescription:
|
||||||
)
|
)
|
||||||
|
|
||||||
@option_type(['dynamic', 'with_or_without_index'])
|
@option_type(['dynamic', 'with_or_without_index'])
|
||||||
def suffixes(self):
|
def suffixes(self,
|
||||||
|
only_self: bool=False,
|
||||||
|
):
|
||||||
"""Get suffixes for dynamic option"""
|
"""Get suffixes for dynamic option"""
|
||||||
|
if not only_self:
|
||||||
return self._subconfig.suffixes
|
return self._subconfig.suffixes
|
||||||
|
if not self._subconfig.option.impl_is_optiondescription() or \
|
||||||
|
not self._subconfig.option.impl_is_dynoptiondescription():
|
||||||
|
raise ConfigError(_(f'the option {self._subconfig.path} is not a dynamic option, cannot get suffixes with only_self parameter to True'))
|
||||||
|
return self._subconfig.option.get_suffixes(self._subconfig.parent)
|
||||||
|
|
||||||
|
|
||||||
class _TiramisuOptionOption(_TiramisuOptionOptionDescription):
|
class _TiramisuOptionOption(_TiramisuOptionOptionDescription):
|
||||||
|
|
@ -447,6 +469,7 @@ class TiramisuOptionProperty(CommonTiramisuOption):
|
||||||
|
|
||||||
@option_type(['option', 'optiondescription', 'with_index', 'symlink'])
|
@option_type(['option', 'optiondescription', 'with_index', 'symlink'])
|
||||||
def get(self,
|
def get(self,
|
||||||
|
*,
|
||||||
only_raises: bool=False,
|
only_raises: bool=False,
|
||||||
apply_requires: bool=True,
|
apply_requires: bool=True,
|
||||||
uncalculated: bool=False,
|
uncalculated: bool=False,
|
||||||
|
|
@ -591,7 +614,6 @@ class _TiramisuODGet():
|
||||||
"""exports the whole config into a `dict`
|
"""exports the whole config into a `dict`
|
||||||
:returns: dict of Option's name (or path) and values
|
:returns: dict of Option's name (or path) and values
|
||||||
"""
|
"""
|
||||||
#for self._subconfig, value in self._config_bag.context.walk(root_self._subconfig):
|
|
||||||
def parse_od_get(values):
|
def parse_od_get(values):
|
||||||
ret_ = {}
|
ret_ = {}
|
||||||
for subconfig, value in values.items():
|
for subconfig, value in values.items():
|
||||||
|
|
@ -604,19 +626,6 @@ class _TiramisuODGet():
|
||||||
value = parse_od_get(value)
|
value = parse_od_get(value)
|
||||||
ret_[option] = value
|
ret_[option] = value
|
||||||
return ret_
|
return ret_
|
||||||
# else:
|
|
||||||
# leader_ret = []
|
|
||||||
# leader = data['leader']
|
|
||||||
# for idx, value in enumerate(self.get_value(leader,
|
|
||||||
# need_help=False,
|
|
||||||
# )):
|
|
||||||
# leader_dict = {leader: value}
|
|
||||||
# for follower in data.get(idx, []):
|
|
||||||
# leader_dict[follower] = self.get_value(follower,
|
|
||||||
# need_help=False,
|
|
||||||
# )
|
|
||||||
# leader_ret.append(leader_dict)
|
|
||||||
# ret[leader] = leader_ret
|
|
||||||
return parse_od_get(self._config_bag.context.walk(root_subconfig))
|
return parse_od_get(self._config_bag.context.walk(root_subconfig))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -625,11 +634,18 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
|
||||||
_validate_properties = True
|
_validate_properties = True
|
||||||
|
|
||||||
@option_type(['option', 'symlink', 'with_index', 'optiondescription'])
|
@option_type(['option', 'symlink', 'with_index', 'optiondescription'])
|
||||||
def get(self):
|
def get(self,
|
||||||
|
*,
|
||||||
|
uncalculated: bool=False,
|
||||||
|
):
|
||||||
"""Get value for an option or option and sub option with values with optiondescription"""
|
"""Get value for an option or option and sub option with values with optiondescription"""
|
||||||
if self._subconfig.option.impl_is_optiondescription():
|
if self._subconfig.option.impl_is_optiondescription():
|
||||||
|
if uncalculated:
|
||||||
|
raise ConfigError('uncalculated is not allowed for optiondescription')
|
||||||
return self._od_get(self._subconfig)
|
return self._od_get(self._subconfig)
|
||||||
return self._get()
|
if uncalculated:
|
||||||
|
return self._subconfig.option.impl_getdefault()
|
||||||
|
return self._get(uncalculated)
|
||||||
|
|
||||||
def _get(self,
|
def _get(self,
|
||||||
need_help: bool=True,
|
need_help: bool=True,
|
||||||
|
|
@ -688,9 +704,14 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@option_type(['choice', 'with_index'])
|
@option_type(['choice', 'with_index'])
|
||||||
def list(self):
|
def list(self,
|
||||||
|
*,
|
||||||
|
uncalculated: bool=False,
|
||||||
|
):
|
||||||
"""All values available for a ChoiceOption"""
|
"""All values available for a ChoiceOption"""
|
||||||
return self._subconfig.option.impl_get_values(self._subconfig)
|
return self._subconfig.option.impl_get_values(self._subconfig,
|
||||||
|
uncalculated,
|
||||||
|
)
|
||||||
|
|
||||||
@option_type('leader')
|
@option_type('leader')
|
||||||
def pop(self,
|
def pop(self,
|
||||||
|
|
@ -811,11 +832,14 @@ class TiramisuOption(CommonTiramisu,
|
||||||
|
|
||||||
@option_type('optiondescription')
|
@option_type('optiondescription')
|
||||||
def list(self,
|
def list(self,
|
||||||
|
*,
|
||||||
validate_properties: bool=True,
|
validate_properties: bool=True,
|
||||||
|
uncalculated: bool=False,
|
||||||
):
|
):
|
||||||
"""List options inside an option description (by default list only option)"""
|
"""List options inside an option description (by default list only option)"""
|
||||||
return self._list(self._subconfig,
|
return self._list(self._subconfig,
|
||||||
validate_properties,
|
validate_properties,
|
||||||
|
uncalculated=uncalculated,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _load_dict(self,
|
def _load_dict(self,
|
||||||
|
|
@ -1062,6 +1086,7 @@ class TiramisuContextProperty(TiramisuConfig, PropertyPermissive):
|
||||||
self._set(frozenset(props))
|
self._set(frozenset(props))
|
||||||
|
|
||||||
def get(self,
|
def get(self,
|
||||||
|
*,
|
||||||
only_raises: bool=False,
|
only_raises: bool=False,
|
||||||
apply_requires: bool=True,
|
apply_requires: bool=True,
|
||||||
uncalculated: bool=False,
|
uncalculated: bool=False,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"cache used by storage"
|
"cache used by storage"
|
||||||
# Copyright (C) 2013-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2013-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -296,12 +296,14 @@ class SubConfig:
|
||||||
|
|
||||||
def get_children(self,
|
def get_children(self,
|
||||||
validate_properties,
|
validate_properties,
|
||||||
|
*,
|
||||||
|
uncalculated: bool=False,
|
||||||
):
|
):
|
||||||
if self.option.impl_is_leadership():
|
if self.option.impl_is_leadership():
|
||||||
yield from self.get_leadership_children(validate_properties)
|
yield from self.get_leadership_children(validate_properties)
|
||||||
else:
|
else:
|
||||||
for child in self.option.get_children():
|
for child in self.option.get_children():
|
||||||
if child.impl_is_dynoptiondescription():
|
if child.impl_is_dynoptiondescription() and not uncalculated:
|
||||||
yield from self.dyn_to_subconfig(child,
|
yield from self.dyn_to_subconfig(child,
|
||||||
validate_properties,
|
validate_properties,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2018-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2018-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: UTF-8 -*-
|
# -*- coding: UTF-8 -*-
|
||||||
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"logger for tiramisu"
|
"logger for tiramisu"
|
||||||
# Copyright (C) 2019-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2019-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -58,12 +58,15 @@ class ChoiceOption(Option):
|
||||||
|
|
||||||
def impl_get_values(self,
|
def impl_get_values(self,
|
||||||
subconfig: "SubConfig",
|
subconfig: "SubConfig",
|
||||||
|
uncalculated: bool=False,
|
||||||
):
|
):
|
||||||
"""get values allowed by option
|
"""get values allowed by option
|
||||||
"""
|
"""
|
||||||
choices = self._choice_values
|
choices = self._choice_values
|
||||||
if isinstance(choices, tuple):
|
if isinstance(choices, tuple):
|
||||||
choices = list(choices)
|
choices = list(choices)
|
||||||
|
if uncalculated:
|
||||||
|
return choices
|
||||||
values = get_calculated_value(subconfig,
|
values = get_calculated_value(subconfig,
|
||||||
choices,
|
choices,
|
||||||
)[0]
|
)[0]
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -45,17 +45,13 @@ class DomainnameOption(StrOption):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
name: str,
|
name: str,
|
||||||
doc: str,
|
doc: str,
|
||||||
default: Any=undefined,
|
*args,
|
||||||
default_multi: Any=None,
|
|
||||||
multi: bool=False,
|
|
||||||
validators: Optional[List[Calculation]]=None,
|
|
||||||
properties: Optional[List[str]]=None,
|
|
||||||
warnings_only: bool=False,
|
|
||||||
allow_ip: bool=False,
|
allow_ip: bool=False,
|
||||||
allow_cidr_network: bool=False,
|
allow_cidr_network: bool=False,
|
||||||
type: str='domainname',
|
type: str='domainname',
|
||||||
allow_without_dot: bool=False,
|
allow_without_dot: bool=False,
|
||||||
allow_startswith_dot: bool=False,
|
allow_startswith_dot: bool=False,
|
||||||
|
**kwargs,
|
||||||
) -> None:
|
) -> None:
|
||||||
# pylint: disable=too-many-branches,too-many-locals,too-many-arguments
|
# pylint: disable=too-many-branches,too-many-locals,too-many-arguments
|
||||||
if type not in ['netbios', 'hostname', 'domainname']:
|
if type not in ['netbios', 'hostname', 'domainname']:
|
||||||
|
|
@ -94,24 +90,23 @@ class DomainnameOption(StrOption):
|
||||||
extra['_has_upper'] = re.compile('[A-Z]')
|
extra['_has_upper'] = re.compile('[A-Z]')
|
||||||
if allow_ip:
|
if allow_ip:
|
||||||
extra['_ip'] = IPOption(name,
|
extra['_ip'] = IPOption(name,
|
||||||
doc)
|
doc,
|
||||||
|
)
|
||||||
extra['_allow_ip'] = allow_ip
|
extra['_allow_ip'] = allow_ip
|
||||||
if allow_cidr_network:
|
if allow_cidr_network:
|
||||||
extra['_network'] = NetworkOption(name,
|
extra['_network'] = NetworkOption(name,
|
||||||
doc,
|
doc,
|
||||||
cidr=True)
|
cidr=True,
|
||||||
|
)
|
||||||
extra['_allow_cidr_network'] = allow_cidr_network
|
extra['_allow_cidr_network'] = allow_cidr_network
|
||||||
extra['_allow_startswith_dot'] = allow_startswith_dot
|
extra['_allow_startswith_dot'] = allow_startswith_dot
|
||||||
|
|
||||||
super().__init__(name,
|
super().__init__(name,
|
||||||
doc,
|
doc,
|
||||||
default=default,
|
*args,
|
||||||
default_multi=default_multi,
|
extra=extra,
|
||||||
multi=multi,
|
**kwargs,
|
||||||
validators=validators,
|
)
|
||||||
properties=properties,
|
|
||||||
warnings_only=warnings_only,
|
|
||||||
extra=extra)
|
|
||||||
|
|
||||||
def _get_len(self, type_):
|
def _get_len(self, type_):
|
||||||
if type_ == 'netbios':
|
if type_ == 'netbios':
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"Leadership support"
|
"Leadership support"
|
||||||
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2020-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2020-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"option types and option description"
|
"option types and option description"
|
||||||
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2014-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2014-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -86,7 +86,7 @@ class CacheOptionDescription(BaseOption):
|
||||||
force_store_values,
|
force_store_values,
|
||||||
dependencies_information,
|
dependencies_information,
|
||||||
)
|
)
|
||||||
else:
|
elif not option.impl_is_symlinkoption():
|
||||||
informations = option.get_dependencies_information()
|
informations = option.get_dependencies_information()
|
||||||
if informations:
|
if informations:
|
||||||
for param in informations.pop(None):
|
for param in informations.pop(None):
|
||||||
|
|
@ -94,7 +94,6 @@ class CacheOptionDescription(BaseOption):
|
||||||
for information, options in option.get_dependencies_information().items():
|
for information, options in option.get_dependencies_information().items():
|
||||||
if None in options:
|
if None in options:
|
||||||
dependencies_information.setdefault(information, []).append(option)
|
dependencies_information.setdefault(information, []).append(option)
|
||||||
if not option.impl_is_symlinkoption():
|
|
||||||
properties = option.impl_getproperties()
|
properties = option.impl_getproperties()
|
||||||
if 'force_store_value' in properties:
|
if 'force_store_value' in properties:
|
||||||
force_store_values.append(option)
|
force_store_values.append(option)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2023-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -41,13 +41,7 @@ class URLOption(StrOption):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
name: str,
|
name: str,
|
||||||
doc: str,
|
doc: str,
|
||||||
default: Any=undefined,
|
*args,
|
||||||
default_multi: Any=None,
|
|
||||||
multi: bool=False,
|
|
||||||
validators: Optional[List[Calculation]]=None,
|
|
||||||
properties: Optional[List[str]]=None,
|
|
||||||
warnings_only: bool=False,
|
|
||||||
extra: Optional[Dict]=None,
|
|
||||||
allow_ip: bool=False,
|
allow_ip: bool=False,
|
||||||
type: str='domainname',
|
type: str='domainname',
|
||||||
allow_without_dot=False,
|
allow_without_dot=False,
|
||||||
|
|
@ -55,7 +49,9 @@ class URLOption(StrOption):
|
||||||
allow_zero: bool=False,
|
allow_zero: bool=False,
|
||||||
allow_wellknown: bool=True,
|
allow_wellknown: bool=True,
|
||||||
allow_registred: bool=True,
|
allow_registred: bool=True,
|
||||||
allow_private: bool=False) -> None:
|
allow_private: bool=False,
|
||||||
|
**kwargs,
|
||||||
|
) -> None:
|
||||||
# pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
|
# pylint: disable=too-many-arguments,too-many-locals,redefined-builtin
|
||||||
extra = {'_domainname': DomainnameOption(name,
|
extra = {'_domainname': DomainnameOption(name,
|
||||||
doc,
|
doc,
|
||||||
|
|
@ -71,13 +67,10 @@ class URLOption(StrOption):
|
||||||
allow_private=allow_private)}
|
allow_private=allow_private)}
|
||||||
super().__init__(name,
|
super().__init__(name,
|
||||||
doc,
|
doc,
|
||||||
default=default,
|
extra=extra,
|
||||||
default_multi=default_multi,
|
*args,
|
||||||
multi=multi,
|
**kwargs,
|
||||||
validators=validators,
|
)
|
||||||
properties=properties,
|
|
||||||
warnings_only=warnings_only,
|
|
||||||
extra=extra)
|
|
||||||
|
|
||||||
def _get_domain_port_files(self,
|
def _get_domain_port_files(self,
|
||||||
value: str) -> (str, str):
|
value: str) -> (str, str):
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2017-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2017-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"sets the options of the configuration objects Config object itself"
|
"sets the options of the configuration objects Config object itself"
|
||||||
# Copyright (C) 2012-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2012-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"takes care of the option's values and multi values"
|
"takes care of the option's values and multi values"
|
||||||
# Copyright (C) 2013-2023 Team tiramisu (see AUTHORS for all contributors)
|
# Copyright (C) 2013-2024 Team tiramisu (see AUTHORS for all contributors)
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify it
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU Lesser General Public License as published by the
|
# under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue