From 387b7602cf640a30e0e84024118edb3789ccb216 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 24 Jan 2025 09:14:51 -0800 Subject: [PATCH] style: Break long lines to comply with flake8 E501 --- aider/sendchat.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aider/sendchat.py b/aider/sendchat.py index 108da90b8..1622de24f 100644 --- a/aider/sendchat.py +++ b/aider/sendchat.py @@ -43,9 +43,10 @@ def sanity_check_messages(messages): def ensure_alternating_roles(messages): - """ - Ensure messages alternate between 'assistant' and 'user' roles. - Inserts empty messages of the opposite role when consecutive messages of the same role are found. + """Ensure messages alternate between 'assistant' and 'user' roles. + + Inserts empty messages of the opposite role when consecutive messages + of the same role are found. Args: messages: List of message dictionaries with 'role' and 'content' keys. @@ -62,7 +63,8 @@ def ensure_alternating_roles(messages): for msg in messages: current_role = msg.get("role") # Get 'role', None if missing - # If the current role is the same as the previous, insert an empty message of the opposite role + # If current role same as previous, insert empty message + # of the opposite role if current_role == prev_role: if current_role == "user": fixed_messages.append({"role": "assistant", "content": ""})