remove unused leadership_must_have_index parameter
This commit is contained in:
parent
3641eb39d8
commit
460039386a
3 changed files with 4 additions and 23 deletions
|
@ -180,7 +180,6 @@ class Calculation:
|
|||
|
||||
def execute(self,
|
||||
option_bag: OptionBag,
|
||||
leadership_must_have_index: bool=False,
|
||||
orig_value: Any=undefined,
|
||||
allow_value_error: bool=False,
|
||||
force_value_warning: bool=False,
|
||||
|
@ -191,7 +190,6 @@ class Calculation:
|
|||
callback_params=self.params,
|
||||
index=option_bag.index,
|
||||
config_bag=option_bag.config_bag,
|
||||
leadership_must_have_index=leadership_must_have_index,
|
||||
orig_value=orig_value,
|
||||
allow_value_error=allow_value_error,
|
||||
force_value_warning=force_value_warning,
|
||||
|
@ -200,12 +198,10 @@ class Calculation:
|
|||
|
||||
def help(self,
|
||||
option_bag: OptionBag,
|
||||
leadership_must_have_index: bool=False,
|
||||
for_settings: bool=False,
|
||||
) -> str:
|
||||
if not self.help_function:
|
||||
return self.execute(option_bag,
|
||||
leadership_must_have_index=leadership_must_have_index,
|
||||
for_settings=for_settings,
|
||||
)
|
||||
return carry_out_calculation(option_bag.option,
|
||||
|
@ -213,22 +209,16 @@ class Calculation:
|
|||
callback_params=self.params,
|
||||
index=option_bag.index,
|
||||
config_bag=option_bag.config_bag,
|
||||
leadership_must_have_index=leadership_must_have_index,
|
||||
for_settings=for_settings,
|
||||
)
|
||||
|
||||
|
||||
class Break(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def manager_callback(callback: Callable,
|
||||
param: Param,
|
||||
option,
|
||||
index: Optional[int],
|
||||
orig_value,
|
||||
config_bag: ConfigBag,
|
||||
leadership_must_have_index: bool,
|
||||
for_settings: bool,
|
||||
) -> Any:
|
||||
"""replace Param by true value"""
|
||||
|
@ -419,8 +409,6 @@ def manager_callback(callback: Callable,
|
|||
return option.impl_getsuffix()
|
||||
|
||||
if isinstance(param, ParamSelfOption):
|
||||
if leadership_must_have_index and option.impl_is_follower() and index is None:
|
||||
raise Break()
|
||||
value = calc_self(param,
|
||||
option,
|
||||
index,
|
||||
|
@ -473,8 +461,6 @@ def manager_callback(callback: Callable,
|
|||
suffix,
|
||||
dynopt)
|
||||
callbk_options.append(doption)
|
||||
if leadership_must_have_index and callbk_option.impl_is_follower() and index is None:
|
||||
raise Break()
|
||||
if callbk_options is None:
|
||||
callbk_options = [callbk_option]
|
||||
values = None
|
||||
|
@ -518,7 +504,6 @@ def carry_out_calculation(option,
|
|||
index: Optional[int],
|
||||
config_bag: Optional[ConfigBag],
|
||||
orig_value=undefined,
|
||||
leadership_must_have_index: bool=False,
|
||||
allow_value_error: bool=False,
|
||||
force_value_warning: bool=False,
|
||||
for_settings: bool=False,
|
||||
|
@ -554,7 +539,6 @@ def carry_out_calculation(option,
|
|||
index,
|
||||
orig_value,
|
||||
config_bag,
|
||||
leadership_must_have_index,
|
||||
for_settings,
|
||||
)
|
||||
if key is None:
|
||||
|
@ -569,8 +553,6 @@ def carry_out_calculation(option,
|
|||
args.append({'propertyerror': str(err)})
|
||||
else:
|
||||
kwargs[key] = {'propertyerror': str(err)}
|
||||
except Break:
|
||||
continue
|
||||
ret = calculate(option,
|
||||
callback,
|
||||
allow_value_error,
|
||||
|
|
|
@ -316,14 +316,15 @@ class Option(BaseOption):
|
|||
kwargs['orig_value'] = value
|
||||
|
||||
validator.execute(soption_bag,
|
||||
leadership_must_have_index=True,
|
||||
**kwargs)
|
||||
**kwargs,
|
||||
)
|
||||
except ValueWarning as warn:
|
||||
warnings.warn_explicit(ValueWarning(val,
|
||||
self.get_type(),
|
||||
self,
|
||||
str(warn),
|
||||
_index),
|
||||
_index,
|
||||
),
|
||||
ValueWarning,
|
||||
self.__class__.__name__, 319)
|
||||
|
||||
|
|
|
@ -491,12 +491,10 @@ class Settings:
|
|||
elif apply_requires:
|
||||
if not help_property:
|
||||
new_prop = prop.execute(option_bag,
|
||||
leadership_must_have_index=True,
|
||||
for_settings=True,
|
||||
)
|
||||
else:
|
||||
new_prop = prop.help(option_bag,
|
||||
leadership_must_have_index=True,
|
||||
for_settings=True,
|
||||
)
|
||||
if isinstance(new_prop, str):
|
||||
|
|
Loading…
Reference in a new issue