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 036fc0f commit f77c637
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
6 changes: 2 additions & 4 deletions oqpy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,7 @@ def expr_matches(a: Any, b: Any) -> bool:
class ExpressionConvertible(Protocol):
"""This is the protocol an object can implement in order to be usable as an expression."""

def _to_oqpy_expression(self) -> HasToAst:
... # pragma: no cover
def _to_oqpy_expression(self) -> HasToAst: ... # pragma: no cover


@runtime_checkable
Expand All @@ -355,8 +354,7 @@ class CachedExpressionConvertible(Protocol):

_oqpy_cache_key: Hashable

def _to_cached_oqpy_expression(self) -> HasToAst:
... # pragma: no cover
def _to_cached_oqpy_expression(self) -> HasToAst: ... # pragma: no cover


class OQPyUnaryExpression(OQPyExpression):
Expand Down
6 changes: 2 additions & 4 deletions oqpy/control_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def ForIn(
program: Program,
iterator: Iterable[AstConvertible] | range | AstConvertible,
identifier_name: Optional[str],
) -> contextlib._GeneratorContextManager[IntVar]:
... # pragma: no cover
) -> contextlib._GeneratorContextManager[IntVar]: ... # pragma: no cover


@overload
Expand All @@ -95,8 +94,7 @@ def ForIn(
iterator: Iterable[AstConvertible] | range | AstConvertible,
identifier_name: Optional[str],
identifier_type: type[ClassicalVarT],
) -> contextlib._GeneratorContextManager[ClassicalVarT]:
... # pragma: no cover
) -> contextlib._GeneratorContextManager[ClassicalVarT]: ... # pragma: no cover


@contextlib.contextmanager
Expand Down
6 changes: 5 additions & 1 deletion oqpy/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,11 @@ def delay(
if qubits_or_frames is None:
ast_qubits_or_frames = []
else:
qubits_or_frames = list(qubits_or_frames) if isinstance(qubits_or_frames, Iterable) else [qubits_or_frames]
qubits_or_frames = (
list(qubits_or_frames)
if isinstance(qubits_or_frames, Iterable)
else [qubits_or_frames]
)
if len(qubits_or_frames) == 0:
return self
ast_qubits_or_frames = map_to_ast(self, qubits_or_frames)
Expand Down
5 changes: 2 additions & 3 deletions tests/test_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,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 @@ -1614,7 +1615,7 @@ class A:

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

@dataclass
class B:
name: str
Expand Down Expand Up @@ -2646,5 +2647,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 f77c637

Please sign in to comment.