Skip to content

Commit 0f75ef0

Browse files
authored
Merge pull request diffpy#31 from 8bitsam/black
Black and flake8
2 parents c4a2989 + db1e936 commit 0f75ef0

23 files changed

+970
-1081
lines changed

Diff for: .flake8

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
exclude =
3+
.git,
4+
__pycache__,
5+
build,
6+
dist,
7+
doc/source/conf.py
8+
max-line-length = 115
9+
# Ignore some style 'errors' produced while formatting by 'black'
10+
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#labels-why-pycodestyle-warnings
11+
extend-ignore = E203

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ lib64
2222
tags
2323
errors.err
2424

25+
# IDE configs
26+
.idea
27+
.vscode
28+
2529
# Installer logs
2630
pip-log.txt
2731
MANIFEST

Diff for: .idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: conda-recipe/run_test.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python
22

33
import diffpy.pdffit2.tests
4+
45
assert diffpy.pdffit2.tests.test().wasSuccessful()

Diff for: diffpy/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222

2323
from pkgutil import extend_path
24+
2425
__path__ = extend_path(__path__, __name__)
2526

2627

Diff for: diffpy/pdffit2/ipy_ext.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
def load_ipython_extension(ipython):
1111
from diffpy.pdffit2 import PdfFit
12+
1213
pf = PdfFit()
1314
pdf = EasyPDFPlotting(pf)
14-
print(' Type help(pdffit) or help(topic) for information.\n')
15+
print(" Type help(pdffit) or help(topic) for information.\n")
1516
ns = dict(pdffit=PdfFit, pdf=pdf)
1617
pf._exportAll(ns)
1718
ipython.user_ns.update(ns)
1819
return
1920

2021

2122
class EasyPDFPlotting(object):
22-
"""Convenience functions for accessing and plotting PDFfit2 data.
23-
"""
23+
"""Convenience functions for accessing and plotting PDFfit2 data."""
2424

2525
def __init__(self, pdffit_instance):
2626
self._pdffit = pdffit_instance
@@ -55,36 +55,40 @@ def showfit(self, offset=None):
5555
"""
5656
from matplotlib.pyplot import gca
5757
from math import floor
58+
5859
cr = self.r
5960
cGobs = self.Gobs
6061
cGcalc = self.Gcalc
6162
cGdiff = self.Gdiff
6263
if offset is None:
6364
offset = floor(min([min(cGobs), min(cGcalc)]) - max(cGdiff))
6465
ax = gca()
65-
ax.plot(cr, cGobs, 'r.', cr, cGcalc, 'b-', cr, cGdiff + offset, 'g-')
66+
ax.plot(cr, cGobs, "r.", cr, cGcalc, "b-", cr, cGdiff + offset, "g-")
6667
xl = ax.xaxis.get_label().get_text()
6768
yl = ax.yaxis.get_label().get_text()
6869
if xl == "":
69-
ax.set_xlabel('r (A)')
70+
ax.set_xlabel("r (A)")
7071
if yl == "":
71-
ax.set_ylabel('G (A**-2)')
72+
ax.set_ylabel("G (A**-2)")
7273
return
7374

7475
def showRw(self):
7576
"Plot cumulative Rw."
7677
from matplotlib.pyplot import gca
78+
7779
cRw = self._asarray(self._pdffit.getcrw())
7880
ax = gca()
7981
ax.plot(self.r, cRw)
80-
ax.set_title('Cumulative Rw = %.4f' % cRw[-1])
81-
ax.set_xlabel('r')
82-
ax.set_ylabel('Rw')
82+
ax.set_title("Cumulative Rw = %.4f" % cRw[-1])
83+
ax.set_xlabel("r")
84+
ax.set_ylabel("Rw")
8385
return
8486

8587
@staticmethod
8688
def _asarray(x, dtype=None):
8789
import numpy
90+
8891
return numpy.asarray(x, dtype=dtype)
8992

93+
9094
# End of class EasyPDFPlotting

Diff for: diffpy/pdffit2/output.py

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# create module variable stdout
2222

2323
from sys import stdout as stdout
24+
2425
# silence pyflakes checker
2526
assert stdout
2627

@@ -30,9 +31,11 @@ def redirect_stdout(dst):
3031
The dst value is stored in module variable stdout.
3132
"""
3233
from diffpy.pdffit2.pdffit2 import redirect_stdout
34+
3335
redirect_stdout(dst)
3436
global stdout
3537
stdout = dst
3638
return
3739

40+
3841
# End of file

0 commit comments

Comments
 (0)