Skip to content

Commit c116bd9

Browse files
committed
[github] Fix minor lint warnings (NFC)
Differential Revision: https://reviews.llvm.org/D135532
1 parent 14e4d92 commit c116bd9

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

llvm/utils/git/github-automation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import requests
1717
import sys
1818
import time
19-
from typing import *
19+
from typing import List, Optional
2020

2121
class IssueSubscriber:
2222

@@ -60,7 +60,7 @@ def phab_api_call(phab_token:str, url:str, args:dict) -> dict:
6060
return response.json()
6161

6262

63-
def phab_login_to_github_login(phab_token:str, repo:github.Repository.Repository, phab_login:str) -> str:
63+
def phab_login_to_github_login(phab_token:str, repo:github.Repository.Repository, phab_login:str) -> Optional[str]:
6464
"""
6565
Tries to translate a Phabricator login to a github login by
6666
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
9494
return None
9595
return committer.login
9696

97-
def phab_get_commit_approvers(phab_token:str, repo:github.Repository.Repository, commit:github.Commit.Commit) -> list:
97+
def phab_get_commit_approvers(phab_token:str, commit:github.Commit.Commit) -> list:
9898
args = { "corpus" : commit.commit.message }
9999
# API documentation: https://reviews.llvm.org/conduit/method/differential.parsecommitmessage/
100100
r = phab_api_call(phab_token, "https://reviews.llvm.org/api/differential.parsecommitmessage", args)
@@ -263,7 +263,7 @@ def pr_request_review(self, pr:github.PullRequest.PullRequest):
263263
"""
264264
reviewers = []
265265
for commit in pr.get_commits():
266-
approvers = phab_get_commit_approvers(self.phab_token, self.repo, commit)
266+
approvers = phab_get_commit_approvers(self.phab_token, commit)
267267
for a in approvers:
268268
login = phab_login_to_github_login(self.phab_token, self.repo, a)
269269
if not login:
@@ -334,7 +334,7 @@ def create_pull_request(self, owner:str, repo_name:str, branch:str) -> bool:
334334
head_branch = f'{owner}-{branch}'
335335
local_repo = Repo(self.llvm_project_dir)
336336
push_done = False
337-
for i in range(0,5):
337+
for _ in range(0,5):
338338
try:
339339
local_repo.git.fetch(f'https://github.com/{owner}/{repo_name}', f'{branch}:{branch}')
340340
local_repo.git.push(self.push_url, f'{branch}:{head_branch}', force=True)
@@ -388,7 +388,7 @@ def execute_command(self) -> bool:
388388
"""
389389
for line in sys.stdin:
390390
line.rstrip()
391-
m = re.search("/([a-z-]+)\s(.+)", line)
391+
m = re.search(r"/([a-z-]+)\s(.+)", line)
392392
if not m:
393393
continue
394394
command = m.group(1)

llvm/utils/git/pre-push.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,11 @@
2727
"""
2828

2929
import argparse
30-
import collections
3130
import os
32-
import re
3331
import shutil
3432
import subprocess
3533
import sys
3634
import time
37-
import getpass
3835
from shlex import quote
3936

4037
VERBOSE = False

0 commit comments

Comments
 (0)