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