Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move computation of is_python_issue to on_ticket.py #1904

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions sweepai/core/sweep_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,12 @@ def generate_subissues(self, retries: int = 3):
raise NoFilesException()

def get_files_to_change(
self, retries=1, pr_diffs: str | None = None
self, is_python_issue: bool, retries=1, pr_diffs: str | None = None
) -> tuple[list[FileChangeRequest], str]:
file_change_requests: list[FileChangeRequest] = []
# Todo: put retries into a constants file
# also, this retries multiple times as the calls for this function are in a for loop
try:
is_python_issue = (
sum(
[
not file_path.endswith(".py")
for file_path in self.human_message.get_file_paths()
]
)
< 2
)
logger.info(f"IS PYTHON ISSUE: {is_python_issue}")
python_issue_worked = True
if is_python_issue:
Expand Down
13 changes: 12 additions & 1 deletion sweepai/handlers/on_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ def on_ticket(
lint_mode,
) = strip_sweep(title)

is_python_issue = (
sum(
[
not file_path.endswith(".py")
for file_path in sweep_bot.human_message.get_file_paths()
]
)
< 2
)
posthog.capture(username, "is_python_issue", properties={"is_python_issue": is_python_issue})

# Flow:
# 1. Get relevant files
# 2: Get human message
Expand Down Expand Up @@ -709,7 +720,7 @@ def edit_sweep_comment(message: str, index: int, pr_message="", done=False):
# TODO(william, luke) planning here

logger.info("Fetching files to modify/create...")
file_change_requests, plan = sweep_bot.get_files_to_change()
file_change_requests, plan = sweep_bot.get_files_to_change(is_python_issue)

if not file_change_requests:
if len(title + summary) < 60:
Expand Down
Loading