@dallinger.command()<EOL>@click.option("<STR_LIT>")<EOL>@click.option("<STR_LIT>")<EOL>@click.option(<EOL>"<STR_LIT>",<EOL>is_flag=True,<EOL>flag_value=True,<EOL>help="<STR_LIT>",<EOL>)<EOL>@click.option("<STR_LIT>", is_flag=True, flag_value=True, help="<STR_LIT>")<EOL>@click.option("<STR_LIT>", is_flag=True, flag_value=True, help="<STR_LIT>")<EOL>@click.argument("<STR_LIT>", nargs=-<NUM_LIT:1>)<EOL>def qualify(workers, qualification, value, by_name, notify, sandbox):
if not (workers and qualification and value):<EOL><INDENT>raise click.BadParameter(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>mturk = _mturk_service_from_config(sandbox)<EOL>if by_name:<EOL><INDENT>result = mturk.get_qualification_type_by_name(qualification)<EOL>if result is None:<EOL><INDENT>raise click.BadParameter(<EOL>'<STR_LIT>'.format(qualification)<EOL>)<EOL><DEDENT>qid = result["<STR_LIT:id>"]<EOL><DEDENT>else:<EOL><INDENT>qid = qualification<EOL><DEDENT>click.echo(<EOL>"<STR_LIT>".format(<EOL>qid, value, len(workers), "<STR_LIT:s>" if len(workers) > <NUM_LIT:1> else "<STR_LIT>"<EOL>)<EOL>)<EOL>for worker in workers:<EOL><INDENT>if mturk.set_qualification_score(qid, worker, int(value), notify=notify):<EOL><INDENT>click.echo("<STR_LIT>".format(worker))<EOL><DEDENT><DEDENT>results = list(mturk.get_workers_with_qualification(qid))<EOL>click.echo("<STR_LIT>".format(len(results), qid))<EOL>for score, count in Counter([r["<STR_LIT>"] for r in results]).items():<EOL><INDENT>click.echo("<STR_LIT>".format(count, score))<EOL><DEDENT>
Assign a qualification to 1 or more workers