if not sources:
raise TaskError("No source was specified")
elif len(sources) > 1:
raise TaskError("Too many sources specified.")
lazy_source_mapper = LazySourceMapper(self.context.address_mapper, self.context.build_graph)
for source in sources:
target_addresses_for_source = lazy_source_mapper.target_addresses_for_source(source)
for address in target_addresses_for_source:
After Change
if not sources:
raise TaskError("No source was specified")
lazy_source_mapper = LazySourceMapper(self.context.address_mapper, self.context.build_graph)
owner_info = {}
for source in sources:
owner_info[source] = []
target_addresses_for_source = lazy_source_mapper.target_addresses_for_source(source)
for address in target_addresses_for_source:
owner_info[source].append(address.spec)
if self.get_options().output_format == "json":
yield json.dumps(owner_info, indent=4, separators=(",", ": "))
else:
if len(sources) > 1:
raise TaskError("Too many sources specified for {} output format."
.format(self.get_options().output_format))