Skip to content

Commit 2a35841

Browse files
committed
standardize doc strings
1 parent 0ebaa64 commit 2a35841

27 files changed

+67
-78
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: ^(docs|tests/files|tasks.py)
22

33
ci:
44
autoupdate_schedule: monthly
5-
skip: [ mypy, pyright ]
5+
skip: [mypy, pyright]
66
autofix_commit_msg: pre-commit auto-fixes
77
autoupdate_commit_msg: pre-commit autoupdate
88

@@ -11,7 +11,7 @@ repos:
1111
rev: v0.5.6
1212
hooks:
1313
- id: ruff
14-
args: [ --fix, --unsafe-fixes ]
14+
args: [--fix, --unsafe-fixes]
1515
- id: ruff-format
1616

1717
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -30,16 +30,16 @@ repos:
3030
rev: v2.3.0
3131
hooks:
3232
- id: codespell
33-
stages: [ commit, commit-msg ]
34-
exclude_types: [ html ]
35-
additional_dependencies: [ tomli ] # needed to read pyproject.toml below py3.11
33+
stages: [commit, commit-msg]
34+
exclude_types: [html]
35+
additional_dependencies: [tomli] # needed to read pyproject.toml below py3.11
3636
exclude: src/pymatgen/analysis/aflow_prototypes.json
3737

3838
- repo: https://github.com/MarcoGorelli/cython-lint
3939
rev: v0.16.2
4040
hooks:
4141
- id: cython-lint
42-
args: [ --no-pycodestyle ]
42+
args: [--no-pycodestyle]
4343
- id: double-quote-cython-strings
4444

4545
- repo: https://github.com/adamchainz/blacken-docs
@@ -56,13 +56,13 @@ repos:
5656
# MD033: no inline HTML
5757
# MD041: first line in a file should be a top-level heading
5858
# MD025: single title
59-
args: [ --disable, MD013, MD024, MD025, MD033, MD041, "--" ]
59+
args: [--disable, MD013, MD024, MD025, MD033, MD041, "--"]
6060

6161
- repo: https://github.com/kynan/nbstripout
6262
rev: 0.7.1
6363
hooks:
6464
- id: nbstripout
65-
args: [ --drop-empty-cells, --keep-output ]
65+
args: [--drop-empty-cells, --keep-output]
6666

6767
- repo: https://github.com/RobertCraigie/pyright-python
6868
rev: v1.1.374

src/pymatgen/alchemy/transmuters.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,10 @@ def batch_write_vasp_input(
331331
output_dir: Directory to output files
332332
create_directory (bool): Create the directory if not present.
333333
Defaults to True.
334-
subfolder: Function to create subdirectory name from
335-
transformed_structure.
336-
e.g. lambda x: x.other_parameters["tags"][0] to use the first
337-
tag.
338-
include_cif (bool): Boolean indication whether to output a CIF as
339-
well. CIF files are generally better supported in visualization
340-
programs.
334+
subfolder: Function to create subdirectory name from transformed_structure.
335+
E.g. lambda x: x.other_parameters["tags"][0] to use the first tag.
336+
include_cif (bool): Pass True to output a CIF as well. CIF files are generally
337+
better supported in visualization programs.
341338
**kwargs: Any kwargs supported by vasp_input_set.
342339
"""
343340
for idx, struct in enumerate(transformed_structures):

src/pymatgen/analysis/bond_valence.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,15 @@ def _recurse(assigned=None):
421421
return [[int(frac_site) for frac_site in assigned[site]] for site in structure]
422422
raise ValueError("Valences cannot be assigned!")
423423

424-
def get_oxi_state_decorated_structure(self, structure: Structure):
424+
def get_oxi_state_decorated_structure(self, structure: Structure) -> Structure:
425425
"""Get an oxidation state decorated structure. This currently works only
426426
for ordered structures only.
427427
428428
Args:
429429
structure: Structure to analyze
430430
431431
Returns:
432-
A modified structure that is oxidation state decorated.
432+
Structure: modified with oxidation state decorations.
433433
434434
Raises:
435435
ValueError if the valences cannot be determined.

src/pymatgen/analysis/chempot_diagram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def get_plot(
168168
(in eV/atom), helping provide visual clarity. Defaults to 1.0.
169169
170170
Returns:
171-
A Plotly Figure object
171+
plotly.graph_objects.Figure
172172
"""
173173
if elements:
174174
elems = [Element(str(e)) for e in elements]

src/pymatgen/analysis/diffraction/tem.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,16 +338,15 @@ def is_parallel(
338338
plane: Tuple3Ints,
339339
other_plane: Tuple3Ints,
340340
) -> bool:
341-
"""
342-
Checks if two hkl planes are parallel in reciprocal space.
341+
"""Checks if two hkl planes are parallel in reciprocal space.
343342
344343
Args:
345344
structure (Structure): The input structure.
346345
plane (3-tuple): The first plane to be compared.
347346
other_plane (3-tuple): The other plane to be compared.
348347
349348
Returns:
350-
boolean
349+
bool: True if the planes are parallel, False otherwise.
351350
"""
352351
phi = self.get_interplanar_angle(structure, plane, other_plane)
353352
return phi in (180, 0) or np.isnan(phi)

src/pymatgen/analysis/local_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ def _is_in_targets(site, targets):
11611161
targets ([Element]) List of elements
11621162
11631163
Returns:
1164-
boolean: Whether this site contains a certain list of elements
1164+
bool: Whether this site contains a certain list of elements
11651165
"""
11661166
elems = _get_elements(site)
11671167
return all(elem in targets for elem in elems)

src/pymatgen/analysis/magnetism/jahnteller.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def is_jahn_teller_active(
272272
quite distorted, this threshold is smaller than one might expect
273273
274274
Returns:
275-
boolean, True if might be Jahn-Teller active, False if not
275+
bool: True if might be Jahn-Teller active, False if not
276276
"""
277277
active = False
278278

src/pymatgen/analysis/molecule_matcher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ def _is_molecule_linear(self, mol):
496496
mol: The molecule. OpenBabel OBMol object.
497497
498498
Returns:
499-
Boolean value.
499+
bool
500500
"""
501501
if mol.NumAtoms() < 3:
502502
return True
@@ -589,7 +589,7 @@ def fit(self, mol1, mol2):
589589
mol2: Second molecule. OpenBabel OBMol or pymatgen Molecule object
590590
591591
Returns:
592-
A boolean value indicates whether two molecules are the same.
592+
bool: Whether two molecules are the same.
593593
"""
594594
return self.get_rmsd(mol1, mol2) < self._tolerance
595595

src/pymatgen/analysis/phase_diagram.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,8 +1573,8 @@ def __init__(
15731573
the entries themselves and are sorted alphabetically.
15741574
If specified, element ordering (e.g. for pd coordinates)
15751575
is preserved.
1576-
keep_all_spaces (bool): Boolean control on whether to keep chemical spaces
1577-
that are subspaces of other spaces.
1576+
keep_all_spaces (bool): Pass True to keep chemical spaces that are subspaces
1577+
of other spaces.
15781578
verbose (bool): Whether to show progress bar during convex hull construction.
15791579
"""
15801580
if elements is None:

src/pymatgen/analysis/reaction_calculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def from_dict(cls, dct: dict) -> Self:
262262
dct (dict): from as_dict().
263263
264264
Returns:
265-
A BalancedReaction object.
265+
BalancedReaction
266266
"""
267267
reactants = {Composition(comp): coeff for comp, coeff in dct["reactants"].items()}
268268
products = {Composition(comp): coeff for comp, coeff in dct["products"].items()}

0 commit comments

Comments
 (0)