Skip to content

Commit

Permalink
fix double spaces in doc strings
Browse files Browse the repository at this point in the history
found with regex \b\s{2,}\b[^\d]
  • Loading branch information
janosh committed Aug 4, 2024
1 parent caddde5 commit e06afe9
Show file tree
Hide file tree
Showing 28 changed files with 42 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def __init__(self, initial_environment_symbol, expected_final_environment_symbol
self.abstract_geometry = AbstractGeometry.from_cg(self.coordination_geometry)

@classmethod
def simple_expansion(cls, initial_environment_symbol, expected_final_environment_symbol, neighbors_indices):
def simple_expansion(
cls, initial_environment_symbol, expected_final_environment_symbol, neighbors_indices
) -> CoordinationEnvironmentMorphing:
"""Simple expansion of a coordination environment.
Args:
Expand Down
4 changes: 2 additions & 2 deletions dev_scripts/update_spacegroup_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def convert_symmops_to_sg_encoding(symbol: str) -> str:
Args:
symbol (str): "hermann_mauguin" or "universal_h_m" key of symmops.json
Returns:
symbol in the format of SYMM_DATA["space_group_encoding"] keys
str: symbol in the format of SYMM_DATA["space_group_encoding"] keys
"""
symbol_representation = symbol.split(":")
representation = ":" + "".join(symbol_representation[1].split(" ")) if len(symbol_representation) > 1 else ""
Expand All @@ -51,7 +51,7 @@ def remove_identity_from_full_hermann_mauguin(symbol: str) -> str:
Args:
symbol (str): "hermann_mauguin" key of symmops.json
Returns:
short "hermann_mauguin" key
str: short "hermann_mauguin" key
"""
if symbol in ("P 1", "C 1", "P 1 "):
return symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def from_dict(cls, dct, structure: Structure, detailed_voronoi) -> Self:
the structure and the DetailedVoronoiContainer.
As an inner (nested) class, the NeighborsSet is not supposed to be used anywhere else that inside the
StructureEnvironments. The from_dict method is thus using the structure and detailed_voronoi when
StructureEnvironments. The from_dict method is thus using the structure and detailed_voronoi when
reconstructing itself. These two are both in the StructureEnvironments object.
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/analysis/interface_reactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def __init__(

# Factor is the compositional ratio between composition self.c1 and
# processed composition self.comp1. For example, the factor for
# Composition('SiO2') and Composition('O') is 2.0. This factor will be used
# Composition('SiO2') and Composition('O') is 2.0. This factor will be used
# to convert mixing ratio in self.comp1 - self.comp2 tie line to that in
# self.c1 - self.c2 tie line.
self.factor1 = 1.0
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/analysis/local_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ def get_okeeffe_distance_prediction(el1, el2):
"""Get an estimate of the bond valence parameter (bond length) using
the derived parameters from 'Atoms Sizes and Bond Lengths in Molecules
and Crystals' (O'Keeffe & Brese, 1991). The estimate is based on two
experimental parameters: r and c. The value for r is based off radius,
experimental parameters: r and c. The value for r is based off radius,
while c is (usually) the Allred-Rochow electronegativity. Values used
are *not* generated from pymatgen, and are found in
'okeeffe_params.json'.
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/analysis/magnetism/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def ordering(self) -> Ordering:
ferro/ferrimagnetic is self.threshold_ordering and defaults to 1e-8.
Returns:
Ordering: Enum with values FM: ferromagnetic, FiM: ferrimagnetic,
Ordering: Enum with values FM: ferromagnetic, FiM: ferrimagnetic,
AFM: antiferromagnetic, NM: non-magnetic or Unknown. Unknown is
returned if magnetic moments are not defined or structure is not collinear
(in which case a warning is issued).
Expand Down
4 changes: 2 additions & 2 deletions src/pymatgen/analysis/molecule_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ def fit(self, mol1, mol2):
mol2: Second molecule. OpenBabel OBMol or pymatgen Molecule object
Returns:
bool: Whether two molecules are the same.
bool: True if two molecules are the same.
"""
return self.get_rmsd(mol1, mol2) < self._tolerance

Expand All @@ -598,7 +598,7 @@ def get_rmsd(self, mol1, mol2):
Returns:
RMSD if topology of the two molecules are the same
Infinite if the topology is different
Infinite if the topology is different
"""
label1, label2 = self._mapper.uniform_labels(mol1, mol2)
if label1 is None or label2 is None:
Expand Down
4 changes: 2 additions & 2 deletions src/pymatgen/analysis/phase_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ def get_decomp_and_phase_separation_energy(
**kwargs: Passed to get_decomp_and_e_above_hull.
Returns:
tuple[decomp, energy]: The decomposition is given as a dict of {PDEntry, amount}
tuple[decomp, energy]: The decomposition is given as a dict of {PDEntry, amount}
for all entries in the decomp reaction where amount is the amount of the
fractional composition. The phase separation energy is given per atom.
"""
Expand Down Expand Up @@ -1547,7 +1547,7 @@ class PatchedPhaseDiagram(PhaseDiagram):
Note that this does not mean that all these entries are actually used in
the phase diagram. For example, this includes the positive formation energy
entries that are filtered out before Phase Diagram construction.
min_entries (list[PDEntry]): List of the lowest energy entries for each composition
min_entries (list[PDEntry]): List of the lowest energy entries for each composition
in the data provided for Phase Diagram construction.
el_refs (list[PDEntry]): List of elemental references for the phase diagrams.
These are entries corresponding to the lowest energy element entries for
Expand Down
4 changes: 2 additions & 2 deletions src/pymatgen/analysis/quasiharmonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def optimize_gibbs_free_energy(self):
def optimizer(self, temperature):
"""Evaluate G(V, T, P) at the given temperature(and pressure) and minimize it w.r.t. V.
1. Compute the vibrational Helmholtz free energy, A_vib.
1. Compute the vibrational Helmholtz free energy, A_vib.
2. Compute the Gibbs free energy as a function of volume, temperature
and pressure, G(V,T,P).
3. Perform an equation of state fit to get the functional form of
Expand Down Expand Up @@ -248,7 +248,7 @@ def debye_temperature(self, volume: float) -> float:
@staticmethod
def debye_integral(y):
"""
Debye integral. Eq(5) in doi.org/10.1016/j.comphy.2003.12.001.
Debye integral. Eq(5) in doi.org/10.1016/j.comphy.2003.12.001.
Args:
y (float): Debye temperature / T, upper limit
Expand Down
10 changes: 5 additions & 5 deletions src/pymatgen/analysis/structure_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def are_equal(self, sp1, sp2) -> bool:
definition in Site and PeriodicSite.
Returns:
bool: Whether species are considered equal.
bool: True if species are considered equal.
"""
return False

Expand Down Expand Up @@ -122,7 +122,7 @@ def are_equal(self, sp1, sp2) -> bool:
definition in Site and PeriodicSite.
Returns:
bool: Whether species are equal.
bool: True if species are equal.
"""
return sp1 == sp2

Expand Down Expand Up @@ -151,7 +151,7 @@ def are_equal(self, sp1, sp2) -> bool:
definition in Site and PeriodicSite.
Returns:
bool: Whether species are equal.
bool: True if species are equal.
"""
for s1 in sp1:
spin1 = getattr(s1, "spin", 0) or 0
Expand Down Expand Up @@ -188,7 +188,7 @@ def are_equal(self, sp1, sp2) -> bool:
definition in Site and PeriodicSite.
Returns:
bool: Whether species are the same based on element and amounts.
bool: True if species are the same based on element and amounts.
"""
comp1 = Composition(sp1)
comp2 = Composition(sp2)
Expand Down Expand Up @@ -1051,7 +1051,7 @@ def fit_anonymous(
If True, skip to get a primitive structure and perform Niggli reduction for struct1 and struct2
Returns:
bool: Whether a species mapping can map struct1 to struct2
bool: True if a species mapping can map struct1 to struct2
"""
struct1, struct2 = self._process_species([struct1, struct2])
struct1, struct2, fu, s1_supercell = self._preprocess(struct1, struct2, niggli, skip_structure_reduction)
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/core/bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def is_bonded(
bond length. If None, a ValueError will be thrown.
Returns:
bool: whether two sites are bonded.
bool: True if two sites are bonded.
"""
sp1 = next(iter(site1.species))
sp2 = next(iter(site2.species))
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/core/composition.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def contains_element_type(self, category: str) -> bool:
"actinoid", "radioactive", "quadrupolar", "s-block", "p-block", "d-block", "f-block".
Returns:
bool: Whether any elements in Composition match category.
bool: True if any elements in Composition match category.
"""
allowed_categories = [element.value for element in ElementType]

Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/core/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1768,7 +1768,7 @@ def enum_sigma_ort(
e.g. mu:lam:mv = c2,None,a2, means b2 is irrational.
Returns:
dict: sigmas dictionary with keys as the possible integer sigma values
dict: sigmas dictionary with keys as the possible integer sigma values
and values as list of the possible rotation angles to the
corresponding sigma values. e.g. the format as
{sigma1: [angle11,angle12,...], sigma2: [angle21, angle22,...],...}
Expand Down
4 changes: 2 additions & 2 deletions src/pymatgen/core/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(
Args:
species: Species on the site. Can be:
i. A Composition-type object (preferred)
ii. An element / species specified either as a string
ii. An element / species specified either as a string
symbols, e.g. "Li", "Fe2+", "P" or atomic numbers,
e.g. 3, 56, or actual Element or Species objects.
iii.Dict of elements/species and occupancies, e.g.
Expand Down Expand Up @@ -305,7 +305,7 @@ def __init__(
Args:
species: Species on the site. Can be:
i. A Composition-type object (preferred)
ii. An element / species specified either as a string
ii. An element / species specified either as a string
symbols, e.g. "Li", "Fe2+", "P" or atomic numbers,
e.g. 3, 56, or actual Element or Species objects.
iii.Dict of elements/species and occupancies, e.g.
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/core/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def is_symmetric(self, symprec: float = 0.1) -> bool:
symprec (float): Symmetry precision used for SpaceGroup analyzer.
Returns:
bool: Whether surfaces are symmetric.
bool: True if surfaces are symmetric.
"""
spg_analyzer = SpacegroupAnalyzer(self, symprec=symprec)
symm_ops = spg_analyzer.get_point_group_operations()
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/ext/optimade.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ def _parse_provider(self, provider: str, provider_url: str) -> dict[str, Provide
It does not raise exceptions but will instead _logger.warning and provide
an empty dictionary in the case of invalid data.
In future, when the specification is sufficiently well adopted,
In future, when the specification is sufficiently well adopted,
we might be more strict here.
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/io/fiesta.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Nwchem2Fiesta(MSONable):
If nwchem.nw is the input, nwchem.out the output, and structure.movecs the
"movecs" file, the syntax to run NWCHEM2FIESTA is: NWCHEM2FIESTA
nwchem.nw nwchem.nwout structure.movecs > log_n2f
nwchem.nw nwchem.nwout structure.movecs > log_n2f
"""

def __init__(self, folder, filename="nwchem", log_file="log_n2f"):
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/io/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ def _parse_hessian(self, file, structure):
structure: structure in the output file
"""
# read Hessian matrix under "Force constants in Cartesian coordinates"
# Hessian matrix is in the input orientation framework
# Hessian matrix is in the input orientation framework
# WARNING : need #P in the route line

ndf = 3 * len(structure)
Expand Down
4 changes: 2 additions & 2 deletions src/pymatgen/io/lobster/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ def has_good_quality_maxDeviation(self, limit_maxDeviation: float = 0.1) -> bool
limit_maxDeviation: limit of the maxDeviation
Returns:
bool: Whether the quality of the projection is good.
bool: True if the quality of the projection is good.
"""
return all(deviation <= limit_maxDeviation for deviation in self.max_deviation)

Expand All @@ -1525,7 +1525,7 @@ def has_good_quality_check_occupied_bands(
limit_deviation (float): limit of the maxDeviation
Returns:
bool: Whether the quality of the projection is good.
bool: True if the quality of the projection is good.
"""
for matrix in self.band_overlaps_dict[Spin.up]["matrices"]:
for iband1, band1 in enumerate(matrix):
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/io/xtb/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class CRESTInput(MSONable):
"""
An object representing CREST input files.
An object representing CREST input files.
Because CREST is controlled through command line flags and external
files, the CRESTInput class mainly consists of methods for containing
and writing external files.
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/phonon/bandstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def asr_breaking(self, tol_eigendisplacements: float = 1e-5) -> np.ndarray | Non
"""Get the breaking of the acoustic sum rule for the three acoustic modes,
if Gamma is present. None otherwise.
If eigendisplacements are available they are used to determine the acoustic
modes: selects the bands corresponding to the eigendisplacements that
modes: selects the bands corresponding to the eigendisplacements that
represent to a translation within tol_eigendisplacements. If these are not
identified or eigendisplacements are missing the first 3 modes will be used
(indices [:3]).
Expand Down
4 changes: 2 additions & 2 deletions src/pymatgen/symmetry/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ def is_valid_op(self, symm_op: SymmOp) -> bool:
symm_op (SymmOp): Symmetry operation to test.
Returns:
bool: Whether SymmOp is valid for Molecule.
bool: True if SymmOp is valid for Molecule.
"""
coords = self.centered_mol.cart_coords
for site in self.centered_mol:
Expand Down Expand Up @@ -1674,7 +1674,7 @@ def are_symmetrically_equivalent(
are symmetrically similar.
Returns:
bool: Whether the two sets of sites are symmetrically equivalent.
bool: True if the two sets of sites are symmetrically equivalent.
"""

def in_sites(site):
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/symmetry/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def __init__(self, int_symbol: str, hexagonal: bool = True) -> None:
notation is a LaTeX-like string, with screw axes being
represented by an underscore. For example, "P6_3/mmc".
Alternative settings can be accessed by adding a ":identifier".
For example, the hexagonal setting for rhombohedral cells can be
For example, the hexagonal setting for rhombohedral cells can be
accessed by adding a ":H", e.g. "R-3m:H". To find out all
possible settings for a spacegroup, use the get_settings()
classmethod. Alternative origin choices can be indicated by a
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/transformations/advanced_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ def apply_transformation(
Structure | list[Structure]: Structure(s) after MagOrderTransformation.
"""
if not structure.is_ordered:
raise ValueError("Create an ordered approximation of your input structure first.")
raise ValueError("Create an ordered approximation of your input structure first.")

# retrieve order parameters
order_parameters = [MagOrderParameterConstraint.from_dict(op_dict) for op_dict in self.order_parameter]
Expand Down
4 changes: 2 additions & 2 deletions src/pymatgen/transformations/standard_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ class OrderDisorderedStructureTransformation(AbstractTransformation):
these will be treated separately if the difference is above a threshold
tolerance. currently this is .1
For example, if a fraction of .25 Li is on sites 0, 1, 2, 3 and .5 on sites
For example, if a fraction of .25 Li is on sites 0, 1, 2, 3 and .5 on sites
4, 5, 6, 7 then 1 site from [0, 1, 2, 3] will be filled and 2 sites from [4, 5, 6, 7]
will be filled, even though a lower energy combination might be found by
putting all lithium in sites [4, 5, 6, 7].
Expand Down Expand Up @@ -457,7 +457,7 @@ def apply_transformation(self, structure: Structure, return_ranked_list: bool |
"""For this transformation, the apply_transformation method will return
only the ordered structure with the lowest Ewald energy, to be
consistent with the method signature of the other transformations.
However, all structures are stored in the all_structures attribute in
However, all structures are stored in the all_structures attribute in
the transformation object for easy access.
Args:
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/util/due.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
See https://github.com/duecredit/duecredit/blob/master/README.md for examples.
Origin: Originally a part of the duecredit
Copyright: 2015-2021 DueCredit developers
Copyright: 2015-2021 DueCredit developers
License: BSD-2
"""

Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/util/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ def wrapper(*args, **kwargs):
tight_layout True to call fig.tight_layout (default: False)
ax_grid True (False) to add (remove) grid from all axes in fig.
Default: None i.e. fig is left unchanged.
ax_annotate Add labels to subplots e.g. (a), (b).
ax_annotate Add labels to subplots e.g. (a), (b).
Default: False
fig_close Close figure. Default: False.
================ ====================================================
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/vis/structure_vtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def add_triangle(
color: Color for triangle as RGB.
center: The "central atom" of the triangle
opacity: opacity of the triangle
draw_edges: If set to True, the a line will be drawn at each edge
draw_edges: If set to True, the a line will be drawn at each edge
edges_color: Color of the line for the edges
edges_linewidth: Width of the line drawn for the edges
"""
Expand Down

0 comments on commit e06afe9

Please sign in to comment.