コード例 #1
0
def get_args(args):
    parser = argparse.ArgumentParser(
        description=
        'Add a tag to provided items (and optionally their children)',
        parents=[scu.create_input_arg_parser(),
                 scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument(
        '--types2exclude',
        nargs='+',
        help="List of Item Types to Explicitly Exclude getting - \
                        by default 'User', 'Lab', 'Award', 'OntologyTerm', 'Ontology', \
                        and 'Organism' are excluded - add others using this argument"
    )
    parser.add_argument(
        '--types2include',
        nargs='+',
        help="List of Item Types (that are usually excluded - see \
                        --types2exclude help) that you want to include")
    parser.add_argument('--no_children',
                        nargs='+',
                        help="List of Item types not to get children of")
    parser.add_argument('--include_released',
                        default=False,
                        action='store_true',
                        help='Normally released items are skipped \
                        - this flag includes them in the final list')
    args = parser.parse_args(args)
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #2
0
def get_args():  # pragma: no cover
    parser = argparse.ArgumentParser(
        description='Given a file of item jsons try to load into database',
        parents=[create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )

    parser.add_argument('infile',
                        help="the datafile containing json formatted items")
    parser.add_argument(
        '--itypes',
        nargs='*',
        help=
        "The item type(s) to load if not specified in the file by store key(s)"
    )
    parser.add_argument(
        '--id-field',
        help=
        "Field name to used as identifier for items (all item types in file)")
    parser.add_argument(
        '--as-file',
        default=False,
        action='store_true',
        help=
        "Will attempt to load and process the file directly in the request. "
        "This currently only works locally or if the file has been uploaded to "
        "the apps file system")
    args = parser.parse_args()
    if args.key:
        args.key = convert_key_arg_to_dict(args.key)
    return args
コード例 #3
0
def get_args(args):
    parser = argparse.ArgumentParser(
        parents=[scu.create_input_arg_parser(),
                 scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument('field', help="The field to update.")
    parser.add_argument(
        'value',
        help="The value(s) to update. Array fields need \"''\" surround \
                        even if only a single value i.e. \"'value here'\" or \"'v1' 'v2'\""
    )
    parser.add_argument('--isarray',
                        default=False,
                        action='store_true',
                        help="Field is an array.  Default is False \
                        use this so value is correctly formatted even if only a single value"
                        )
    parser.add_argument(
        '--numtype',
        help=
        "options: 'i' or 'f' If the field value is integer or number deal accordingly"
    )
    args = parser.parse_args(args)
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #4
0
def test_convert_key_arg_to_dict_good_key():
    inkey = "{'key': 'ABCDEF', 'secret': 'supersecret', 'server': 'https://data.4dnucleome.org'}"
    outkey = scu.convert_key_arg_to_dict(inkey)
    assert outkey == {
        'key': 'ABCDEF',
        'secret': 'supersecret',
        'server': 'https://data.4dnucleome.org'
    }
コード例 #5
0
def get_args(args):
    parser = argparse.ArgumentParser(
        formatter_class=argparse.RawDescriptionHelpFormatter,
        parents=[scu.create_ff_arg_parser()],
    )
    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #6
0
def get_args():  # pragma: no cover
    parser = argparse.ArgumentParser(
        description='Provide a search query suffix and get a list of item uuids',
        parents=[scu.create_ff_arg_parser(), scu.create_input_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #7
0
def get_args():
    parser = argparse.ArgumentParser(
        parents=[scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument(
        'reltag',
        help="The release tag to query DataReleaseUpdates and add to items.")
    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #8
0
def get_args():  # pragma: no cover
    parser = argparse.ArgumentParser(
        description=
        'Given a file of ontology term jsons (one per line) load into db',
        parents=[create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )

    parser.add_argument('infile',
                        help="the datafile containing object data to import")
    args = parser.parse_args()
    if args.key:
        args.key = convert_key_arg_to_dict(args.key)
    return args
コード例 #9
0
ファイル: pfs2opfs.py プロジェクト: 4dn-dcic/dcicwrangling
def get_args(args):
    parser = argparse.ArgumentParser(
        parents=[scu.create_input_arg_parser(),
                 scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument(
        '--title',
        default='Set of preliminary processed files',
        help="The title for the group of other processed files.")
    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #10
0
def get_args():  # pragma: no cover
    parser = argparse.ArgumentParser(
        description=
        'Provide a search query suffix and get a list of item uuids',
        parents=[scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument('query',
                        help="A search string \
                        eg. type=Biosource&biosource_type=primary cell")
    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #11
0
def get_args(args):
    parser = argparse.ArgumentParser(
        parents=[scu.create_ff_arg_parser(),
                 scu.create_input_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument(
        '--workflow',
        default="bef50397-4d72-4ed1-9c78-100e14e5c47f",
        help="The uuid of the workflow to use to generate the run \
                              default is File Provenance Workflow")

    args = parser.parse_args(args)
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #12
0
def get_args():
    parser = argparse.ArgumentParser(
        parents=[scu.create_input_arg_parser(), scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument('--fields',
                        nargs='+',
                        help="The item fields to retrieve/report.")
    parser.add_argument('--noid',
                        action='store_true',
                        default='False',
                        help="By default the id provided is the first column of output - this flag removes that column")

    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #13
0
ファイル: rxiv2ja.py プロジェクト: 4dn-dcic/dcicwrangling
def get_args():  # pragma: no cover
    parser = argparse.ArgumentParser(
        parents=[scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument('old',
                        help="The uuid or ID of the Biorxiv publication")
    parser.add_argument('new',
                        help="The uuid or ID of the Published Journal Article")
    parser.add_argument(
        '--vals2skip',
        nargs='+',
        help="A list of values or IDs (uuids, accessions ...) to not transfer")

    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #14
0
def get_args():  # pragma: no cover
    parser = argparse.ArgumentParser(
        description=
        'Add a tag to provided items (and optionally their children)',
        parents=[scu.create_input_arg_parser(),
                 scu.create_ff_arg_parser()],
        formatter_class=argparse.RawDescriptionHelpFormatter,
    )
    parser.add_argument('tag',
                        help="The tag you want to add - eg. '4DN Standard'")
    parser.add_argument('--taglinked',
                        default=False,
                        action='store_true',
                        help='Tag items linked to items that are input')
    parser.add_argument(
        '--types2exclude',
        nargs='+',
        help="List of Item Types to Explicitly Exclude Tagging - \
                        you may have some linked items that can get tags but may \
                        not want to tag them with this tag")
    args = parser.parse_args()
    if args.key:
        args.key = scu.convert_key_arg_to_dict(args.key)
    return args
コード例 #15
0
def test_convert_key_arg_to_dict_bad_key(capsys):
    inkey = "{'key': 'ABCDEF', 'secret': 'supersecret'}"
    with pytest.raises(SystemExit):
        scu.convert_key_arg_to_dict(inkey)
        out = capsys.readouterr()[0]
        assert out == "You included a key argument but it appears to be malformed or missing required info - see --help"