in probe_scraper/transform_probes.py [0:0]
def transform(probe_data, node_data, break_by_channel, revision_dates=None):
"""Transform the probe data into the final format.
:param probe_data: the preprocessed probe data.
:param node_data: the raw probe data.
:param break_by_channel: True if we want the probe output grouped by
release channel.
:param revision_dates: (optional) A dictionary of channel-revisions
and their publish date, used to sort the revisions
"""
if revision_dates is None:
channels = sorted_node_lists_by_channel(node_data)
else:
channels = sorted_node_lists_by_date(node_data, revision_dates)
result_data = {}
for channel, channel_data in channels.items():
print("\n" + channel + " - transforming probe data:")
for entry in channel_data:
node_id = entry["node_id"]
readable_version = str(entry["version"])
print(" from: " + str({"node": node_id, "version": readable_version}))
for probe_type, probes in probe_data[channel][node_id].items():
# Group the probes by the release channel, if requested
extract_node_data(
node_id,
channel,
probe_type,
probes,
result_data,
readable_version,
break_by_channel,
)
return result_data