summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-06-15 13:26:54 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2022-06-15 13:26:54 -0400
commit6e1452d7e5008a1712aac0fb95bc4e377f95821b (patch)
tree767075d83fbb81041d727961a6c8052594a17120
parentd79b9cd87057d44e5afd384be4de7e267fd466b6 (diff)
downloadb4-6e1452d7e5008a1712aac0fb95bc4e377f95821b.tar.gz
Cosmetic cleanups to make PyCharm happier
Minor nitpicking by PyCharm, but not completely unreasonable. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py18
-rw-r--r--b4/mbox.py6
-rw-r--r--b4/pr.py8
3 files changed, 16 insertions, 16 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 5a901e9..1ac7eb1 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -395,7 +395,7 @@ class LoreMailbox:
logger.debug('Found new series v%s', lmsg.revision)
# Attempt to auto-number series from the same author who did not bother
- # to set v2, v3, etc in the patch revision
+ # to set v2, v3, etc. in the patch revision
if (lmsg.counter == 1 and lmsg.counters_inferred
and not lmsg.reply and lmsg.lsubject.patch and not lmsg.lsubject.resend):
omsg = self.series[lmsg.revision].patches[lmsg.counter]
@@ -612,7 +612,7 @@ class LoreSeries:
for fn, bh in lmsg.blob_indexes:
if fn in seenfiles:
# if we have seen this file once already, then it's a repeat patch
- # and it's no longer going to match current hash
+ # it's no longer going to match current hash
continue
seenfiles.add(fn)
if set(bh) == {'0'}:
@@ -652,7 +652,7 @@ class LoreSeries:
pdate = lmsg.date
break
- # Find latest commit on that date
+ # Find the latest commit on that date
guntil = pdate.strftime('%Y-%m-%d')
if branches:
where = branches
@@ -682,7 +682,7 @@ class LoreSeries:
for line in lines:
commit = line.split()[0]
logger.debug('commit=%s', commit)
- # We try both that commit and the one preceding it, in case it was a delete
+ # We try both that commit and the one preceding it, in case it was a deletion
# Keep track of the fewest mismatches
for tc in [commit, f'{commit}~1']:
sc, sm = self.check_applies_clean(gitdir, tc)
@@ -1368,7 +1368,7 @@ class LoreMessage:
if matches and matches.groups()[0] == matches.groups()[1]:
curfile = matches.groups()[0]
continue
- matches = re.search(r'^index\s+([0-9a-f]+)\.\.[0-9a-f]+.*$', line)
+ matches = re.search(r'^index\s+([\da-f]+)\.\.[\da-f]+.*$', line)
if matches and curfile is not None:
indexes.add((curfile, matches.groups()[0]))
return indexes
@@ -1383,7 +1383,7 @@ class LoreMessage:
# Fix some more common copypasta trailer wrapping
# Fixes: abcd0123 (foo bar
# baz quux)
- body = re.sub(r'^(\S+:\s+[0-9a-f]+\s+\([^)]+)\n([^\n]+\))', r'\1 \2', body, flags=re.M)
+ body = re.sub(r'^(\S+:\s+[\da-f]+\s+\([^)]+)\n([^\n]+\))', r'\1 \2', body, flags=re.M)
# Signed-off-by: Long Name
# <email.here@example.com>
body = re.sub(r'^(\S+:\s+[^<]+)\n(<[^>]+>)$', r'\1 \2', body, flags=re.M)
@@ -2411,16 +2411,16 @@ def check_gpg_status(status: str) -> Tuple[bool, bool, bool, Optional[str], Opti
signtime = None
# Do we have a BADSIG?
- bs_matches = re.search(r'^\[GNUPG:] BADSIG ([0-9A-F]+)\s+(.*)$', status, flags=re.M)
+ bs_matches = re.search(r'^\[GNUPG:] BADSIG ([\dA-F]+)\s+(.*)$', status, flags=re.M)
if bs_matches:
keyid = bs_matches.groups()[0]
return good, valid, trusted, keyid, signtime
- gs_matches = re.search(r'^\[GNUPG:] GOODSIG ([0-9A-F]+)\s+(.*)$', status, flags=re.M)
+ gs_matches = re.search(r'^\[GNUPG:] GOODSIG ([\dA-F]+)\s+(.*)$', status, flags=re.M)
if gs_matches:
good = True
keyid = gs_matches.groups()[0]
- vs_matches = re.search(r'^\[GNUPG:] VALIDSIG ([0-9A-F]+) (\d{4}-\d{2}-\d{2}) (\d+)', status, flags=re.M)
+ vs_matches = re.search(r'^\[GNUPG:] VALIDSIG ([\dA-F]+) (\d{4}-\d{2}-\d{2}) (\d+)', status, flags=re.M)
if vs_matches:
valid = True
signtime = vs_matches.groups()[2]
diff --git a/b4/mbox.py b/b4/mbox.py
index 05d46b5..c2e6319 100644
--- a/b4/mbox.py
+++ b/b4/mbox.py
@@ -231,12 +231,12 @@ def make_am(msgs, cmdargs, msgid):
logger.critical(' Link: %s', linkurl)
base_commit = None
- matches = re.search(r'base-commit: .*?([0-9a-f]+)', first_body, re.MULTILINE)
+ matches = re.search(r'base-commit: .*?([\da-f]+)', first_body, re.MULTILINE)
if matches:
base_commit = matches.groups()[0]
else:
# Try a more relaxed search
- matches = re.search(r'based on .*?([0-9a-f]{40})', first_body, re.MULTILINE)
+ matches = re.search(r'based on .*?([\da-f]{40})', first_body, re.MULTILINE)
if matches:
base_commit = matches.groups()[0]
@@ -492,7 +492,7 @@ def get_extra_series(msgs: list, direction: int = 1, wantvers: Optional[int] = N
seen_msgids.add(msgid)
lsub = b4.LoreSubject(msg['Subject'])
if direction > 0 and lsub.reply:
- # Does it have an "Obsoleted-by: trailer?
+ # Does it have an Obsoleted-by: trailer?
rmsg = b4.LoreMessage(msg)
trailers, mismatches = rmsg.get_trailers()
for tl in trailers:
diff --git a/b4/pr.py b/b4/pr.py
index 5a66180..6918a6d 100644
--- a/b4/pr.py
+++ b/b4/pr.py
@@ -32,12 +32,12 @@ charset.add_charset('utf-8', None)
logger = b4.logger
PULL_BODY_SINCE_ID_RE = [
- re.compile(r'changes since commit ([0-9a-f]{5,40}):', re.M | re.I)
+ re.compile(r'changes since commit ([\da-f]{5,40}):', re.M | re.I)
]
# I like these
PULL_BODY_WITH_COMMIT_ID_RE = [
- re.compile(r'fetch changes up to ([0-9a-f]{5,40}):', re.M | re.I),
+ re.compile(r'fetch changes up to ([\da-f]{5,40}):', re.M | re.I),
]
# I don't like these
@@ -286,7 +286,7 @@ def explode(gitdir, lmsg, mailfrom=None, retrieve_links=True, fpopts=None):
if prefix.lower() not in ('git', 'pull'):
prefixes.append(prefix)
- # get our to's and cc's
+ # get our To's and CC's
allto = utils.getaddresses(lmsg.msg.get_all('to', []))
allcc = utils.getaddresses(lmsg.msg.get_all('cc', []))
@@ -443,7 +443,7 @@ def get_pr_from_github(ghurl: str):
rpull = chunks[-1]
apiurl = f'https://api.github.com/repos/{rproj}/{rrepo}/pulls/{rpull}'
req = requests.session()
- # Do we have a github API key?
+ # Do we have a GitHub API key?
config = b4.get_main_config()
ghkey = config.get('gh-api-key')
if ghkey: