Skip to content

Commit 4a1522c

Browse files
committed
fix missing types in doc string args
1 parent e06afe9 commit 4a1522c

28 files changed

+104
-98
lines changed

src/pymatgen/alchemy/filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ContainsSpecieFilter(AbstractStructureFilter):
4343
def __init__(self, species, strict_compare=False, AND=True, exclude=False):
4444
"""
4545
Args:
46-
species ([Species/Element]): list of species to look for
46+
species (list[SpeciesLike]): species to look for
4747
AND: whether all species must be present to pass (or fail) filter.
4848
strict_compare: if true, compares objects by specie or element
4949
object if false, compares atomic number
@@ -157,7 +157,7 @@ def from_dict(cls, dct: dict) -> Self:
157157
dct (dict): Dict representation.
158158
159159
Returns:
160-
Filter
160+
SpecieProximityFilter
161161
"""
162162
return cls(**dct["init_args"])
163163

src/pymatgen/alchemy/materials.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ def to_snl(self, authors: list[str], **kwargs) -> StructureNL:
366366
history = []
367367
for hist in self.history:
368368
snl_metadata = hist.pop("_snl", {})
369-
history.append(
369+
history += [
370370
{
371371
"name": snl_metadata.pop("name", "pymatgen"),
372372
"url": snl_metadata.pop("url", "http://pypi.python.org/pypi/pymatgen"),
373373
"description": hist,
374374
}
375-
)
375+
]
376376

377377
return StructureNL(self.final_structure, authors, history=history, **kwargs)
378378

src/pymatgen/analysis/chemenv/connectivity/connected_components.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,15 @@ def __len__(self):
373373
def compute_periodicity(self, algorithm="all_simple_paths") -> None:
374374
"""
375375
Args:
376-
algorithm ():
376+
algorithm (str): Algorithm to use to compute the periodicity vectors. Can be
377+
either "all_simple_paths" or "cycle_basis".
377378
"""
378379
if algorithm == "all_simple_paths":
379380
self.compute_periodicity_all_simple_paths_algorithm()
380381
elif algorithm == "cycle_basis":
381382
self.compute_periodicity_cycle_basis()
382383
else:
383-
raise ValueError(f"Algorithm {algorithm!r} is not allowed to compute periodicity")
384+
raise ValueError(f"{algorithm=} is not allowed to compute periodicity")
384385
self._order_periodicity_vectors()
385386

386387
def compute_periodicity_all_simple_paths_algorithm(self):
@@ -513,7 +514,7 @@ def compute_periodicity_cycle_basis(self) -> None:
513514
def make_supergraph(self, multiplicity):
514515
"""
515516
Args:
516-
multiplicity ():
517+
multiplicity (int): Multiplicity of the super graph.
517518
518519
Returns:
519520
nx.MultiGraph: Super graph of the connected component.
@@ -636,7 +637,8 @@ def periodicity(self):
636637
def elastic_centered_graph(self, start_node=None):
637638
"""
638639
Args:
639-
start_node ():
640+
start_node (Node, optional): Node to start the elastic centering from.
641+
If not provided, the first node in the graph is used.
640642
641643
Returns:
642644
nx.MultiGraph: Elastic centered subgraph.

