Changeset View
Changeset View
Standalone View
Standalone View
swh/dataset/cli.py
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
def export_graph(ctx, export_path, export_id, formats, exclude, processes): | def export_graph(ctx, export_path, export_id, formats, exclude, processes): | ||||
"""Export the Software Heritage graph as an edge dataset.""" | """Export the Software Heritage graph as an edge dataset.""" | ||||
import uuid | import uuid | ||||
config = ctx.obj["config"] | config = ctx.obj["config"] | ||||
if not export_id: | if not export_id: | ||||
export_id = str(uuid.uuid4()) | export_id = str(uuid.uuid4()) | ||||
exclude_obj_types = {o.strip() for o in exclude.split(",")} | exclude_obj_types = {o.strip() for o in (exclude.split(",") if exclude else [])} | ||||
export_formats = [c.strip() for c in formats.split(",")] | export_formats = [c.strip() for c in formats.split(",")] | ||||
for f in export_formats: | for f in export_formats: | ||||
if f not in AVAILABLE_EXPORTERS: | if f not in AVAILABLE_EXPORTERS: | ||||
raise click.BadOptionUsage( | raise click.BadOptionUsage( | ||||
option_name="formats", message=f"{f} is not an available format." | option_name="formats", message=f"{f} is not an available format." | ||||
) | ) | ||||
# Run the exporter for each edge type. | # Run the exporter for each edge type. | ||||
Show All 38 Lines |