Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_config_from_repo(repo_path, rev=None, hooks=None, check=True):
manifest = load_manifest(os.path.join(repo_path, C.MANIFEST_FILE))
config = {
'repo': 'file://{}'.format(repo_path),
'rev': rev or git.head_rev(repo_path),
'hooks': hooks or [{'id': hook['id']} for hook in manifest],
}
if check:
wrapped = validate({'repos': [config]}, CONFIG_SCHEMA)
wrapped = apply_defaults(wrapped, CONFIG_SCHEMA)
config, = wrapped['repos']
return config
else:
return config
def from_yaml(cls, dct):
dct = cfgv.apply_defaults(cfgv.validate(dct, SCHEMA), SCHEMA)
return cls(
skip_default_metrics=dct['skip_default_metrics'],
metric_package_names=dct['metric_package_names'],
repo=dct['repo'],
database=dct['database'],
exclude=re.compile(dct['exclude'].encode()),
)