Skip to content

Commit

Permalink
be explicit about openqasm3.ast imports
Browse files Browse the repository at this point in the history
  • Loading branch information
braised-babbage committed Sep 9, 2024
1 parent 288a068 commit acd1536
Showing 1 changed file with 172 additions and 2 deletions.
174 changes: 172 additions & 2 deletions source/openpulse/openpulse/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,89 @@
from typing import List, Optional, Union

# Re-export the existing AST classes from openqasm3
# pylint: disable=unused-import
from openqasm3.ast import *
# This is everything _except_ CalibrationDefinition
# and CalibrationStatement, which get redefined below.
from openqasm3.ast import (
AccessControl,
AliasStatement,
AngleType,
Annotation,
ArrayLiteral,
ArrayReferenceType,
ArrayType,
AssignmentOperator,
BinaryExpression,
BinaryOperator,
BitType,
BitstringLiteral,
BoolType,
BooleanLiteral,
Box,
BranchingStatement,
BreakStatement,
CalibrationGrammarDeclaration,
Cast,
ClassicalArgument,
ClassicalAssignment,
ClassicalDeclaration,
ClassicalType,
ComplexType,
Concatenation,
ConstantDeclaration,
ContinueStatement,
DelayInstruction,
DiscreteSet,
DurationLiteral,
DurationOf,
DurationType,
EndStatement,
Expression,
ExpressionStatement,
ExternArgument,
ExternDeclaration,
FloatLiteral,
FloatType,
ForInLoop,
FunctionCall,
GateModifierName,
IODeclaration,
IOKeyword,
Identifier,
ImaginaryLiteral,
Include,
IndexExpression,
IndexedIdentifier,
IntType,
IntegerLiteral,
Pragma,
Program,
QASMNode,
QuantumArgument,
QuantumBarrier,
QuantumGate,
QuantumGateDefinition,
QuantumGateModifier,
QuantumMeasurement,
QuantumMeasurementStatement,
QuantumPhase,
QuantumReset,
QuantumStatement,
QubitDeclaration,
RangeDefinition,
ReturnStatement,
SizeOf,
Span,
Statement,
SwitchStatement,
CompoundStatement,
StretchType,
SubroutineDefinition,
TimeUnit,
UintType,
UnaryExpression,
UnaryOperator,
WhileLoop,
)


# From Pulse grammar
Expand Down Expand Up @@ -94,3 +175,92 @@ class CalibrationDefinition(Statement):
qubits: List[Identifier]
return_type: Optional[ClassicalType]
body: List[Statement]


__all__ = [
"AccessControl",
"AliasStatement",
"AngleType",
"Annotation",
"ArrayLiteral",
"ArrayReferenceType",
"ArrayType",
"AssignmentOperator",
"BinaryExpression",
"BinaryOperator",
"BitType",
"BitstringLiteral",
"BoolType",
"BooleanLiteral",
"Box",
"BranchingStatement",
"BreakStatement",
"CalibrationBlock",
"CalibrationDefinition",
"CalibrationGrammarDeclaration",
"CalibrationStatement",
"Cast",
"ClassicalArgument",
"ClassicalAssignment",
"ClassicalDeclaration",
"ClassicalType",
"ComplexType",
"Concatenation",
"ConstantDeclaration",
"ContinueStatement",
"DelayInstruction",
"DiscreteSet",
"DurationLiteral",
"DurationOf",
"DurationType",
"EndStatement",
"Expression",
"ExpressionStatement",
"ExternArgument",
"ExternDeclaration",
"FloatLiteral",
"FloatType",
"ForInLoop",
"FrameType",
"FunctionCall",
"GateModifierName",
"IODeclaration",
"IOKeyword",
"Identifier",
"ImaginaryLiteral",
"Include",
"IndexExpression",
"IndexedIdentifier",
"IntType",
"IntegerLiteral",
"PortType",
"Pragma",
"Program",
"QASMNode",
"QuantumArgument",
"QuantumBarrier",
"QuantumGate",
"QuantumGateDefinition",
"QuantumGateModifier",
"QuantumMeasurement",
"QuantumMeasurementStatement",
"QuantumPhase",
"QuantumReset",
"QuantumStatement",
"QubitDeclaration",
"RangeDefinition",
"ReturnStatement",
"SizeOf",
"Span",
"Statement",
"SwitchStatement",
"CompoundStatement",
"StretchType",
"SubroutineDefinition",
"TimeUnit",
"UintType",
"UnaryExpression",
"UnaryOperator",
"WaveformType",
"WhileLoop",
]

0 comments on commit acd1536

Please sign in to comment.