summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-04-22 17:01:24 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-04-22 17:01:24 -0700
commit5b328d8a7ddeb641d588231c1f412fa0520c0f3d (patch)
tree9ea57cad4046fac85a6330dfc37470c2a5b8b8d1
parente195e3f1f47698d9cae705bbed737b46580bc10f (diff)
downloadfatcat-5b328d8a7ddeb641d588231c1f412fa0520c0f3d.tar.gz
fatcat-5b328d8a7ddeb641d588231c1f412fa0520c0f3d.zip
editgroup description override
-rwxr-xr-xpython/fatcat_import.py12
-rw-r--r--python/fatcat_tools/importers/matched.py4
2 files changed, 13 insertions, 3 deletions
diff --git a/python/fatcat_import.py b/python/fatcat_import.py
index de5b4202..c421fb43 100755
--- a/python/fatcat_import.py
+++ b/python/fatcat_import.py
@@ -28,7 +28,8 @@ def run_journal_metadata(args):
def run_matched(args):
fmi = MatchedImporter(args.api,
- edit_batch_size=args.batch_size)
+ edit_batch_size=args.batch_size,
+ editgroup_description=args.editgroup_description_override)
JsonLinePusher(fmi, args.json_file).run()
def run_arabesque_match(args):
@@ -115,6 +116,9 @@ def main():
parser.add_argument('--batch-size',
help="size of batch to send",
default=50, type=int)
+ parser.add_argument('--editgroup-description-override',
+ help="editgroup description override",
+ default=None, type=str)
subparsers = parser.add_subparsers()
sub_crossref = subparsers.add_parser('crossref')
@@ -249,6 +253,12 @@ def main():
print("tell me what to do!")
sys.exit(-1)
+ # allow editgroup description override via env variable (but CLI arg takes
+ # precedence)
+ if not args.editgroup_description_override \
+ and os.environ.get('FATCAT_EDITGROUP_DESCRIPTION'):
+ args.editgroup_description_override = os.environ.get('FATCAT_EDITGROUP_DESCRIPTION')
+
args.api = authenticated_api(
args.host_url,
# token is an optional kwarg (can be empty string, None, etc)
diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py
index 7868fb75..5096cc97 100644
--- a/python/fatcat_tools/importers/matched.py
+++ b/python/fatcat_tools/importers/matched.py
@@ -33,9 +33,9 @@ class MatchedImporter(EntityImporter):
def __init__(self, api, **kwargs):
- eg_desc = kwargs.get('editgroup_description',
+ eg_desc = kwargs.pop('editgroup_description',
"Import of large-scale file-to-release match results. Source of metadata varies.")
- eg_extra = kwargs.get('editgroup_extra', dict())
+ eg_extra = kwargs.pop('editgroup_extra', dict())
eg_extra['agent'] = eg_extra.get('agent', 'fatcat_tools.MatchedImporter')
super().__init__(api,
editgroup_description=eg_desc,