Skip to content

Commit 1c18213

Browse files
committed
doc str + var name fixes
1 parent 535f925 commit 1c18213

20 files changed

+69
-74
lines changed

dev_scripts/update_pt_data.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,26 @@
1414
from monty.serialization import dumpfn, loadfn
1515
from ruamel import yaml
1616

17-
from pymatgen.core import Element
18-
from pymatgen.core.periodic_table import get_el_sp
17+
from pymatgen.core import Element, get_el_sp
1918

2019

2120
def test_yaml():
22-
with open("periodic_table.yaml") as f:
23-
data = yaml.load(f)
21+
with open("periodic_table.yaml") as file:
22+
data = yaml.load(file)
2423
print(data)
2524

2625

2726
def test_json():
28-
with open("periodic_table.json") as f:
29-
data = json.load(f)
27+
with open("periodic_table.json") as file:
28+
data = json.load(file)
3029
print(data)
3130

3231

3332
def parse_oxi_state():
34-
with open("periodic_table.yaml") as f:
35-
data = yaml.load(f)
36-
with open("oxidation_states.txt") as f:
37-
oxi_data = f.read()
33+
with open("periodic_table.yaml") as file:
34+
data = yaml.load(file)
35+
with open("oxidation_states.txt") as file:
36+
oxi_data = file.read()
3837
oxi_data = re.sub("[\n\r]", "", oxi_data)
3938
patt = re.compile("<tr>(.*?)</tr>", re.MULTILINE)
4039

@@ -65,8 +64,8 @@ def parse_oxi_state():
6564
data[el]["Common oxidation states"] = common_oxi
6665
else:
6766
print(el)
68-
with open("periodic_table2.yaml", "w") as f:
69-
yaml.dump(data, f)
67+
with open("periodic_table2.yaml", "w") as file:
68+
yaml.dump(data, file)
7069

7170

7271
def parse_ionic_radii():
@@ -254,7 +253,7 @@ def add_electron_affinities():
254253
import requests
255254
from bs4 import BeautifulSoup
256255

257-
req = requests.get("https://en.wikipedia.org/wiki/Electron_affinity_(data_page)")
256+
req = requests.get("https://wikipedia.org/wiki/Electron_affinity_(data_page)")
258257
soup = BeautifulSoup(req.text, "html.parser")
259258
for t in soup.find_all("table"):
260259
if "Hydrogen" in t.text:

pymatgen/alchemy/transmuters.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,15 @@ def append_transformation(self, transformation, extend_collection=False, clear_r
9999
transformation: Transformation to append
100100
extend_collection: Whether to use more than one output structure
101101
from one-to-many transformations. extend_collection can be a
102-
number, which determines the maximum branching for each
103-
transformation.
102+
number, which determines the maximum branching for each transformation.
104103
clear_redo (bool): Whether to clear the redo list. By default,
105104
this is True, meaning any appends clears the history of
106105
undoing. However, when using append_transformation to do a
107-
redo, the redo list should not be cleared to allow multiple
108-
redos.
106+
redo, the redo list should not be cleared to allow multiple redos.
109107
110108
Returns:
111-
List of booleans corresponding to initial transformed structures
112-
each boolean describes whether the transformation altered the
113-
structure
109+
list[bool]: corresponding to initial transformed structures each boolean
110+
describes whether the transformation altered the structure
114111
"""
115112
if self.ncores and transformation.use_multiprocessing:
116113
with Pool(self.ncores) as p:
@@ -369,8 +366,8 @@ def _apply_transformation(inputs):
369366
collection, and a boolean indicating whether to clear the redo
370367
371368
Returns:
372-
List of output structures (the modified initial structure, plus
373-
any new structures created by a one-to-many transformation)
369+
list[Structure]: the modified initial structure, plus
370+
any new structures created by a one-to-many transformation
374371
"""
375372
ts, transformation, extend_collection, clear_redo = inputs
376373
new = ts.append_transformation(transformation, extend_collection, clear_redo=clear_redo)

pymatgen/analysis/chemenv/coordination_environments/coordination_geometry_finder.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@
4242
sort_separation,
4343
sort_separation_tuple,
4444
)
45-
from pymatgen.core.lattice import Lattice
46-
from pymatgen.core.periodic_table import Species
47-
from pymatgen.core.structure import Structure
45+
from pymatgen.core import Lattice, Species, Structure
4846
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
4947
from pymatgen.util.due import Doi, due
5048

