[llvm] c116bd9 - [github] Fix minor lint warnings (NFC)

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 15:47:16 PDT 2022


Author: Keith Smiley
Date: 2022-10-14T15:46:57-07:00
New Revision: c116bd9f607a0fb744ba411f7b06848bd61e4427

URL: https://github.com/llvm/llvm-project/commit/c116bd9f607a0fb744ba411f7b06848bd61e4427
DIFF: https://github.com/llvm/llvm-project/commit/c116bd9f607a0fb744ba411f7b06848bd61e4427.diff

LOG: [github] Fix minor lint warnings (NFC)

Differential Revision: https://reviews.llvm.org/D135532

Added: 
    

Modified: 
    llvm/utils/git/github-automation.py
    llvm/utils/git/pre-push.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/git/github-automation.py b/llvm/utils/git/github-automation.py
index f29adca37536..66a9534c097c 100755
--- a/llvm/utils/git/github-automation.py
+++ b/llvm/utils/git/github-automation.py
@@ -16,7 +16,7 @@
 import requests
 import sys
 import time
-from typing import *
+from typing import List, Optional
 
 class IssueSubscriber:
 
@@ -60,7 +60,7 @@ def phab_api_call(phab_token:str, url:str, args:dict) -> dict:
     return response.json()
 
 
-def phab_login_to_github_login(phab_token:str, repo:github.Repository.Repository, phab_login:str) -> str:
+def phab_login_to_github_login(phab_token:str, repo:github.Repository.Repository, phab_login:str) -> Optional[str]:
     """
     Tries to translate a Phabricator login to a github login by
     finding a commit made in Phabricator's Differential.
@@ -94,7 +94,7 @@ def phab_login_to_github_login(phab_token:str, repo:github.Repository.Repository
         return None
     return committer.login
 
-def phab_get_commit_approvers(phab_token:str, repo:github.Repository.Repository, commit:github.Commit.Commit) -> list:
+def phab_get_commit_approvers(phab_token:str, commit:github.Commit.Commit) -> list:
     args = { "corpus" : commit.commit.message }
     # API documentation: https://reviews.llvm.org/conduit/method/
diff erential.parsecommitmessage/
     r = phab_api_call(phab_token, "https://reviews.llvm.org/api/
diff erential.parsecommitmessage", args)
@@ -263,7 +263,7 @@ def pr_request_review(self, pr:github.PullRequest.PullRequest):
         """
         reviewers = []
         for commit in pr.get_commits():
-            approvers = phab_get_commit_approvers(self.phab_token, self.repo, commit)
+            approvers = phab_get_commit_approvers(self.phab_token, commit)
             for a in approvers:
                 login = phab_login_to_github_login(self.phab_token, self.repo, a)
                 if not login:
@@ -334,7 +334,7 @@ def create_pull_request(self, owner:str, repo_name:str, branch:str) -> bool:
             head_branch = f'{owner}-{branch}'
             local_repo = Repo(self.llvm_project_dir)
             push_done = False
-            for i in range(0,5):
+            for _ in range(0,5):
                 try:
                     local_repo.git.fetch(f'https://github.com/{owner}/{repo_name}', f'{branch}:{branch}')
                     local_repo.git.push(self.push_url, f'{branch}:{head_branch}', force=True)
@@ -388,7 +388,7 @@ def execute_command(self) -> bool:
         """
         for line in sys.stdin:
             line.rstrip()
-            m = re.search("/([a-z-]+)\s(.+)", line)
+            m = re.search(r"/([a-z-]+)\s(.+)", line)
             if not m:
                 continue
             command = m.group(1)

diff  --git a/llvm/utils/git/pre-push.py b/llvm/utils/git/pre-push.py
index 7ea41a9b7573..e50a91370963 100755
--- a/llvm/utils/git/pre-push.py
+++ b/llvm/utils/git/pre-push.py
@@ -27,14 +27,11 @@
 """
 
 import argparse
-import collections
 import os
-import re
 import shutil
 import subprocess
 import sys
 import time
-import getpass
 from shlex import quote
 
 VERBOSE = False


        


More information about the llvm-commits mailing list