Skip to content

Commit 4f3d0df

Browse files
authored
Merge pull request #57 from cadenmyers13/pc-blackv2
skpkg: pre-commit auto fixes with line length of 79
2 parents 2202fb8 + 9b9f2a3 commit 4f3d0df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+392
-147
lines changed

doc/source/examples/distanceprinter.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
#!/usr/bin/env python
22

3-
"""Demonstration of using PairQuantity class for a printout of pair distances
4-
in periodic and non-periodic structures."""
3+
"""Demonstration of using PairQuantity class for a printout of pair
4+
distances in periodic and non-periodic structures."""
55

66
from diffpy.srreal.pairquantity import PairQuantity
77
from diffpy.structure import Structure
88

99

1010
class DistancePrinter(PairQuantity):
11-
"""This PairQuantity class simply prints the visited pair distances and the
12-
indices of the contributing atoms."""
11+
"""This PairQuantity class simply prints the visited pair distances
12+
and the indices of the contributing atoms."""
1313

1414
def _resetValue(self):
1515
self.count = 0
1616

1717
def _addPairContribution(self, bnds, sumscale):
1818
self.count += bnds.multiplicity() * sumscale / 2.0
19-
print("%i %g %i %i" % (self.count, bnds.distance(), bnds.site0(), bnds.site1()))
19+
print(
20+
"%i %g %i %i"
21+
% (self.count, bnds.distance(), bnds.site0(), bnds.site1())
22+
)
2023
return
2124

2225

doc/source/examples/lennardjones/ljcalculator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

3-
"""Demonstration of using PairQuantity class for calculation of Lennard Jones
4-
potential.
3+
"""Demonstration of using PairQuantity class for calculation of Lennard
4+
Jones potential.
55
66
Vij = 4 * ( rij ** -12 - rij ** -6 )
77
"""

doc/source/examples/parallelPDF.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python
22

3-
"""Demonstration of parallel PDF calculation using the multiprocessing package.
3+
"""Demonstration of parallel PDF calculation using the multiprocessing
4+
package.
45
56
A PDF of menthol structure is first calculated on a single core and then
67
on all computer CPUs. The script then compares both results and prints
@@ -25,7 +26,11 @@
2526

2627
# configure options parsing
2728
parser = optparse.OptionParser("%prog [options]\n" + __doc__)
28-
parser.add_option("--pyobjcryst", action="store_true", help="Use pyobjcryst to load the CIF file.")
29+
parser.add_option(
30+
"--pyobjcryst",
31+
action="store_true",
32+
help="Use pyobjcryst to load the CIF file.",
33+
)
2934
parser.allow_interspersed_args = True
3035
opts, args = parser.parse_args(sys.argv[1:])
3136

news/pc-blackv2.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* Configure ``black`` to have a linelength requirement of 79 characters.
20+
21+
**Security:**
22+
23+
* <news item>

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ ignore-words = ".codespell/ignore_words.txt"
5757
skip = "*.cif,*.dat"
5858

5959
[tool.black]
60-
line-length = 115
60+
line-length = 79
6161
include = '\.pyi?$'
6262
exclude = '''
6363
/(
@@ -78,3 +78,8 @@ exclude = '''
7878
| tests/data
7979
)/
8080
'''
81+
82+
[tool.docformatter]
83+
recursive = true
84+
wrap-summaries = 72
85+
wrap-descriptions = 72

setup.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def get_boost_config():
3737
conda_prefix = os.environ.get("CONDA_PREFIX")
3838
if not conda_prefix:
3939
raise EnvironmentError(
40-
"Neither BOOST_PATH nor CONDA_PREFIX are set. " "Please install Boost or set BOOST_PATH."
40+
"Neither BOOST_PATH nor CONDA_PREFIX are set. "
41+
"Please install Boost or set BOOST_PATH."
4142
)
4243
if os.name == "nt":
4344
inc = Path(conda_prefix) / "Library" / "include"
@@ -52,7 +53,8 @@ def get_objcryst_libraries():
5253
conda_prefix = os.environ.get("CONDA_PREFIX")
5354
if not conda_prefix:
5455
raise EnvironmentError(
55-
"CONDA_PREFIX is not set. Please install ObjCryst using conda and activate the environment."
56+
"CONDA_PREFIX is not set. "
57+
"Please install ObjCryst using conda and activate the environment."
5658
)
5759
if os.name == "nt":
5860
libdir = Path(conda_prefix) / "Library" / "lib"
@@ -64,7 +66,8 @@ def get_objcryst_libraries():
6466
stem = Path(fn).stem
6567
if "objcryst" not in stem.lower():
6668
continue
67-
# strip a leading "lib" so that setuptools does -lObjCryst, not -llibObjCryst
69+
# strip a leading "lib"
70+
# so that setuptools does -lObjCryst, not -llibObjCryst
6871
if os.name != "nt" and stem.startswith("lib"):
6972
stem = stem[3:]
7073
libs.append(stem)
@@ -99,7 +102,11 @@ def get_objcryst_libraries():
99102

100103
def create_extensions():
101104
"Initialize Extension objects for the setup function."
102-
ext = Extension("diffpy.srreal.srreal_ext", glob.glob("src/extensions/*.cpp"), **ext_kws)
105+
ext = Extension(
106+
"diffpy.srreal.srreal_ext",
107+
glob.glob("src/extensions/*.cpp"),
108+
**ext_kws,
109+
)
103110
return [ext]
104111

105112

src/diffpy/srreal/_docstrings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818

1919

2020
def get_registry_docstrings(cls):
21-
"""Build a dictionary of docstrings per each HasClassRegistry method.
21+
"""Build a dictionary of docstrings per each HasClassRegistry
22+
method.
2223
2324
Parameters
2425
----------

src/diffpy/srreal/_final_imports.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626

2727
def import_now():
28-
"""Import all Python modules that tweak extension-defined classes."""
28+
"""Import all Python modules that tweak extension-defined
29+
classes."""
2930
global _import_now_called
3031
if _import_now_called:
3132
return

src/diffpy/srreal/atomradiitable.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ def clone(self):
6363
return copy.copy(self)
6464

6565
def type(self):
66-
"""Unique string identifier of the CovalentRadiiTable type. This is
67-
used for class registration and as an argument for the createByType
68-
function.
66+
"""Unique string identifier of the CovalentRadiiTable type. This
67+
is used for class registration and as an argument for the
68+
createByType function.
6969
7070
Return string.
7171
"""

src/diffpy/srreal/attributes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ def _getattr(self, name):
3636

3737

3838
def _setattr(self, name, value):
39-
"""Assign to C++ double attribute if Python attribute does not exist."""
39+
"""Assign to C++ double attribute if Python attribute does not
40+
exist."""
4041
try:
4142
object.__getattribute__(self, name)
4243
except AttributeError:

0 commit comments

Comments
 (0)