src/pymatgen/analysis/chemenv/connectivity/structure_connectivity.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ def __init__(
7676
def environment_subgraph(self, environments_symbols=None, only_atoms=None):
7777
"""
7878
Args:
79-
environments_symbols ():
80-
only_atoms ():
79+
environments_symbols (list[str]): symbols of the environments to consider.
80+
only_atoms (list[str]): atoms to consider.
8181
8282
Returns:
8383
nx.MultiGraph: The subgraph of the structure connectivity graph
@@ -187,8 +187,8 @@ def setup_environment_subgraph(self, environments_symbols, only_atoms=None):
187187
)
188188
self._environment_subgraph.add_node(env_node)
189189
else:
190-
# TODO: add the possibility of a "constraint" on the minimum percentage
191-
# of the atoms on the site
190+
# TODO add the possibility of a "constraint" on the minimum percentage
191+
# of the atoms on the site
192192
this_site_elements = [
193193
sp.symbol for sp in self.light_structure_environments.structure[isite].species_and_occu
194194
]

src/pymatgen/analysis/cost.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ def __init__(self):
118118
class CostAnalyzer:
119119
"""Given a CostDB, figures out the minimum cost solutions via convex hull."""
120120

121-
def __init__(self, costdb):
121+
def __init__(self, costdb: CostDB) -> None:
122122
"""
123123
Args:
124-
costdb (): Cost database.
124+
costdb (CostDB): Cost database to use.
125125
"""
126126
self.costdb = costdb
127127

src/pymatgen/analysis/diffraction/xrd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(self, wavelength="CuKa", symprec: float = 0, debye_waller_factors=N
101101
"""Initialize the XRD calculator with a given radiation.
102102
103103
Args:
104-
wavelength (str/float): The wavelength can be specified as either a
104+
wavelength (str | float): The wavelength can be specified as either a
105105
float or a string. If it is a string, it must be one of the
106106
supported definitions in the AVAILABLE_RADIATION class
107107
variable, which provides useful commonly used wavelengths.

src/pymatgen/analysis/elasticity/elastic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ class NthOrderElasticTensor(Tensor):
5555
def __new__(cls, input_array, check_rank=None, tol: float = 1e-4) -> Self:
5656
"""
5757
Args:
58-
input_array ():
59-
check_rank ():
60-
tol ():
58+
input_array (np.ndarray): input array for tensor
59+
check_rank (int): rank of tensor to check
60+
tol (float): tolerance for initial symmetry test of tensor
6161
"""
6262
obj = super().__new__(cls, input_array, check_rank=check_rank)
6363
if obj.rank % 2 != 0:
@@ -524,7 +524,7 @@ class ComplianceTensor(Tensor):
524524
def __new__(cls, s_array) -> Self:
525525
"""
526526
Args:
527-
s_array ():
527+
s_array (np.ndarray): input array for tensor
528528
"""
529529
vscale = np.ones((6, 6))
530530
vscale[3:] *= 2

src/pymatgen/analysis/eos.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class EOSBase(ABC):
3838
def __init__(self, volumes, energies):
3939
"""
4040
Args:
41-
volumes (list/numpy.array): volumes in Ang^3
42-
energies (list/numpy.array): energy in eV.
41+
volumes (Sequence[float]): in Ang^3.
42+
energies (Sequence[float]): in eV.
4343
"""
4444
self.volumes = np.array(volumes)
4545
self.energies = np.array(energies)
@@ -561,8 +561,8 @@ def fit(self, volumes, energies):
561561
"""Fit energies as function of volumes.
562562
563563
Args:
564-
volumes (list/np.array)
565-
energies (list/np.array)
564+
volumes (Sequence[float]): in Ang^3
565+
energies (Sequence[float]): in eV
566566
567567
Returns:
568568
EOSBase: EOSBase object

src/pymatgen/analysis/molecule_structure_comparator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def are_equal(self, mol1, mol2) -> bool:
194194
def get_13_bonds(priority_bonds):
195195
"""
196196
Args:
197-
priority_bonds ():
197+
priority_bonds (list[tuple]): 12 bonds
198198
199199
Returns:
200200
tuple: 13 bonds

src/pymatgen/analysis/nmr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def from_maryland_notation(cls, sigma_iso, omega, kappa) -> Self:
122122
Initialize from Maryland notation.
123123
124124
Args:
125-
sigma_iso ():
126-
omega ():
127-
kappa ():
125+
sigma_iso (float): isotropic chemical shielding
126+
omega (float): anisotropy
127+
kappa (float): asymmetry parameter
128128
129129
Returns:
130130
ChemicalShielding

0 commit comments

Comments
 (0)