Method weight args

This commit is contained in:
Auric Vente 2024-08-17 13:10:32 -06:00
parent 9e2212293d
commit 5057dfdeb0
1 changed files with 10 additions and 7 deletions

View File

@ -34,7 +34,6 @@ class ArgSpec:
defaults: dict[str, Any] defaults: dict[str, Any]
arguments: dict[str, Any] arguments: dict[str, Any]
infos: list[str] infos: list[str]
weight_info = ", proportional to the other methods. The higher this is, the more likely it is to be picked"
@staticmethod @staticmethod
def prepare() -> None: def prepare() -> None:
@ -44,6 +43,10 @@ class ArgSpec:
ArgSpec.infos = [] ArgSpec.infos = []
ArgSpec.add_arguments() ArgSpec.add_arguments()
@staticmethod
def weight_info(what: str) -> str:
return f"The weight of the '{what}' method. The greater this value, the higher its chances of being selected"
@staticmethod @staticmethod
def add_argument(key: str, info: str, **kwargs: Any) -> None: def add_argument(key: str, info: str, **kwargs: Any) -> None:
if key in ArgSpec.arguments: if key in ArgSpec.arguments:
@ -189,35 +192,35 @@ class ArgSpec:
ArgSpec.add_argument( ArgSpec.add_argument(
"weight_merge", "weight_merge",
type=int, type=int,
info=f"The weight of the merge method{ArgSpec.weight_info}", info=ArgSpec.weight_info("merge"),
) )
ArgSpec.add_argument( ArgSpec.add_argument(
"weight_triumph", "weight_triumph",
type=int, type=int,
info=f"The weight of the triumph method{ArgSpec.weight_info}", info=ArgSpec.weight_info("triumph"),
) )
ArgSpec.add_argument( ArgSpec.add_argument(
"weight_hit", "weight_hit",
type=int, type=int,
info=f"The weight of the hit method{ArgSpec.weight_info}", info=ArgSpec.weight_info("hit"),
) )
ArgSpec.add_argument( ArgSpec.add_argument(
"weight_travel", "weight_travel",
type=int, type=int,
info=f"The weight of the travel method{ArgSpec.weight_info}", info=ArgSpec.weight_info("travel"),
) )
ArgSpec.add_argument( ArgSpec.add_argument(
"weight_think", "weight_think",
type=int, type=int,
info=f"The weight of the think method{ArgSpec.weight_info}", info=ArgSpec.weight_info("think"),
) )
ArgSpec.add_argument( ArgSpec.add_argument(
"weight_words", "weight_words",
type=int, type=int,
info=f"The weight of the words method{ArgSpec.weight_info}", info=ArgSpec.weight_info("words"),
) )