Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@cli.command("export-cypher", help="Export to Cypher script")
@click.option("-i", "--infile", type=click.File("r"), default="-") # noqa
@click.option("-o", "--outfile", type=click.File("w"), default="-") # noqa
@click.option(
"-e",
"--edge-types",
type=click.Choice(edge_types()),
multiple=True,
default=DEFAULT_EDGE_TYPES,
help="Property types to be reified into graph edges.",
)
def export_cypher(infile, outfile, edge_types):
exporter = CypherGraphExporter(outfile, edge_types=edge_types)
export_stream(exporter, infile)
@cli.command(
"match-decide", help="Generate match decisions based purely on score"
) # noqa
@click.option("-i", "--infile", type=click.File("r"), default="-") # noqa
@click.option("-o", "--outfile", type=click.File("w"), default="-") # noqa
@click.option("-t", "--threshold", type=float, default=0.8)
def match_decide(infile, outfile, threshold):
try:
for match in Match.from_file(model, infile):
if match.decision is None:
if match.score is not None and match.score > threshold:
match.decision = True
write_object(outfile, match)
except BrokenPipeError:
raise click.Abort()
@cli.command("aggregate", help="Aggregate multiple fragments of entities")
@click.option("-i", "--infile", type=click.File("r"), default="-") # noqa
@click.option("-o", "--outfile", type=click.File("w"), default="-") # noqa
def aggregate(infile, outfile):
buffer = {}
namespace = Namespace(None)
try:
while True:
entity = read_entity(infile)
if entity is None:
break
entity = namespace.apply(entity)
if entity.id in buffer:
buffer[entity.id].merge(entity)
else:
buffer[entity.id] = entity
@cli.command("export-excel", help="Export to Excel")
@click.option("-i", "--infile", type=click.File("r"), default="-") # noqa
@click.option(
"-o", "--outfile", type=click.Path(dir_okay=False, writable=True), required=True
) # noqa
def export_excel(infile, outfile):
exporter = ExcelExporter(outfile)
export_stream(exporter, infile)
@cli.command("sieve", help="Filter out parts of entities.")
@click.option("-i", "--infile", type=click.File("r"), default="-") # noqa
@click.option("-o", "--outfile", type=click.File("w"), default="-") # noqa
@click.option(
"-s",
"--schema",
type=click.Choice(model.schemata.keys()),
multiple=True,
help="Filter out the given schemata.",
) # noqa
@click.option(
"-p", "--property", multiple=True, help="Filter out the given property names."
) # noqa
@click.option(
"-t",
"--type",
type=click.Choice([t.name for t in registry.types]),