Skip to content

Commit b18ffe2

Browse files
authored
bump version, merge pull request #88 from casperdcl/devel
2 parents 606ecb2 + 2db5f8b commit b18ffe2

File tree

5 files changed

+46
-58
lines changed

5 files changed

+46
-58
lines changed

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ jobs:
116116
if [[ $GITHUB_REF == refs/tags/v* ]]; then
117117
echo docker_tags=latest,${GITHUB_REF/refs\/tags\/v/} >> $GITHUB_OUTPUT
118118
echo snap_channel=stable,candidate,edge >> $GITHUB_OUTPUT
119-
elif [[ $GITHUB_REF == refs/heads/master ]]; then
120-
echo docker_tags=master >> $GITHUB_OUTPUT
119+
elif [[ $GITHUB_REF == refs/heads/main ]]; then
120+
echo docker_tags=main >> $GITHUB_OUTPUT
121121
echo snap_channel=candidate,edge >> $GITHUB_OUTPUT
122122
elif [[ $GITHUB_REF == refs/heads/devel ]]; then
123123
echo docker_tags=devel >> $GITHUB_OUTPUT

README.rst

+7-7
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Pull and install:
6565

6666
.. code:: sh
6767
68-
pip install "git+https://github.com/casperdcl/git-fame.git@master#egg=git-fame"
68+
pip install "git+https://github.com/casperdcl/git-fame.git@main#egg=git-fame"
6969
7070
Latest Conda release
7171
~~~~~~~~~~~~~~~~~~~~
@@ -117,7 +117,7 @@ Tab completion
117117

118118
Optionally, systems with ``bash-completion`` can install tab completion
119119
support. The
120-
`git-fame_completion.bash <https://raw.githubusercontent.com/casperdcl/git-fame/master/git-fame_completion.bash>`__
120+
`git-fame_completion.bash <https://raw.githubusercontent.com/casperdcl/git-fame/main/git-fame_completion.bash>`__
121121
file needs to be copied to an appropriate folder.
122122

123123
On Ubuntu, the procedure would be:
@@ -129,7 +129,7 @@ On Ubuntu, the procedure would be:
129129
130130
$ # Install `git fame` completions
131131
$ sudo wget \
132-
https://raw.githubusercontent.com/casperdcl/git-fame/master/git-fame_completion.bash \
132+
https://raw.githubusercontent.com/casperdcl/git-fame/main/git-fame_completion.bash \
133133
-O /etc/bash_completion.d/git-fame_completion.bash
134134
135135
followed by a terminal restart.
@@ -327,11 +327,11 @@ We are grateful for all |GitHub-Contributions|.
327327

328328
|README-Hits|
329329

330-
.. |Build-Status| image:: https://img.shields.io/github/actions/workflow/status/casperdcl/git-fame/test.yml?branch=master&label=git-fame&logo=GitHub
330+
.. |Build-Status| image:: https://img.shields.io/github/actions/workflow/status/casperdcl/git-fame/test.yml?branch=main&label=git-fame&logo=GitHub
331331
:target: https://github.com/casperdcl/git-fame/actions/workflows/test.yml
332-
.. |Coverage-Status| image:: https://img.shields.io/coveralls/github/casperdcl/git-fame/master?logo=coveralls
332+
.. |Coverage-Status| image:: https://img.shields.io/coveralls/github/casperdcl/git-fame/main?logo=coveralls
333333
:target: https://coveralls.io/github/casperdcl/git-fame
334-
.. |Branch-Coverage-Status| image:: https://codecov.io/gh/casperdcl/git-fame/branch/master/graph/badge.svg
334+
.. |Branch-Coverage-Status| image:: https://codecov.io/gh/casperdcl/git-fame/branch/main/graph/badge.svg
335335
:target: https://codecov.io/gh/casperdcl/git-fame
336336
.. |Codacy-Grade| image:: https://api.codacy.com/project/badge/Grade/bde789ee0e57491eb2bb8609bd4190c3
337337
:target: https://www.codacy.com/app/casper-dcl/git-fame/dashboard
@@ -372,7 +372,7 @@ We are grateful for all |GitHub-Contributions|.
372372
.. |OpenHub-Status| image:: https://www.openhub.net/p/git-fame/widgets/project_thin_badge?format=gif
373373
:target: https://www.openhub.net/p/git-fame?ref=Thin+badge
374374
.. |LICENCE| image:: https://img.shields.io/pypi/l/git-fame.svg?color=purple&logo=SPDX
375-
:target: https://raw.githubusercontent.com/casperdcl/git-fame/master/LICENCE
375+
:target: https://raw.githubusercontent.com/casperdcl/git-fame/main/LICENCE
376376
.. |DOI-URI| image:: https://img.shields.io/badge/DOI-10.5281/zenodo.2544975-blue.svg?color=purple&logo=ORCID
377377
:target: https://doi.org/10.5281/zenodo.2544975
378378
.. |README-Hits| image:: https://caspersci.uk.to/cgi-bin/hits.cgi?q=git-fame&style=social&r=https://github.com/casperdcl/git-fame