pymatgen/analysis/chemenv/utils/coordination_geometry_utils.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -425,11 +425,11 @@ def rotateCoords(coords, R):
425425
Returns:
426426
List of rotated points.
427427
"""
428-
newlist = []
428+
new_coords = []
429429
for pp in coords:
430430
rpp = matrixTimesVector(R, pp)
431-
newlist.append(rpp)
432-
return newlist
431+
new_coords.append(rpp)
432+
return new_coords
433433

434434

435435
def rotateCoordsOpt(coords, R):
@@ -461,10 +461,10 @@ def changebasis(uu, vv, nn, pps):
461461
MM[ii, 1] = vv[ii]
462462
MM[ii, 2] = nn[ii]
463463
PP = np.linalg.inv(MM)
464-
newpps = []
464+
new_pps = []
465465
for pp in pps:
466-
newpps.append(matrixTimesVector(PP, pp))
467-
return newpps
466+
new_pps.append(matrixTimesVector(PP, pp))
467+
return new_pps
468468

469469

470470
def collinear(p1, p2, p3=None, tolerance=0.25):

pymatgen/analysis/chemenv/utils/math_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ def divisors(n):
8181
"""
8282
factors = _factor_generator(n)
8383
_divisors = []
84-
listexponents = [[k**x for x in range(factors[k] + 1)] for k in list(factors)]
85-
listfactors = _cartesian_product(listexponents)
86-
for f in listfactors:
84+
exponents = [[k**x for x in range(factors[k] + 1)] for k in list(factors)]
85+
factors = _cartesian_product(exponents)
86+
for f in factors:
8787
_divisors.append(reduce(lambda x, y: x * y, f, 1))
8888
_divisors.sort()
8989
return _divisors

