3030class IssueProcess :
3131 """
3232 # won't be changed anymore after __init__
33- request_repo_dict = {} # request repo instance generated by different token
3433 owner = '' # issue owner
3534 assignee_candidates = {} # assignee candidates who will be assigned to handle issue
3635 language_owner = {} # language owner who may handle issue
@@ -48,10 +47,9 @@ class IssueProcess:
4847 spec_repo = None # local swagger repo path
4948 """
5049
51- def __init__ (self , issue_package : IssuePackage , request_repo_dict : Dict [ str , Repository ] ,
50+ def __init__ (self , issue_package : IssuePackage , request_repo : Repository ,
5251 assignee_candidates : Set [str ], language_owner : Set [str ]):
5352 self .issue_package = issue_package
54- self .request_repo_dict = request_repo_dict
5553 self .assignee = issue_package .issue .assignee .login if issue_package .issue .assignee else ''
5654 self .owner = issue_package .issue .user .login
5755 self .created_time = issue_package .issue .created_at
@@ -70,6 +68,7 @@ def __init__(self, issue_package: IssuePackage, request_repo_dict: Dict[str, Rep
7068 self .spec_repo = Path (os .getenv ('SPEC_REPO' ))
7169 self .typespec_json = Path (os .getenv ('TYPESPEC_JSON' ))
7270 self .language_name = "common"
71+ self .request_repo = request_repo
7372
7473 @property
7574 def for_typespec (self ) -> bool :
@@ -257,11 +256,8 @@ def update_assignee(self, assignee_to_del: str, assignee_to_add: str) -> None:
257256 def log (self , message : str ) -> None :
258257 _LOG .info (f'issue { self .issue_package .issue .number } : { message } ' )
259258
260- def request_repo (self ) -> Repository :
261- return self .request_repo_dict [self .assignee ]
262-
263259 def update_issue_instance (self ) -> None :
264- self .issue_package .issue = self .request_repo () .get_issue (self .issue_package .issue .number )
260+ self .issue_package .issue = self .request_repo .get_issue (self .issue_package .issue .number )
265261
266262 def auto_assign_policy (self ) -> str :
267263 assignees = list (self .assignee_candidates )
@@ -379,7 +375,7 @@ def run(self) -> None:
379375class Common :
380376 """ The class defines some function for all languages to reference
381377 issues_package = None # issues that need to handle
382- request_repo_dict = {} # request repo instance generated by different token
378+ request_repo # request repo instance generated by token
383379 assignee_candidates = {} # assignee candidates who will be assigned to handle issue
384380 language_owner = {} # language owner who may handle issue
385381 result = []
@@ -397,12 +393,9 @@ def __init__(self, issues_package: List[IssuePackage], language_owner: Set[str],
397393 self .date_from_target = ''
398394 self .package_name = ''
399395 self .result = []
400- self .request_repo_dict = {}
396+ self .request_repo = Github ( assignee_token ). get_repo ( REQUEST_REPO )
401397 self .issue_process_function = IssueProcess
402398
403- for assignee in self .assignee_candidates :
404- self .request_repo_dict [assignee ] = Github (assignee_token ).get_repo (REQUEST_REPO )
405-
406399 @staticmethod
407400 def for_test ():
408401 return bool (os .getenv ("TEST_ISSUE_NUMBER" ))
@@ -439,7 +432,7 @@ def output_md(idx: int, item: IssueProcess):
439432
440433 def proc_issue (self ):
441434 for item in self .issues_package :
442- issue = self .issue_process_function (item , self .request_repo_dict , self .assignee_candidates ,
435+ issue = self .issue_process_function (item , self .request_repo , self .assignee_candidates ,
443436 self .language_owner )
444437
445438 try :
0 commit comments