Skip to content

Commit

Permalink
Fix flake8 complaints
Browse files Browse the repository at this point in the history
What:
1. Add exception for E203 whitespace before ':'
2. Ignore use of bad variable name "l"
3. Remove unused import

Why:
1. There seems to be a discrepancy between the use of ':' within a slice:
PyCQA/pycodestyle#373. Since black can handle the
whitespace regarding ':' for both in and out of slices, we ignore this error and
trust black to format it.
2. Because l is comonly used in equations for density matrices
  • Loading branch information
kimt33 committed Apr 12, 2019
1 parent 4480cf3 commit 51f48ff
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/test_ham_unrestricted_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_orb_rotate_jacobi():

theta = 2 * np.pi * (np.random.random() - 0.5)

Test = disable_abstract(BaseUnrestrictedHamiltonian)
Test = disable_abstract(BaseUnrestrictedHamiltonian) # noqa: N806
ham = Test([one_int_alpha, one_int_beta], [two_int_aaaa, two_int_abab, two_int_bbbb])

with pytest.raises(TypeError):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_solver_equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def template_params(self):
def check_cma():
"""Check if cma module is available."""
try:
import cma
import cma # noqa: F401
except ModuleNotFoundError:
return False
else:
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ ignore =
W503,
# W504 : Line break occurred after a binary operator
W504,
# E203 : Whitespace before ':'
E203,

# pylintrc
[FORMAT]
Expand Down
2 changes: 1 addition & 1 deletion wfns/ham/density.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def density_matrix(
# if double excitation
elif len(left_diff) == 2:
i, j = left_diff
k, l = right_diff
k, l = right_diff # noqa: E741
add_two_density(two_densities, i, j, k, l, val, orbtype=orbtype)
add_two_density(two_densities, j, i, l, k, val, orbtype=orbtype)
add_two_density(two_densities, k, l, i, j, val, orbtype=orbtype)
Expand Down
1 change: 0 additions & 1 deletion wfns/ham/unrestricted_chemical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import numpy as np
from wfns.backend import slater, math_tools
from wfns.ham.unrestricted_base import BaseUnrestrictedHamiltonian
from wfns.ham.generalized_chemical import GeneralizedChemicalHamiltonian


class UnrestrictedChemicalHamiltonian(BaseUnrestrictedHamiltonian):
Expand Down

0 comments on commit 51f48ff

Please sign in to comment.