Skip to content

Commit 2cca563

Browse files
authored
Fix error of linters (#38)
* Fix import orders * Add pyling ignore list * Update the rcfile for pylint in tox.ini * Update the .gitignore
1 parent fe0799b commit 2cca563

22 files changed

+244
-43
lines changed

.gitignore

Lines changed: 161 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,163 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
15

2-
# Ignore (in-place) build results
3-
*.pyc
6+
# C extensions
7+
*.so
48

5-
# Ignore PyCharm
6-
.idea
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
doc/_build/
73+
doc/html/
74+
doc/latex/
75+
doc/man/
76+
doc/xml/
77+
doc/source
78+
doc/modules
79+
80+
# PyBuilder
81+
target/
82+
83+
# Jupyter Notebook
84+
.ipynb_checkpoints
85+
86+
# IPython
87+
profile_default/
88+
ipython_config.py
89+
90+
# pyenv
91+
.python-version
92+
93+
# pipenv
94+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
96+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
97+
# install all needed dependencies.
98+
#Pipfile.lock
99+
100+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
101+
__pypackages__/
102+
103+
# Celery stuff
104+
celerybeat-schedule
105+
celerybeat.pid
106+
107+
# SageMath parsed files
108+
*.sage.py
109+
110+
# Environments
111+
.env
112+
.venv
113+
env/
114+
venv/
115+
ENV/
116+
env.bak/
117+
venv.bak/
118+
119+
# Spyder project settings
120+
.spyderproject
121+
.spyproject
122+
123+
# Rope project settings
124+
.ropeproject
125+
126+
# mkdocs documentation
127+
/site
128+
129+
# mypy
130+
.mypy_cache/
131+
.dmypy.json
132+
dmypy.json
133+
134+
# Pyre type checker
135+
.pyre/
136+
137+
# Editor junk
138+
tags
139+
[._]*.s[a-v][a-z]
140+
[._]*.sw[a-p]
141+
[._]s[a-v][a-z]
142+
[._]sw[a-p]
143+
*~
144+
\#*\#
145+
.\#*
146+
.ropeproject
147+
.idea/
148+
.spyderproject
149+
.spyproject
150+
.vscode/
151+
# Mac .DS_Store
152+
.DS_Store
153+
154+
# jupyter notebook checkpoints
155+
.ipynb_checkpoints
156+
157+
# codecov files
158+
*.gcno
159+
*.gcda
160+
*.gcov
161+
162+
*/*/_build
163+
*/_build

bfit/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
# ---
2323
r"""Package for fitting densities to a linear combination of Gaussians."""
2424

25+
from bfit.density import *
2526
from bfit.fit import *
27+
from bfit.greedy import *
2628
from bfit.grid import *
27-
from bfit.model import *
28-
from bfit.density import *
2929
from bfit.measure import *
30-
from bfit.greedy import *
30+
from bfit.model import *

bfit/_slater.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import numpy as np
2828

29-
3029
__all__ = ["load_slater_wfn"]
3130

3231

@@ -127,7 +126,7 @@ def _get_number_of_electrons_per_orbital(configuration):
127126
for x in orbitals:
128127
if x in electron_config_list:
129128
index = electron_config_list.index(x)
130-
orbital = (electron_config_list[index: index + 2])
129+
orbital = electron_config_list[index : index + 2]
131130

132131
if orbital[1] == "D" or orbital[1] == "F":
133132
num_electrons = re.search(orbital + r"\((.*?)\)", electron_config_list).group(1)

bfit/density.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
# ---
2323
r"""Slater Atomic Density Module."""
2424

25-
from bfit._slater import load_slater_wfn
2625
import numpy as np
2726
from scipy.special import factorial
2827

28+
from bfit._slater import load_slater_wfn
2929

3030
__all__ = ["SlaterAtoms"]
3131

bfit/fit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
# ---
2323
r"""Fitting Algorithms."""
2424

25-
from timeit import default_timer as timer
2625
import warnings
26+
from timeit import default_timer as timer
2727

28-
from bfit.measure import KLDivergence, Measure, SquaredDifference
2928
import numpy as np
30-
from scipy.optimize import minimize, NonlinearConstraint
29+
from scipy.optimize import NonlinearConstraint, minimize
3130

31+
from bfit.measure import KLDivergence, Measure, SquaredDifference
3232

3333
__all__ = ["KLDivergenceFPI", "ScipyFit"]
3434

bfit/greedy.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424

2525
from abc import ABCMeta, abstractmethod
2626

27-
from bfit.fit import _BaseFit, KLDivergenceFPI, ScipyFit
28-
from bfit.measure import SquaredDifference
29-
from bfit.model import AtomicGaussianDensity
3027
import numpy as np
3128
from scipy.optimize import nnls
3229

30+
from bfit.fit import KLDivergenceFPI, ScipyFit, _BaseFit
31+
from bfit.measure import SquaredDifference
32+
from bfit.model import AtomicGaussianDensity
33+
3334
__all__ = ["GreedyLeastSquares", "GreedyKLFPI"]
3435

3536

@@ -801,6 +802,7 @@ def optimize_using_nnls(true_dens, cofactor_matrix):
801802
row_nnls_coefficients = nnls(cofactor_matrix, b_vector)
802803
return row_nnls_coefficients[0]
803804

805+
# pylint: disable=arguments-differ
804806
def get_optimization_routine(self, params, local=False):
805807
r"""Optimize least-squares using nnls and scipy.optimize from ScipyFit."""
806808
# First solves the optimal coefficients (while exponents are fixed) using NNLS.
@@ -946,6 +948,7 @@ def get_best_one_function_solution(self):
946948
exps = 3. * self.integral_dens / (2. * 4. * np.pi * denom)
947949
return np.array([self.integral_dens, exps])
948950

951+
# pylint: disable=arguments-differ
949952
def get_optimization_routine(self, params, local=False):
950953
r"""Optimize KL using KL-FPI method."""
951954
coeffs, exps = params[:len(params)//2], params[len(params)//2:]

bfit/measure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import numpy as np
2828

29-
3029
__all__ = ["SquaredDifference", "KLDivergence", "TsallisDivergence"]
3130

3231

bfit/test/test_density.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@
2222
# ---
2323
r"""Test bfit.density module."""
2424

25-
from bfit.density import SlaterAtoms
26-
from bfit.grid import ClenshawRadialGrid
2725
import numpy as np
28-
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
2926
import scipy
27+
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
28+
29+
from bfit.density import SlaterAtoms
30+
from bfit.grid import ClenshawRadialGrid
3031

3132

3233
def slater(e, n, r, derivative=False):

bfit/test/test_fit.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@
2222
# ---
2323
r"""Test bfit.fit module."""
2424

25+
import numpy as np
26+
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
27+
2528
from bfit.fit import KLDivergenceFPI, ScipyFit
2629
from bfit.grid import CubicGrid, UniformRadialGrid
2730
from bfit.measure import KLDivergence, SquaredDifference
2831
from bfit.model import AtomicGaussianDensity, MolecularGaussianDensity
29-
import numpy as np
30-
from numpy.testing import assert_almost_equal, assert_equal, assert_raises
3132

3233

3334
def test_lagrange_multiplier():

bfit/test/test_greedy.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@
2222
# ---
2323
r"""Test file for 'bfit.greedy'."""
2424

25+
import numpy as np
26+
import numpy.testing as npt
27+
2528
from bfit.greedy import (
26-
get_next_choices, get_two_next_choices, GreedyKLFPI,
27-
GreedyLeastSquares, pick_two_lose_one, remove_redundancies
29+
GreedyKLFPI,
30+
GreedyLeastSquares,
31+
get_next_choices,
32+
get_two_next_choices,
33+
pick_two_lose_one,
34+
remove_redundancies,
2835
)
2936
from bfit.grid import UniformRadialGrid
30-
import numpy as np
31-
import numpy.testing as npt
3237

3338

3439
def test_check_redundancies():

0 commit comments

Comments
 (0)