app.processing

Provides the core logic of the backend.

Submodules

Package Contents

class app.processing.CommonProcessor(enricher: app.enricher.Enricher, frontend_graph: frontend_graph.FrontendGraph, optimize_settings: app.model.CompileRequest.OptimizeSettings)

Process a FrontendGraph.

Parameters:
Frontend_graph:

The graph to process

Optimize_settings:

Specify how to optimize the result

class app.processing.MergingProcessor(enricher: app.enricher.Enricher, frontend_graph: frontend_graph.FrontendGraph, optimize_settings: app.model.CompileRequest.OptimizeSettings)

Process request with the whole pipeline.

Parameters:
async process_nodes() None

Process graph by enriching and preprocessing the nodes.

Return type:

None

async process() str

Process the CompileRequest.

  1. Enrich frontend nodes.

  2. preprocess() frontend nodes.

  3. Optionally optimize() graph width.

  4. merge_nodes() and

  5. postprocess() into final program.

Returns:

The final QASM program as a string.

Return type:

str

class app.processing.EnrichingProcessor(enricher: app.enricher.Enricher, frontend_graph: frontend_graph.FrontendGraph, optimize_settings: app.model.CompileRequest.OptimizeSettings)

Return enrichment for all nodes.

Parameters:
async enrich() collections.abc.AsyncIterator[app.model.CompileRequest.ImplementationNode]

Yield enrichment of nodes.

Return type:

collections.abc.AsyncIterator[app.model.CompileRequest.ImplementationNode]

async enrich_all() list[app.model.CompileRequest.ImplementationNode]

Get list of all enrichments.

Return type:

list[app.model.CompileRequest.ImplementationNode]

class app.processing.EnrichmentInserter(inserts: list[app.model.CompileRequest.SingleInsert], enricher: app.enricher.Enricher, engine: sqlalchemy.ext.asyncio.AsyncEngine)

Insert enrichment implementations for frontend-nodes into the Enricher.

Parameters:
async insert_all() None

Insert all enrichments.

Return type:

None