diff --git a/.github/workflows/build-ast.yml b/.github/workflows/build-ast.yml index 8730b8b..1af92a2 100644 --- a/.github/workflows/build-ast.yml +++ b/.github/workflows/build-ast.yml @@ -75,13 +75,13 @@ jobs: - name: Build package run: python -m build --wheel --sdist . - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: openpulse-python-wheel path: ./source/openpulse/dist/*.whl if-no-files-found: error - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: openpulse-python-sdist path: ./source/openpulse/dist/*.tar.gz diff --git a/.github/workflows/deploy-ast.yml b/.github/workflows/deploy-ast.yml index f1ddd56..ab650a6 100644 --- a/.github/workflows/deploy-ast.yml +++ b/.github/workflows/deploy-ast.yml @@ -25,11 +25,11 @@ jobs: # The version checker uses 'importlib.metadata' which is Python 3.10+. python-version: '3.10' - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: openpulse-python-wheel - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: openpulse-python-sdist @@ -59,4 +59,4 @@ jobs: set -e source .venv/bin/activate python3 -mpip install -U twine - twine upload openpulse-*.whl openpulse-*.tar.gz \ No newline at end of file + twine upload openpulse-*.whl openpulse-*.tar.gz diff --git a/.github/workflows/tests-ast.yml b/.github/workflows/tests-ast.yml index 67c5878..1e32d66 100644 --- a/.github/workflows/tests-ast.yml +++ b/.github/workflows/tests-ast.yml @@ -29,7 +29,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: openpulse-python-wheel path: ./source/openpulse/ diff --git a/source/openpulse/openpulse/__init__.py b/source/openpulse/openpulse/__init__.py index 88a51a5..e8d3c1e 100644 --- a/source/openpulse/openpulse/__init__.py +++ b/source/openpulse/openpulse/__init__.py @@ -21,7 +21,7 @@ "parse", ] -__version__ = "1.0.0" +__version__ = "1.0.1" from . import ast, parser, spec from .parser import parse diff --git a/source/openpulse/openpulse/ast.py b/source/openpulse/openpulse/ast.py index 9f27009..eca5cb3 100644 --- a/source/openpulse/openpulse/ast.py +++ b/source/openpulse/openpulse/ast.py @@ -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 @@ -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", +]