Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
jcjaskula-aws committed Jun 17, 2024
1 parent a74ddb5 commit da0d152
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion oqpy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,9 @@ def __init__(
elif isinstance(rhs, OQPyExpression):
ast_type = rhs.type
else:
raise TypeError("Cannot infer ast_type from lhs or rhs. Please provide it if possible.")
raise TypeError(
"Cannot infer ast_type from lhs or rhs. Please provide it if possible."
)
self.type = ast_type

# Adding floats to durations is not allowed. So we promote types as necessary.
Expand Down
8 changes: 4 additions & 4 deletions tests/test_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ def test_invalid_extern_declaration():
with pytest.raises(Exception, match="Argument.*"):
_ = declare_extern("invalid", [int32])


def test_defcals():
prog = Program()
constant = declare_waveform_generator("constant", [("length", duration), ("iq", complex128)])
Expand Down Expand Up @@ -1578,18 +1579,19 @@ class A:

def _to_oqpy_expression(self):
return DurationVar(1e-7, self.name)

@dataclass
class B:
name: str

def _to_oqpy_expression(self):
return FloatVar(1e-7, self.name)

@dataclass
class C:
def _to_oqpy_expression(self):
return 1e-7

def __rmul__(self, other):
return other * self._to_oqpy_expression()

Expand Down Expand Up @@ -2622,5 +2624,3 @@ def test_box_with_negative_duration():
with pytest.raises(ValueError, match="Expected a non-negative duration, but got -4e-09"):
with Box(prog, -4e-9):
pass


0 comments on commit da0d152

Please sign in to comment.