Skip to content

Commit

Permalink
Fix lint (#804)
Browse files Browse the repository at this point in the history
* Fix lint errors for latest pylint

* Fix lint errors for latest pylint
  • Loading branch information
woodsp-ibm authored May 15, 2024
1 parent 1d56c0a commit 848d0d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions qiskit_machine_learning/connectors/torch_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
from torch.autograd import Function
from torch.nn import Module
else:
import types

# Dummy definition for torch module to prevent lint error about
# possible use of torch before assignment
torch = types.ModuleType("torch")

class Function: # type: ignore
"""Empty Function class
Expand Down
2 changes: 1 addition & 1 deletion qiskit_machine_learning/datasets/ad_hoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def ad_hoc_data(
if n == 2:
bitstring_parity = [bstr.count("1") % 2 for bstr in bitstrings]
d_m = np.diag((-1) ** np.array(bitstring_parity))
elif n == 3:
else: # n must be 3 here, as n checked above which allows only 2 and 3
bitstring_majority = [0 if bstr.count("0") > 1 else 1 for bstr in bitstrings]
d_m = np.diag((-1) ** np.array(bitstring_majority))

Expand Down

0 comments on commit 848d0d6

Please sign in to comment.