def instantiate(repo, validator_name=None, filename=None, rulesfiles=None):
default_validators = repo.options.get('<STR_LIT>', {})<EOL>validators = {}<EOL>if validator_name is not None:<EOL><INDENT>if validator_name in default_validators:<EOL><INDENT>validators = {<EOL>validator_name : default_validators[validator_name]<EOL>}<EOL><DEDENT>else:<EOL><INDENT>validators = {<EOL>validator_name : {<EOL>'<STR_LIT>': [],<EOL>'<STR_LIT>': {},<EOL>'<STR_LIT>': []<EOL>}<EOL>}<EOL><DEDENT><DEDENT>else:<EOL><INDENT>validators = default_validators<EOL><DEDENT>if filename is not None:<EOL><INDENT>matching_files = repo.find_matching_files([filename])<EOL>if len(matching_files) == <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>", filename)<EOL>raise Exception("<STR_LIT>")<EOL><DEDENT>for v in validators:<EOL><INDENT>validators[v]['<STR_LIT>'] = matching_files<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for v in validators:<EOL><INDENT>if '<STR_LIT>' not in validators[v]:<EOL><INDENT>validators[v]['<STR_LIT>'] = []<EOL><DEDENT>elif len(validators[v]['<STR_LIT>']) > <NUM_LIT:0>:<EOL><INDENT>matching_files = repo.find_matching_files(validators[v]['<STR_LIT>'])<EOL>validators[v]['<STR_LIT>'] = matching_files<EOL><DEDENT><DEDENT><DEDENT>if rulesfiles is not None:<EOL><INDENT>matching_files = repo.find_matching_files([rulesfiles])<EOL>if len(matching_files) == <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT>".format(rulesfiles,v))<EOL>raise Exception("<STR_LIT>")<EOL><DEDENT>for v in validators:<EOL><INDENT>validators[v]['<STR_LIT>'] = matching_files<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for v in validators:<EOL><INDENT>if '<STR_LIT>' not in validators[v]:<EOL><INDENT>validators[v]['<STR_LIT>'] = []<EOL><DEDENT>else:<EOL><INDENT>rulesfiles = validators[v]['<STR_LIT>']<EOL>matching_files = repo.find_matching_files(rulesfiles)<EOL>validators[v]['<STR_LIT>'] = matching_files<EOL><DEDENT><DEDENT><DEDENT>return validators<EOL>
Instantiate the validation specification