Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def find_any(self, queries, types=None):
nodes = set()
for query in utils.listify(queries):
result = self._resolve_partial(query, None)
if result is None:
raise le.LbuildParserNodeNotFoundException(self, query, types)
nodes |= set(result)
if types:
types = utils.listify(types)
nodes = [n for n in nodes if any(n.type == t for t in types)]
return list(nodes)
def merge_module_options(self):
# only deal with repo options that contain one `:`
resolver = self.option_resolver
for name, (value, filename) in filter(lambda i: i[0].count(":") > 1,
self.config.options.items()):
try:
option = resolver[name]
option._filename = filename
option.value = value
except le.LbuildOptionException as error:
raise le.LbuildParserOptionInvalidException(self, error, filename)
except le.LbuildResolverNoMatchException as error:
raise le.LbuildParserNodeNotFoundException(self, name, self.Type.OPTION, filename)
for group in (groups[index] for index in sorted(groups)):
for modules in (group[index] for index in sorted(group, reverse=True)):
random.shuffle(modules)
for module in modules:
yield module
# Merge config collectors values
resolver = self.collector_available_resolver
for (name, value, filename) in self.config.collectors:
try:
collector = resolver[name]
collector.add_values(value, collector.repository.fullname, filename=filename)
except le.LbuildOptionException as error:
raise le.LbuildParserOptionInvalidException(self, error, filename)
except le.LbuildResolverNoMatchException as error:
raise le.LbuildParserNodeNotFoundException(self, name, self.Type.COLLECTOR, filename)
exceptions = []
for runner in walk_modules():
try:
runner.validate()
except le.LbuildException as error:
exceptions.append(error)
if exceptions:
raise le.LbuildAggregateException(exceptions)
# Cannot build without a buildlog
if buildlog is None:
return
lbuild.environment.SIMULATE = simulate
def merge_repository_options(self):
# only deal with repo options that contain one `:`
resolver = self.option_resolver
# print(self.config.options.items())
for name, (value, filename) in filter(lambda i: i[0].count(":") == 1,
self.config.options.items()):
try:
option = resolver[name]
option._filename = filename
option.value = value
except le.LbuildOptionException as error:
raise le.LbuildParserOptionInvalidException(self, error, filename)
except le.LbuildResolverNoMatchException as error:
raise le.LbuildParserNodeNotFoundException(self, name, self.Type.OPTION, filename)