Skip to content

Commit e672f05

Browse files
committed
Fix linting errors.
1 parent 0c3e470 commit e672f05

12 files changed

Lines changed: 28 additions & 39 deletions

File tree

src/pymatgen/core/adsorption.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def from_bulk_and_miller(
109109
min_vacuum_size (float): min vacuum size for slab generation
110110
max_normal_search (int): max normal search for slab generation
111111
center_slab (bool): whether to center slab in slab generation
112-
selective dynamics (bool): whether to assign surface sites
112+
selective_dynamics (bool): whether to assign surface sites
113113
to selective dynamics
114114
undercoord_threshold (float): threshold of "undercoordation"
115115
to use for the assignment of surface sites. Default is
@@ -486,6 +486,8 @@ def adsorb_both_surfaces(
486486
repeat (3-tuple or list): repeat argument for supercell generation
487487
min_lw (float): minimum length and width of the slab, only used
488488
if repeat is None
489+
translate (bool): flag on whether or not to translate adsorbate
490+
to the adsorption site
489491
reorient (bool): flag on whether or not to reorient adsorbate
490492
along the miller index
491493
find_args (dict): dictionary of arguments to be passed to the
@@ -656,6 +658,7 @@ def plot_slab(
656658
window (float): window for setting the axes limits, is essentially
657659
a fraction of the unit cell limits
658660
draw_unit_cell (bool): flag indicating whether or not to draw cell
661+
adsorption_sites (bool): whether to plot adsorption sites
659662
decay (float): how the alpha-value decays along the z-axis
660663
inverse (bool): invert z axis to plot opposite surface
661664
"""

src/pymatgen/core/bond_valence.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ def add_oxidation_state_by_site_fraction(structure: Structure, oxidation_states:
468468
Add oxidation states to a structure by fractional site.
469469
470470
Args:
471+
structure (Structure): Structure to which oxidation states are added.
471472
oxidation_states (list[list[int]]): List of list of oxidation states for each
472473
site fraction for each site.
473474
e.g. [[2, 4], [3], [-2], [-2], [-2]]

src/pymatgen/core/elasticity/elastic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,9 @@ def get_yield_stress(self, n):
839839
# TODO: abstract this for other tensor fitting procedures
840840
def diff_fit(strains, stresses, eq_stress=None, order=2, tol: float = 1e-10):
841841
"""
842-
Nth order elastic constant fitting function based on.
843-
central-difference derivatives with respect to distinct
844-
strain states. The algorithm is summarized as follows:
842+
Nth order elastic constant fitting function based on central-difference derivatives.
843+
844+
The algorithm is summarized as follows:
845845
846846
1. Identify distinct strain states as sets of indices
847847
for which nonzero strain values exist, typically

src/pymatgen/core/elasticity/strain.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ def von_mises_strain(self):
239239

240240
def convert_strain_to_deformation(strain, shape: Literal["upper", "lower", "symmetric"]):
241241
"""
242-
This function converts a strain to a deformation gradient that will.
243-
produce that strain. Supports three methods:
242+
Convert a strain to a deformation gradient that will produce that strain.
243+
244+
Supports three methods:
244245
245246
Args:
246247
strain (3x3 array-like): strain matrix

src/pymatgen/core/entries.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,25 @@
1414
from __future__ import annotations
1515

1616
import abc
17-
import collections
18-
import collections.abc
19-
import csv
20-
import itertools
2117
import json
22-
import logging
2318
import math
24-
import multiprocessing as mp
2519
import os
26-
import re
2720
import warnings
2821
from abc import ABC, abstractmethod
29-
from collections import defaultdict
30-
from datetime import UTC, datetime
31-
from itertools import combinations
3222
from typing import TYPE_CHECKING, cast
3323

3424
import numpy as np
3525
import orjson
3626
from monty.json import MontyDecoder, MontyEncoder, MSONable
37-
from scipy.interpolate import interp1d
3827
from uncertainties import ufloat
3928

40-
from pymatgen.util.due import Doi, due
41-
4229
from .composition import Composition
4330
from .periodic_table import Element
44-
from .structure_matcher import SpeciesComparator, StructureMatcher
4531

4632
if TYPE_CHECKING:
47-
48-
from collections.abc import Iterable
4933
from typing import Literal, Self
5034

51-
from pymatgen.analysis.phase_diagram import PhaseDiagram
5235
from pymatgen.core import DummySpecies, Element, Species, Structure
53-
from pymatgen.util.typing import SpeciesLike
5436

5537
__author__ = "Ryan Kingsbury, Matt McDermott, Shyue Ping Ong, Anubhav Jain"
5638
__copyright__ = "Copyright 2011-2020, The Materials Project"
@@ -63,10 +45,6 @@
6345
G_GASES = orjson.loads(file.read())
6446

6547

66-
67-
68-
69-
7048
__author__ = "Shyue Ping Ong, Anubhav Jain, Ayush Gupta"
7149
__copyright__ = "Copyright 2020, The Materials Project"
7250
__version__ = "1.1"
@@ -851,4 +829,3 @@ def copy(self) -> ComputedStructureEntry:
851829
data=self.data,
852830
entry_id=self.entry_id,
853831
)
854-

src/pymatgen/core/graphs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ def from_edges(cls, structure: Structure, edges: dict) -> Self:
275275
@classmethod
276276
@deprecated(from_edges, "Deprecated on 2024-03-29.", deadline=(2025, 3, 20))
277277
def with_edges(cls, *args, **kwargs):
278+
"""Deprecated method. Use from_edges instead."""
278279
return cls.from_edges(*args, **kwargs)
279280

280281
@classmethod

src/pymatgen/core/molecule_structure_comparator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ def __init__(
183183
The index should start from 0.
184184
priority_cap: The ratio of the elongation of the bond to be
185185
acknowledged for the priority bonds.
186+
ignore_ionic_bond (bool): Whether to ignore ionic bonds.
187+
bond_13_cap (float): The ratio of the elongation of the 1-3 bond to be
188+
acknowledged.
186189
"""
187190
self.bond_length_cap = bond_length_cap
188191
self.covalent_radius = covalent_radius
@@ -206,7 +209,8 @@ def are_equal(self, mol1, mol2) -> bool:
206209

207210
@staticmethod
208211
def get_13_bonds(priority_bonds):
209-
"""
212+
"""Get the 1-3 bonds implied by the given priority bonds.
213+
210214
Args:
211215
priority_bonds (list[tuple]): 12 bonds
212216

src/pymatgen/core/structure_analyzer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def __init__(self, structure: Structure, cutoff=10):
244244
"""
245245
Args:
246246
structure (Structure): Input structure
247-
cutoff (float) Cutoff distance.
247+
cutoff (float): Cutoff distance.
248248
"""
249249
self.cutoff = cutoff
250250
self.structure = structure

src/pymatgen/core/structure_prediction/dopant_predictor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
import warnings
6+
from typing import Any
67

78
import numpy as np
89

@@ -127,7 +128,7 @@ def get_dopants_from_shannon_radii(bonded_structure, num_dopants=5, match_oxi_si
127128

128129
def _get_dopants(substitutions, num_dopants, match_oxi_sign) -> dict:
129130
"""Utility method to get n- and p-type dopants from a list of substitutions."""
130-
dopants = {k: [] for k in ("n_type", "p_type")}
131+
dopants: dict[str, list[dict[str, Any]]] = {k: [] for k in ("n_type", "p_type")}
131132
for k, dop in dopants.items():
132133
for pred in substitutions:
133134
if (

src/pymatgen/core/structure_prediction/substitutor.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ def _is_from_chemical_system(chemical_system, struct) -> bool:
178178

179179
def pred_from_list(self, species_list) -> list[dict]:
180180
"""
181-
There are an exceptionally large number of substitutions to.
182-
look at (260^n), where n is the number of species in the
183-
list. We need a more efficient than brute force way of going
184-
through these possibilities. The brute force method would be:
181+
Predict substitutions from a list of species.
182+
183+
There are an exceptionally large number of substitutions to look at (260^n),
184+
where n is the number of species in the list. We need a more efficient than
185+
brute force way of going through these possibilities. The brute force method would be:
185186
186187
output = []
187188
for p in itertools.product(self._sp.species_list, repeat=len(species_list)):

0 commit comments

Comments
 (0)