diff --git a/Difficult_Rocket/utils/options.py b/Difficult_Rocket/utils/options.py index 06a6ec4..32bc06c 100644 --- a/Difficult_Rocket/utils/options.py +++ b/Difficult_Rocket/utils/options.py @@ -124,19 +124,19 @@ class Options: self.cached_options = self.option() return self.cached_options - def option_with_len(self) -> List[Union[List[Tuple[str, Any, Any]], int, Any]]: + def option_with_len(self) -> Tuple[List[Tuple[str, Union[Any, Type], Type]], int, int, int]: options = self.flush_option() max_len_key = 1 max_len_value = 1 max_len_value_t = 1 option_list = [] for key, value in options.items(): - value_t = value if isinstance(value, Type) else type(value) + value_t = value if isinstance(value, Type) else type(value) # 判定这个类型 是不是 基本类型 max_len_key = max(max_len_key, len(key)) max_len_value = max(max_len_value, len(str(value))) max_len_value_t = max(max_len_value_t, len(str(value_t))) option_list.append((key, value, value_t)) - return [option_list, max_len_key, max_len_value, max_len_value_t] + return option_list, max_len_key, max_len_value, max_len_value_t def as_markdown(self) -> str: value = self.option_with_len() diff --git a/docs/src/update_logs.md b/docs/src/update_logs.md index 1c5a2ce..8f27b7a 100644 --- a/docs/src/update_logs.md +++ b/docs/src/update_logs.md @@ -106,6 +106,10 @@ - Big refactoring, remove definition, change to reference - `Difficult_Rocket.api.types.Options` ( `Difficult_Rocket.utils.options.Options` ) - `options` -> `_options` + - `option_with_len(self) ->` + - 修改 返回值 类型+类型注释 + - Modify the return value type + type annotation + - `List[Union[List[Tuple[str, Any, Any]], int, Any]]:` -> `Tuple[List[Tuple[str, Union[Any, Type], Type]], int, int, int]` ### Add