pymatgen/analysis/chempot_diagram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def simple_pca(data: np.ndarray, k: int = 2) -> tuple[np.ndarray, np.ndarray, np
648648
k: Number of principal components returned
649649
650650
Returns:
651-
Tuple of projected data, eigenvalues, eigenvectors
651+
tuple: projected data, eigenvalues, eigenvectors
652652
"""
653653
data = data - np.mean(data.T, axis=1) # centering the data
654654
cov = np.cov(data.T) # calculating covariance matrix

pymatgen/analysis/costdb_elements.csv

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
Ag,780.88,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
22
Pd,23036.01,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
3-
C,24,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
4-
Cl,1.5,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
5-
F,1900,pure F,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
6-
Ir,42000,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
7-
K,1000,pure K,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
8-
Na,250,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
9-
O,3,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
10-
P,300,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
11-
Pa,280000,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
12-
Sc,14000,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
13-
Xe,1200,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
3+
C,24,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
4+
Cl,1.5,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
5+
F,1900,pure F,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
6+
Ir,42000,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
7+
K,1000,pure K,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
8+
Na,250,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
9+
O,3,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
10+
P,300,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
11+
Pa,280000,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
12+
Sc,14000,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
13+
Xe,1200,,|@misc{wikipedia, title = "Wikipedia", month = "September", year = "2013", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
1414
Al,2.46035592,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
1515
As,0.641103496,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
1616
Au,45386.51194,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
1717
B,0.871045362,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
18-
Ba,0.2605,,|@misc{wikipedia, title = "Wikipedia", month = "August", year = "2019", url = "http://en.wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
18+
Ba,0.2605,,|@misc{wikipedia, title = "Wikipedia", month = "August", year = "2019", url = "http://wikipedia.org/wiki/Prices_of_elements_and_their_compounds"}|
1919
Be,447.978784,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
2020
Bi,25.3090376,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
2121
Br,1.39001291,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
@@ -77,7 +77,7 @@ Yb,1599.892734,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "Septembe
7777
Zn,2.33910182,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
7878
Zr,2.64995324,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "September", year = "2013", url = "http://www.wolframalpha.org"}|
7979
He,15.9,,|@misc{wolfram_alpha, title = "Wolfram Alpha", month = "June", year = "2020", url = "http://www.wolframalpha.org"}|
80-
H,1.4,,|@misc{wikipedia, title = "Wikipedia", month = "June", year = "2020", url = "https://en.wikipedia.org/wiki/Hydrogen_economy#Costs"}|
80+
H,1.4,,|@misc{wikipedia, title = "Wikipedia", month = "June", year = "2020", url = "https://wikipedia.org/wiki/Hydrogen_economy#Costs"}|
8181
Ar,19.56,,|@misc{internet_search, title = "Aqua-Calc", month = "June", year = "2020", url = "https://www.aqua-calc.com/calculate/materials-price/substance/argon"}|
8282
Ne,660000,,|@misc{internet_search, title = "Pomona College", month = "June", year = "2020", url = "http://www.chemistry.pomona.edu/chemistry/periodic_table/elements/neptunium/the%20facts.htm"}|
8383
Kr,330,,|@misc{internet_search, title = "Chemicool", month = "June", year = "2020", url = "https://www.chemicool.com/elements/krypton.html"}|

pymatgen/analysis/dimensionality.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@
3232
from pymatgen.analysis.graphs import MoleculeGraph, StructureGraph
3333
from pymatgen.analysis.local_env import JmolNN
3434
from pymatgen.analysis.structure_analyzer import get_max_bond_lengths
35+
from pymatgen.core import Molecule, Species, Structure
3536
from pymatgen.core.lattice import get_integer_index
36-
from pymatgen.core.periodic_table import Species
37-
from pymatgen.core.structure import Molecule, Structure
3837
from pymatgen.core.surface import SlabGenerator
3938
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
4039

pymatgen/analysis/local_env.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@
2626
from pymatgen.analysis.bond_valence import BV_PARAMS, BVAnalyzer
2727
from pymatgen.analysis.graphs import MoleculeGraph, StructureGraph
2828
from pymatgen.analysis.molecule_structure_comparator import CovalentRadius
29-
from pymatgen.core.periodic_table import Element, Species
30-
from pymatgen.core.sites import PeriodicSite, Site
31-
from pymatgen.core.structure import IStructure, PeriodicNeighbor, Structure
29+
from pymatgen.core import Element, IStructure, PeriodicNeighbor, PeriodicSite, Site, Species, Structure
3230

3331
try:
3432
from openbabel import openbabel
@@ -1929,7 +1927,7 @@ def solid_angle(center, coords):
19291927
r_norm = [np.linalg.norm(i) for i in r]
19301928

19311929
# Compute the solid angle for each tetrahedron that makes up the facet
1932-
# Following: https://en.wikipedia.org/wiki/Solid_angle#Tetrahedron
1930+
# Following: https://wikipedia.org/wiki/Solid_angle#Tetrahedron
19331931
angle = 0
19341932
for i in range(1, len(r) - 1):
19351933
j = i + 1

pymatgen/analysis/molecule_matcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,7 @@ def kabsch(P: np.ndarray, Q: np.ndarray):
810810
P and Q, centered around the their centroid.
811811
812812
For more info see:
813-
- http://en.wikipedia.org/wiki/Kabsch_algorithm and
813+
- http://wikipedia.org/wiki/Kabsch_algorithm and
814814
- https://cnx.org/contents/HV-RsdwL@23/Molecular-Distance-Measures
815815
816816
Args:

0 commit comments

Comments
 (0)