Skip to content

Commit

Permalink
Merge pull request #271 from 4dn-dcic/kmp_license_and_contribution_utils
Browse files Browse the repository at this point in the history
Add contribution_utils to license_utils for more complete unit testing
  • Loading branch information
netsettler authored Jul 28, 2023
2 parents e33627b + 6b62ec8 commit 8c767ff
Show file tree
Hide file tree
Showing 13 changed files with 1,538 additions and 30 deletions.
143 changes: 143 additions & 0 deletions CONTRIBUTORS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"forked_at": "2017-11-27T11:53:17-05:00",
"excluded_fork": null,
"pre_fork_contributors_by_name": null,
"contributors_by_name": {
"Alex Balashov": {
"emails": [
"[email protected]"
],
"names": [
"Alex Balashov",
"Alexander Balashov"
]
},
"Alexander Veit": {
"emails": [
"[email protected]"
],
"names": [
"Alexander Veit"
]
},
"Andrea Cosolo": {
"emails": [
"[email protected]"
],
"names": [
"Andrea Cosolo"
]
},
"Andy Schroeder": {
"emails": [
"[email protected]"
],
"names": [
"Andy Schroeder",
"aschroed"
]
},
"Carl Vitzthum": {
"emails": [
"[email protected]",
"[email protected]"
],
"names": [
"Carl Vitzthum"
]
},
"David Michaels": {
"emails": [
"[email protected]",
"[email protected]",
"[email protected]"
],
"names": [
"David Michaels",
"dmichaels-harvard"
]
},
"Douglas Rioux": {
"emails": [
"[email protected]",
"[email protected]"
],
"names": [
"Douglas Rioux",
"drio18"
]
},
"Eric Berg": {
"emails": [
"[email protected]"
],
"names": [
"Eric Berg"
]
},
"Jeremy Johnson": {
"emails": [
"[email protected]"
],
"names": [
"Jeremy Johnson",
"j1z0"
]
},
"Kent M Pitman": {
"emails": [
"[email protected]",
"[email protected]"
],
"names": [
"Kent M Pitman",
"Kent Pitman"
]
},
"Koray K\u0131rl\u0131": {
"emails": [
"[email protected]",
"[email protected]"
],
"names": [
"Koray K\u0131rl\u0131"
]
},
"Luisa Mercado": {
"emails": [
"[email protected]"
],
"names": [
"Lmercadom",
"Luisa Mercado"
]
},
"Sarah Reiff": {
"emails": [
"[email protected]"
],
"names": [
"Sarah",
"Sarah Reiff"
]
},
"Soo Lee": {
"emails": [
"[email protected]"
],
"names": [
"Soo Lee",
"SooLee"
]
},
"Will Ronchetti": {
"emails": [
"[email protected]"
],
"names": [
"Will Ronchetti",
"William Ronchetti"
]
}
}
}
39 changes: 39 additions & 0 deletions dcicutils/contribution_scripts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import argparse

from dcicutils.command_utils import script_catch_errors, ScriptFailure
from .contribution_utils import Contributions, PROJECT_HOME


EPILOG = __doc__


def show_contributors(repo, exclude_fork=None, verbose=False, save_contributors=False, test=False):
contributions = Contributions(repo=repo, exclude_fork=exclude_fork, verbose=verbose)
if save_contributors:
contributions.save_contributor_data()
contributions.show_repo_contributors(error_class=ScriptFailure if test else None)


def show_contributors_main(*, simulated_args=None):
parser = argparse.ArgumentParser( # noqa - PyCharm wrongly thinks the formatter_class is specified wrong here.
description=(f"Show authors of a specified repository, which will be presumed"
f" to have been cloned as a subdirectory of $PROJECT_HOME ({PROJECT_HOME})"),
epilog=EPILOG,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument('repo', default=None,
help="name of repository to show contributors for")
parser.add_argument('--exclude', '-x', default=None,
help="name of repository that repo was forked from, whose contributors to exclude")
parser.add_argument('--save-contributors', '-s', action="store_true", default=False,
help="whether to store contributor data to CONTRIBUTORS.json")
parser.add_argument('--test', '-t', action="store_true", default=False,
help="whether to treat this as a test, erring if a cache update is needed")
parser.add_argument('--verbose', '-v', action="store_true", default=False,
help="whether to do verbose output while working")
args = parser.parse_args(args=simulated_args)

with script_catch_errors():

show_contributors(repo=args.repo, exclude_fork=args.exclude, verbose=args.verbose,
save_contributors=args.save_contributors, test=args.test)
Loading

0 comments on commit 8c767ff

Please sign in to comment.