Skip to content

Commit b8b23f6

Browse files
chore: rename repo -> repo config (#263)
1 parent a792c3f commit b8b23f6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/codegen/git/clients/git_repo_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@
2626
class GitRepoClient:
2727
"""Wrapper around PyGithub's Remote Repository."""
2828

29-
repo: RepoConfig
29+
repo_config: RepoConfig
3030
github_type: GithubType = GithubType.GithubEnterprise
3131
gh_client: GithubClientType
3232
read_client: Repository
3333
access_scope: GithubScope
3434
__write_client: Repository | None # Will not be initialized if access scope is read-only
3535

3636
def __init__(self, repo_config: RepoConfig, github_type: GithubType = GithubType.GithubEnterprise, access_scope: GithubScope = GithubScope.READ) -> None:
37-
self.repo = repo_config
37+
self.repo_config = repo_config
3838
self.github_type = github_type
39-
self.gh_client = GithubClientFactory.create_from_repo(self.repo, github_type)
39+
self.gh_client = GithubClientFactory.create_from_repo(self.repo_config, github_type)
4040
self.read_client = self._create_client(GithubScope.READ)
4141
self.__write_client = self._create_client(GithubScope.WRITE) if access_scope == GithubScope.WRITE else None
4242
self.access_scope = access_scope
4343

4444
def _create_client(self, github_scope: GithubScope = GithubScope.READ) -> Repository:
45-
client = self.gh_client.get_repo_by_full_name(self.repo.full_name, github_scope=github_scope)
45+
client = self.gh_client.get_repo_by_full_name(self.repo_config.full_name, github_scope=github_scope)
4646
if not client:
47-
msg = f"Repo {self.repo.full_name} not found in {self.github_type.value}!"
47+
msg = f"Repo {self.repo_config.full_name} not found in {self.github_type.value}!"
4848
raise ValueError(msg)
4949
return client
5050

@@ -61,7 +61,7 @@ def _write_client(self) -> Repository:
6161

6262
@property
6363
def id(self) -> int:
64-
return self.repo.id
64+
return self.repo_config.id
6565

6666
@property
6767
def default_branch(self) -> str:
@@ -160,7 +160,7 @@ def get_pull_by_branch_and_state(
160160
if not base_branch_name:
161161
base_branch_name = self.default_branch
162162

163-
head_branch_name = f"{self.repo.organization_name}:{head_branch_name}"
163+
head_branch_name = f"{self.repo_config.organization_name}:{head_branch_name}"
164164

165165
# retrieve all pulls ordered by created descending
166166
prs = self.read_client.get_pulls(base=base_branch_name, head=head_branch_name, state=state, sort="created", direction="desc")

src/codegen/git/utils/codeowner_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ def create_codeowners_parser_for_repo(py_github_repo: GitRepoClient) -> CodeOwne
3131
return codeowners
3232
except Exception as e:
3333
continue
34-
logger.info(f"Failed to create CODEOWNERS parser for repo: {py_github_repo.repo.id}. Returning None.")
34+
logger.info(f"Failed to create CODEOWNERS parser for repo: {py_github_repo.repo_config.id}. Returning None.")
3535
return None
3636

3737

3838
def get_codeowners_for_pull(repo: GitRepoClient, pull: PullRequest) -> list[str]:
3939
codeowners_parser = create_codeowners_parser_for_repo(repo)
4040
if not codeowners_parser:
41-
logger.warning(f"Failed to create codeowners parser for repo: {repo.repo.id}. Returning empty list.")
41+
logger.warning(f"Failed to create codeowners parser for repo: {repo.repo_config.id}. Returning empty list.")
4242
return []
4343
codeowners_for_pull_set = set()
4444
pull_files = pull.get_files()

0 commit comments

Comments
 (0)