Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def read_toml(content):
check_section_header(content)
for k, v in toml.loads(content, collections.OrderedDict).items():
if len(v.values()) and isinstance(list(v.values())[0], dict):
raise RuntimeError('malformed section header -- forgot quotes?', k)
pname, version = split_name(k)
yield WhitelistRule(pname=pname, version=version, **v)
def find(self, derivation, vulns):
"""Compiles all matching rules into a `Filtered` object."""
f = Filtered(derivation, vulns)
for cand in self.candidates(derivation.pname, derivation.version):
if cand.covers(derivation, vulns):
f.add(cand)
return f