Skip to content

Commit

Permalink
rm filter
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles MOUSSA committed Nov 21, 2024
1 parent 5e5735e commit b1127ec
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions qadence/noise/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,12 @@ def list(cls) -> list:
return list(filter(lambda el: not el.startswith("__"), dir(cls)))

def filter(self, protocol: NoiseEnum | str) -> NoiseHandler | None:
protocol_matches: list = list()
if protocol == NoiseProtocol.READOUT:

def filter_fn(p: NoiseEnum | str) -> bool:
return p == protocol

protocol_matches = [p == protocol for p in self.protocol]
else:
protocol_matches = [isinstance(p, protocol) for p in self.protocol] # type: ignore[arg-type]

def filter_fn(p: NoiseEnum | str) -> bool:
return isinstance(p, protocol) # type: ignore[arg-type]

protocol_matches: list = list(filter(filter_fn, self.protocol))
# if we have at least a match
if True in protocol_matches:
return NoiseHandler(
Expand Down

0 comments on commit b1127ec

Please sign in to comment.