gitfame/_gitfame.py

+20-22
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
__version__ = get_version(root='..', relative_to=__file__)
7676
except (ImportError, LookupError):
7777
__version__ = "UNKNOWN"
78-
__author__ = "Casper da Costa-Luis <casper@caspersci.uk.to>"
78+
__author__ = "Casper da Costa-Luis <casper[email protected]>"
7979
__date__ = "2016-2023"
8080
__licence__ = "[MPLv2.0](https://mozilla.org/MPL/2.0/)"
8181
__all__ = ["main"]
@@ -107,11 +107,11 @@
107107

108108
def hours(dates, maxCommitDiffInSec=120 * 60, firstCommitAdditionInMinutes=120):
109109
"""
110-
Convert list of commit times (in seconds) to an estimate of hours spent.
110+
Convert list of commit times (in seconds) to an estimate of hours spent.
111111
112-
https://github.com/kimmobrunfeldt/git-hours/blob/\
112+
https://github.com/kimmobrunfeldt/git-hours/blob/\
113113
8aaeee237cb9d9028e7a2592a25ad8468b1f45e4/index.js#L114-L143
114-
"""
114+
"""
115115
dates = sorted(dates)
116116
diffInSec = [i - j for (i, j) in zip(dates[1:], dates[:-1])]
117117
res = sum(filter(lambda i: i < maxCommitDiffInSec, diffInSec))
@@ -121,9 +121,9 @@ def hours(dates, maxCommitDiffInSec=120 * 60, firstCommitAdditionInMinutes=120):
121121
def tabulate(auth_stats, stats_tot, sort='loc', bytype=False, backend='md', cost=None,
122122
row_nums=False):
123123
"""
124-
backends : [default: md]|yaml|json|csv|tsv|tabulate|
125-
`in tabulate.tabulate_formats`
126-
"""
124+
backends : [default: md]|yaml|json|csv|tsv|tabulate|
125+
`in tabulate.tabulate_formats`
126+
"""
127127
COL_NAMES = ['Author', 'loc', 'coms', 'fils', ' distribution']
128128
it_as = getattr(auth_stats, 'iteritems', auth_stats.items)
129129
# get ready
@@ -193,8 +193,8 @@ def tabulate(auth_stats, stats_tot, sort='loc', bytype=False, backend='md', cost
193193
else:
194194
import tabulate as tabber
195195
if backend not in tabber.tabulate_formats:
196-
raise ValueError("Unknown backend:%s" % backend)
197-
log.debug("backend:tabulate:" + backend)
196+
raise ValueError(f"Unknown backend:{backend}")
197+
log.debug("backend:tabulate:%s", backend)
198198
COL_LENS = [max(len(Str(i[j])) for i in [COL_NAMES] + tab) for j in range(len(COL_NAMES))]
199199
COL_LENS[0] = min(TERM_WIDTH - sum(COL_LENS[1:]) - len(COL_LENS) * 3 - 4, COL_LENS[0])
200200
tab = [[i[0][:COL_LENS[0]]] + i[1:] for i in tab]
@@ -208,11 +208,10 @@ def _get_auth_stats(gitdir, branch="HEAD", since=None, include_files=None, exclu
208208
silent_progress=False, ignore_whitespace=False, M=False, C=False,
209209
warn_binary=False, bytype=False, show_email=False, prefix_gitdir=False,
210210
churn=None, ignore_rev="", ignore_revs_file=None):
211-
"""Returns dict: {"<author>": {"loc": int, "files": {}, "commits": int,
212-
"ctimes": [int]}}"""
211+
"""Returns dict: {"<author>": {"loc": int, "files": {}, "commits": int, "ctimes": [int]}}"""
213212
since = ["--since", since] if since else []
214213
git_cmd = ["git", "-C", gitdir]
215-
log.debug("base command:" + ' '.join(git_cmd))
214+
log.debug("base command:%s", ' '.join(git_cmd))
216215
file_list = check_output(git_cmd + ["ls-files", "--with-tree", branch]).strip().split('\n')
217216
if not hasattr(include_files, 'search'):
218217
file_list = [
@@ -222,7 +221,7 @@ def _get_auth_stats(gitdir, branch="HEAD", since=None, include_files=None, exclu
222221
file_list = [
223222
i for i in file_list if include_files.search(i)
224223
if not (exclude_files and exclude_files.search(i))]
225-
log.log(logging.NOTSET, "files:\n" + '\n'.join(file_list))
224+
log.log(logging.NOTSET, "files:\n%s", '\n'.join(file_list))
226225
churn = churn or set()
227226

228227
if churn & CHURN_SLOC:
@@ -265,7 +264,6 @@ def stats_append(fname, auth, loc, tstamp):
265264
if churn & CHURN_SLOC:
266265
for fname in tqdm(file_list, desc=gitdir if prefix_gitdir else "Processing",
267266
disable=silent_progress, unit="file"):
268-
269267
if prefix_gitdir:
270268
fname = path.join(gitdir, fname)
271269
try:
@@ -275,12 +273,12 @@ def stats_append(fname, auth, loc, tstamp):
275273
continue
276274
log.log(logging.NOTSET, blame_out)
277275

278-
# Strip boundary messages,
279-
# preventing user with nearest commit to boundary owning the LOC
280-
blame_out = RE_BLAME_BOUNDS.sub('', blame_out)
281-
loc_auth_times = RE_AUTHS_BLAME.findall(blame_out)
276+
if since:
277+
# Strip boundary messages,
278+
# preventing user with nearest commit to boundary owning the LOC
279+
blame_out = RE_BLAME_BOUNDS.sub('', blame_out)
282280

283-
for loc, auth, tstamp in loc_auth_times: # for each chunk
281+
for loc, auth, tstamp in RE_AUTHS_BLAME.findall(blame_out): # for each chunk
284282
loc = int(loc)
285283
stats_append(fname, auth, loc, tstamp)
286284

@@ -312,7 +310,7 @@ def stats_append(fname, auth, loc, tstamp):
312310
stats_append(fname, auth, loc, tstamp)
313311

314312
# quickly count commits (even if no surviving loc)
315-
log.log(logging.NOTSET, "authors:" + '; '.join(auth_stats.keys()))
313+
log.log(logging.NOTSET, "authors:%s", '; '.join(auth_stats.keys()))
316314
auth_commits = check_output(git_cmd + ["shortlog", "-s", "-e", branch] + since)
317315
for stats in auth_stats.values():
318316
stats.setdefault("commits", 0)
@@ -347,7 +345,7 @@ def run(args):
347345
log.debug("parsing args")
348346

349347
if args.sort not in "loc commits files hours months".split():
350-
log.warning("--sort argument (%s) unrecognised\n%s" % (args.sort, __doc__))
348+
log.warning("--sort argument (%s) unrecognised\n%s", args.sort, __doc__)
351349
raise KeyError(args.sort)
352350

353351
if not args.excl:
@@ -481,7 +479,7 @@ def main(args=None):
481479
fi = resource_filename(__name__, 'git-fame.1')
482480
fo = path.join(args.manpath, 'git-fame.1')
483481
copyfile(fi, fo)
484-
log.info("written:" + fo)
482+
log.info("written:%s", fo)
485483
sys.exit(0)
486484

487485
run(args)

gitfame/_utils.py

+15-17
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
tqdm_std.set_lock(RLock())
1818
tqdm = partial(tqdm_std, lock_args=(False,))
1919

20-
__author__ = "Casper da Costa-Luis <casper@caspersci.uk.to>"
20+
__author__ = "Casper da Costa-Luis <casper[email protected]>"
2121
__date__ = "2016-2023"
2222
__licence__ = "[MPLv2.0](https://mozilla.org/MPL/2.0/)"
2323
__all__ = [
@@ -88,30 +88,28 @@ def fext(fn):
8888

8989
def int_cast_or_len(i):
9090
"""
91-
>>> int_cast_or_len(range(10))
92-
10
93-
>>> int_cast_or_len('90 foo')
94-
6
95-
>>> int_cast_or_len('90')
96-
90
97-
98-
"""
91+
>>> int_cast_or_len(range(10))
92+
10
93+
>>> int_cast_or_len('90 foo')
94+
6
95+
>>> int_cast_or_len('90')
96+
90
97+
98+
"""
9999
try:
100100
return int(i)
101-
except ValueError:
102-
return len(i)
103-
except TypeError:
101+
except (ValueError, TypeError):
104102
return len(i)
105103

106104

107105
def Max(it, empty_default=0):
108106
"""
109-
>>> Max(range(10), -1)
110-
9
111-
>>> Max(range(0), -1)
112-
-1
107+
>>> Max(range(10), -1)
108+
9
109+
>>> Max(range(0), -1)
110+
-1
113111
114-
"""
112+
"""
115113
try:
116114
return max(it)
117115
except ValueError as e:

tox.ini

+2-10
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,21 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
# deprecation warning: py{27,py2,35,36}
8-
envlist=py{27,35,36,37,38,39,310,311,py2,py3}, setup.py, nodeps
7+
envlist=py{37,38,39,310,311,py3}, setup.py, nodeps
98
isolated_build=True
109

1110
[gh-actions]
1211
python=
13-
2.7: py27
14-
3.5: py35
15-
3.6: py36
1612
3.7: py37
1713
3.8: py38
1814
3.9: py39
1915
3.10: py310
2016
3.11: py311
21-
pypy-2.7: pypy2
2217
pypy-3.7: pypy3
2318

2419
[core]
2520
deps=
2621
pytest
27-
py3{5,6}: pytest<7
2822
pytest-cov
2923
pytest-timeout
3024
coverage
@@ -41,9 +35,7 @@ deps=
4135
tqdm
4236
pyyaml
4337
commands=
44-
py{27,py2}: pytest --cov=argopt --cov-report=xml --cov-report=term -o addopts= -v --tb=short -rxs -W=error --durations=10
45-
py3{5,6}: pytest --cov=argopt --cov-report=xml --cov-report=term -o addopts= -v --tb=short -rxs -W=error --durations=0 --durations-min=0.1
46-
py3{7,8,9,10,11}: pytest --cov=argopt --cov-report=xml --cov-report=term
38+
pytest --cov=argopt --cov-report=xml --cov-report=term
4739
{[core]commands}
4840

4941
[testenv:setup.py]

0 commit comments

Comments
 (0)