• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

feihoo87 / waveforms / 6534953321

16 Oct 2023 02:19PM UTC coverage: 35.674% (-22.7%) from 58.421%
6534953321

push

github

feihoo87
fix Coveralls

5913 of 16575 relevant lines covered (35.67%)

3.21 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.47
/waveforms/qlisp/qasm/node/format.py
1
# This code is part of Qiskit.
2
#
3
# (C) Copyright IBM 2017.
4
#
5
# This code is licensed under the Apache License, Version 2.0. You may
6
# obtain a copy of this license in the LICENSE.txt file in the root directory
7
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
8
#
9
# Any modifications or derivative works of this code must retain this
10
# copyright notice, and modified files need to carry a notice indicating
11
# that they have been altered from the originals.
12

13
"""Node for an OPENQASM file identifier/version statement."""
9✔
14

15
import re
9✔
16
import warnings
9✔
17

18
from .node import Node
9✔
19

20

21
class Format(Node):
9✔
22
    """Node for an OPENQASM file identifier/version statement."""
23

24
    def __init__(self, value):
9✔
25
        """Create the version node."""
26
        super().__init__("format", None, None)
9✔
27
        parts = re.match(r'(\w+)\s+(\d+)\.(\d+)', value)
9✔
28
        self.language = parts.group(1)
9✔
29
        self.majorversion = parts.group(2)
9✔
30
        self.minorversion = parts.group(3)
9✔
31

32
    def version(self):
9✔
33
        """Return the version."""
34
        return "%s.%s" % (self.majorversion, self.minorversion)
×
35

36
    def qasm(self, prec=None):
9✔
37
        """Return the corresponding format string."""
38
        if prec is not None:
×
39
            warnings.warn('Parameter \'Format.qasm(..., prec)\' is no longer used and is being '
×
40
                          'deprecated.', DeprecationWarning, 2)
41
        return "%s %s;" % (self.language, self.version())
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc