From a81cbaa9bdbc63ba50d526c4259954423d2b1447 Mon Sep 17 00:00:00 2001 From: Ori Kotek Date: Thu, 31 Aug 2023 18:35:51 +0300 Subject: [PATCH] Add in memory provider --- pr_agent/git_providers/in_memory_provider.py | 79 ++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 pr_agent/git_providers/in_memory_provider.py diff --git a/pr_agent/git_providers/in_memory_provider.py b/pr_agent/git_providers/in_memory_provider.py new file mode 100644 index 000000000..555e477d2 --- /dev/null +++ b/pr_agent/git_providers/in_memory_provider.py @@ -0,0 +1,79 @@ +import itertools +from collections import Counter +from typing import List, Optional + +from pr_agent.algo.utils import FilePatchInfo +from pr_agent.git_providers.git_provider import GitProvider + + +class InMemoryProvider(GitProvider): + def __init__(self, head_branch: str, target_branch: str, files: List[FilePatchInfo]): + self.head_branch = head_branch + self.target_branch = target_branch + self.files = files + + def is_supported(self, capability: str) -> bool: + pass + + def get_files(self) -> list[FilePatchInfo]: + return self.files + + def get_diff_files(self) -> list[FilePatchInfo]: + return self.get_files() + + def publish_description(self, pr_title: str, pr_body: str): + pass + + def publish_comment(self, pr_comment: str, is_temporary: bool = False): + pass + + def publish_inline_comment(self, body: str, relevant_file: str, relevant_line_in_file: str): + pass + + def create_inline_comment(self, body: str, relevant_file: str, relevant_line_in_file: str): + pass + + def publish_inline_comments(self, comments: list[dict]): + pass + + def publish_code_suggestions(self, code_suggestions: list) -> bool: + pass + + def publish_labels(self, labels): + pass + + def get_labels(self): + pass + + def remove_initial_comment(self): + pass + + def get_languages(self): + language_count = Counter(file.language for file in self.files) + return dict(language_count) + + def get_pr_branch(self): + pass + + def get_user_id(self): + pass + + def get_pr_description_full(self) -> str: + pass + + def get_issue_comments(self): + pass + + def get_repo_settings(self): + pass + + def add_eyes_reaction(self, issue_comment_id: int) -> Optional[int]: + pass + + def remove_reaction(self, issue_comment_id: int, reaction_id: int) -> bool: + pass + + def get_commit_messages(self): + pass + +