style: fix linting issues and whitespace cleanup

This commit is contained in:
Paul Gauthier (aider) 2025-03-08 13:38:17 -08:00
parent fe60832492
commit 18d27ab4e4
3 changed files with 9 additions and 9 deletions

View file

@ -39,7 +39,7 @@ def get_parser(default_config_files, git_root):
default=None, default=None,
help="Specify the model to use for the main chat", help="Specify the model to use for the main chat",
) )
# Add deprecated model shortcut arguments # Add deprecated model shortcut arguments
add_deprecated_model_args(parser, group) add_deprecated_model_args(parser, group)

View file

@ -96,30 +96,30 @@ def handle_deprecated_model_args(args, io):
"4_turbo": "gpt-4-1106-preview", "4_turbo": "gpt-4-1106-preview",
"35turbo": "gpt-3.5-turbo", "35turbo": "gpt-3.5-turbo",
"deepseek": "deepseek/deepseek-chat", "deepseek": "deepseek/deepseek-chat",
"o1_mini": "o1-mini", "o1_mini": "o1-mini",
"o1_preview": "o1-preview", "o1_preview": "o1-preview",
} }
# Check if any deprecated args are used # Check if any deprecated args are used
for arg_name, model_name in model_map.items(): for arg_name, model_name in model_map.items():
arg_name_clean = arg_name.replace("-", "_") arg_name_clean = arg_name.replace("-", "_")
if hasattr(args, arg_name_clean) and getattr(args, arg_name_clean): if hasattr(args, arg_name_clean) and getattr(args, arg_name_clean):
# Find preferred name to display in warning # Find preferred name to display in warning
from aider.models import MODEL_ALIASES from aider.models import MODEL_ALIASES
display_name = model_name display_name = model_name
# Check if there's a shorter alias for this model # Check if there's a shorter alias for this model
for alias, full_name in MODEL_ALIASES.items(): for alias, full_name in MODEL_ALIASES.items():
if full_name == model_name: if full_name == model_name:
display_name = alias display_name = alias
break break
# Show the warning # Show the warning
io.tool_warning( io.tool_warning(
f"The --{arg_name.replace('_', '-')} flag is deprecated and will be removed in a future version. " f"The --{arg_name.replace('_', '-')} flag is deprecated and will be removed in a"
f"Please use --model {display_name} instead." f" future version. Please use --model {display_name} instead."
) )
# Set the model # Set the model
args.model = model_name args.model = model_name
break break

View file

@ -589,7 +589,7 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
if args.openai_api_key: if args.openai_api_key:
os.environ["OPENAI_API_KEY"] = args.openai_api_key os.environ["OPENAI_API_KEY"] = args.openai_api_key
# Handle deprecated model shortcut args # Handle deprecated model shortcut args
handle_deprecated_model_args(args, io) handle_deprecated_model_args(args, io)
if args.openai_api_base: if args.openai_api_base: