Skip to content

Commit 1f9436c

Browse files
committed
pre-commit
1 parent 2a5f89e commit 1f9436c

File tree

2 files changed

+31
-26
lines changed

2 files changed

+31
-26
lines changed

github_activity/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def main():
177177
since=args.since,
178178
until=args.until,
179179
heading_level=args.heading_level,
180-
**common_kwargs
180+
**common_kwargs,
181181
)
182182

183183
if not md:

github_activity/github_activity.py

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
"""Use the GraphQL api to grab issues/PRs that match a query."""
22
import datetime
33
import os
4-
import sys
5-
import urllib
6-
from pathlib import Path
74
import re
85
import shlex
96
import subprocess
10-
from tempfile import TemporaryDirectory
7+
import sys
8+
import urllib
9+
from pathlib import Path
1110
from subprocess import PIPE
1211
from subprocess import run
12+
from tempfile import TemporaryDirectory
1313

1414
import dateutil
1515
import numpy as np
@@ -159,7 +159,7 @@ def get_activity(
159159

160160
def generate_all_activity_md(
161161
target,
162-
pattern=r'(v?\d+\.\d+\.\d+)$',
162+
pattern=r"(v?\d+\.\d+\.\d+)$",
163163
kind=None,
164164
auth=None,
165165
tags=None,
@@ -209,20 +209,26 @@ def generate_all_activity_md(
209209
"""
210210
with TemporaryDirectory() as td:
211211

212-
subprocess.run(shlex.split(f'git clone git@github.com:{target}.git repo'), cwd=td)
213-
repo = os.path.join(td, 'repo')
214-
subprocess.run(shlex.split('git fetch upstream --tags'), cwd=repo)
212+
subprocess.run(
213+
shlex.split(f"git clone git@github.com:{target}.git repo"), cwd=td
214+
)
215+
repo = os.path.join(td, "repo")
216+
subprocess.run(shlex.split("git fetch upstream --tags"), cwd=repo)
215217

216218
cmd = 'git log --tags --simplify-by-decoration --pretty="format:%h | %D"'
217-
data = subprocess.check_output(shlex.split(cmd), cwd=repo).decode('utf-8').splitlines()
219+
data = (
220+
subprocess.check_output(shlex.split(cmd), cwd=repo)
221+
.decode("utf-8")
222+
.splitlines()
223+
)
218224

219-
pattern = f'tag: {pattern}'
225+
pattern = f"tag: {pattern}"
220226

221227
def filter(datum):
222228
_, tag = datum
223229
return re.match(pattern, tag) is not None
224230

225-
data = [d.split(' | ') for (i, d) in enumerate(data)]
231+
data = [d.split(" | ") for (i, d) in enumerate(data)]
226232
data = [d for d in data if filter(d)]
227233
output = ""
228234

@@ -236,25 +242,25 @@ def filter(datum):
236242
match = re.search(pattern, curr_data[1])
237243
tag = match.groups()[0]
238244

239-
print(f'\n({i + 1}/{len(data)})', since, until, tag, file=sys.stderr)
245+
print(f"\n({i + 1}/{len(data)})", since, until, tag, file=sys.stderr)
240246
md = generate_activity_md(
241-
target,
242-
since=since,
243-
heading_level=2,
244-
until=until,
245-
auth=auth,
246-
kind=kind,
247-
include_issues=include_issues,
248-
include_opened=include_opened,
249-
strip_brackets=strip_brackets,
250-
branch=branch
251-
)
247+
target,
248+
since=since,
249+
heading_level=2,
250+
until=until,
251+
auth=auth,
252+
kind=kind,
253+
include_issues=include_issues,
254+
include_opened=include_opened,
255+
strip_brackets=strip_brackets,
256+
branch=branch,
257+
)
252258

253259
if not md:
254260
continue
255261

256262
# Replace the header line with our version tag
257-
md = '\n'.join(md.splitlines()[1:])
263+
md = "\n".join(md.splitlines()[1:])
258264

259265
output += f"""
260266
## {tag}
@@ -683,4 +689,3 @@ def _get_latest_tag():
683689
out = run("git describe --tags".split(), stdout=PIPE)
684690
tag = out.stdout.decode().rsplit("-", 2)[0]
685691
return tag
686-

0 commit comments

Comments
 (0)