Skip to content

Commit

Permalink
Add OpenQASM parser based on Pyparsing + cleanup qiskit code
Browse files Browse the repository at this point in the history
  • Loading branch information
Takishima committed Feb 17, 2021
1 parent b05ee16 commit 08917d0
Show file tree
Hide file tree
Showing 5 changed files with 1,296 additions and 442 deletions.
30 changes: 16 additions & 14 deletions projectq/libs/qasm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@
try:
from ._parse_qasm_qiskit import read_qasm_file, read_qasm_str
except ImportError: # pragma: no cover
import warnings
try:
from ._parse_qasm_pyparsing import read_qasm_file, read_qasm_str
except ImportError as e:
import warnings
err = ('Unable to import either qiskit or pyparsing\n'
'Please install either of them (e.g. using the '
'command python -m pip install qiskit')

err = ('Unable to import qiskit\n'
'Please install it (e.g. using the command: '
'python -m pip install qiskit')
warnings.warn(err + '\n'
'The provided read_qasm_* functions will systematically'
'raise a RuntimeError')

warnings.warn(err + 'c\n'
'The provided read_qasm_* functions will systematically'
'raise a RuntimeError')
def read_qasm_file(eng, filename):
# pylint: disable=unused-argument
raise RuntimeError(err)

def read_qasm_file(eng, filename):
# pylint: disable=unused-argument
raise RuntimeError(err)

def read_qasm_str(eng, qasm_str):
# pylint: disable=unused-argument
raise RuntimeError(err)
def read_qasm_str(eng, qasm_str):
# pylint: disable=unused-argument
raise RuntimeError(err)
Loading

0 comments on commit 08917d0

Please sign in to comment.