Skip to content

Commit

Permalink
fix doc str indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Nov 15, 2023
1 parent 6e94085 commit af2ed4d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 36 deletions.
37 changes: 21 additions & 16 deletions pymatgen/analysis/chemenv/connectivity/connected_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,32 +574,28 @@ def is_0d(self) -> bool:
"""Whether this connected component is 0-dimensional."""
if self._periodicity_vectors is None:
self.compute_periodicity()
assert self._periodicity_vectors is not None # fix mypy arg 1 to len has incompatible type Optional
return len(self._periodicity_vectors) == 0
return len(self._periodicity_vectors) == 0 # type: ignore[arg-type]

@property
def is_1d(self) -> bool:
"""Whether this connected component is 1-dimensional."""
if self._periodicity_vectors is None:
self.compute_periodicity()
assert self._periodicity_vectors is not None # fix mypy arg 1 to len has incompatible type Optional
return len(self._periodicity_vectors) == 1
return len(self._periodicity_vectors) == 1 # type: ignore[arg-type]

@property
def is_2d(self) -> bool:
"""Whether this connected component is 2-dimensional."""
if self._periodicity_vectors is None:
self.compute_periodicity()
assert self._periodicity_vectors is not None # fix mypy arg 1 to len has incompatible type Optional
return len(self._periodicity_vectors) == 2
return len(self._periodicity_vectors) == 2 # type: ignore[arg-type]

@property
def is_3d(self) -> bool:
"""Whether this connected component is 3-dimensional."""
if self._periodicity_vectors is None:
self.compute_periodicity()
assert self._periodicity_vectors is not None # fix mypy arg 1 to len has incompatible type Optional
return len(self._periodicity_vectors) == 3
return len(self._periodicity_vectors) == 3 # type: ignore[arg-type]

@staticmethod
def _order_vectors(vectors):
Expand Down Expand Up @@ -654,10 +650,10 @@ def elastic_centered_graph(self, start_node=None):
logging.info("In elastic centering")
# Loop on start_nodes, sometimes some nodes cannot be elastically taken
# inside the cell if you start from a specific node
ntest_nodes = 0
n_test_nodes = 0
start_node = next(iter(self.graph.nodes()))

ntest_nodes += 1
n_test_nodes += 1
centered_connected_subgraph = nx.MultiGraph()
centered_connected_subgraph.add_nodes_from(self.graph.nodes())
centered_connected_subgraph.add_edges_from(self.graph.edges(data=True))
Expand Down Expand Up @@ -782,12 +778,21 @@ def _retuplify_edgedata(edata):
"""
Private method used to cast back lists to tuples where applicable in an edge data.
The format of the edge data is :
{'start': STARTINDEX, 'end': ENDINDEX, 'delta': TUPLE(DELTAX, DELTAY, DELTAZ),
'ligands': [TUPLE(LIGAND_1_INDEX, TUPLE(DELTAX_START_LIG_1, DELTAY_START_LIG_1, DELTAZ_START_LIG_1),
TUPLE(DELTAX_END_LIG_1, DELTAY_END_LIG_1, DELTAZ_END_LIG_1)),
TUPLE(LIGAND_2_INDEX, ...),
... ]}
The format of the edge data is:
{
"start": STARTINDEX,
"end": ENDINDEX,
"delta": TUPLE(DELTAX, DELTAY, DELTAZ),
"ligands": [
TUPLE(
LIGAND_1_INDEX,
TUPLE(DELTAX_START_LIG_1, DELTAY_START_LIG_1, DELTAZ_START_LIG_1),
TUPLE(DELTAX_END_LIG_1, DELTAY_END_LIG_1, DELTAZ_END_LIG_1),
),
TUPLE(LIGAND_2_INDEX, ...),
...,
],
}
When serializing to json/bson, these tuples are transformed into lists. This method transforms these lists
back to tuples.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,9 +1584,9 @@ def coordination_geometry_symmetry_measures_separation_plane_optim(
Returns:
tuple: Continuous symmetry measures for the given coordination geometry for each plane and permutation
investigated, corresponding permutations, corresponding algorithms,
corresponding mappings from local to perfect environment and corresponding mappings
from perfect to local environment.
investigated, corresponding permutations, corresponding algorithms,
corresponding mappings from local to perfect environment and corresponding mappings
from perfect to local environment.
"""
if optimization == 2:
logging.log(level=5, msg="... using optimization = 2")
Expand Down
10 changes: 5 additions & 5 deletions pymatgen/electronic_structure/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3298,7 +3298,7 @@ def plot_seebeck_dop(self, temps="all", output="average"):
Args:
temps: the default 'all' plots all the temperatures in the analyzer.
Specify a list of temperatures if you want to plot only some.
Specify a list of temperatures if you want to plot only some.
output: with 'average' you get an average of the three directions
with 'eigs' you get all the three directions.
Expand Down Expand Up @@ -3343,7 +3343,7 @@ def plot_conductivity_dop(self, temps="all", output="average", relaxation_time=1
Args:
temps: the default 'all' plots all the temperatures in the analyzer.
Specify a list of temperatures if you want to plot only some.
Specify a list of temperatures if you want to plot only some.
output: with 'average' you get an average of the three directions
with 'eigs' you get all the three directions.
relaxation_time: specify a constant relaxation time value
Expand Down Expand Up @@ -3392,7 +3392,7 @@ def plot_power_factor_dop(self, temps="all", output="average", relaxation_time=1
Args:
temps: the default 'all' plots all the temperatures in the analyzer.
Specify a list of temperatures if you want to plot only some.
Specify a list of temperatures if you want to plot only some.
output: with 'average' you get an average of the three directions
with 'eigs' you get all the three directions.
relaxation_time: specify a constant relaxation time value
Expand Down Expand Up @@ -3438,7 +3438,7 @@ def plot_zt_dop(self, temps="all", output="average", relaxation_time=1e-14):
Args:
temps: the default 'all' plots all the temperatures in the analyzer.
Specify a list of temperatures if you want to plot only some.
Specify a list of temperatures if you want to plot only some.
output: with 'average' you get an average of the three directions
with 'eigs' you get all the three directions.
relaxation_time: specify a constant relaxation time value
Expand Down Expand Up @@ -3489,7 +3489,7 @@ def plot_eff_mass_dop(self, temps="all", output="average"):
Args:
temps: the default 'all' plots all the temperatures in the analyzer.
Specify a list of temperatures if you want to plot only some.
Specify a list of temperatures if you want to plot only some.
output: with 'average' you get an average of the three directions
with 'eigs' you get all the three directions.
relaxation_time: specify a constant relaxation time value
Expand Down
4 changes: 1 addition & 3 deletions pymatgen/io/abinit/abiobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ def structure_from_abivars(cls=None, *args, **kwargs):
Example:
al_structure = structure_from_abivars(
acell=3*[7.5],
rprim=[0.0, 0.5, 0.5,
0.5, 0.0, 0.5,
0.5, 0.5, 0.0],
rprim=[0.0, 0.5, 0.5, 0.5, 0.0, 0.5, 0.5, 0.5, 0.0],
typat=1,
xred=[0.0, 0.0, 0.0],
ntypat=1,
Expand Down
6 changes: 3 additions & 3 deletions pymatgen/io/abinit/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def _get_shifts(shift_mode, structure):
return shifts
return ((0, 0, 0),)

raise ValueError(f"invalid {shift_mode=}")
raise ValueError(f"Invalid {shift_mode=}")


def gs_input(
Expand All @@ -272,9 +272,9 @@ def gs_input(
kppa: Defines the sampling used for the SCF run. Defaults to 1000 if not given.
ecut: cutoff energy in Ha (if None, ecut is initialized from the pseudos according to accuracy)
pawecutdg: cutoff energy in Ha for PAW double-grid (if None, pawecutdg is initialized from the pseudos
according to accuracy)
according to accuracy)
scf_nband: Number of bands for SCF run. If scf_nband is None, nband is automatically initialized
from the list of pseudos, the structure and the smearing option.
from the list of pseudos, the structure and the smearing option.
accuracy: Accuracy of the calculation.
spin_mode: Spin polarization.
smearing: Smearing technique.
Expand Down
12 changes: 6 additions & 6 deletions pymatgen/io/vasp/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4138,12 +4138,12 @@ def get_adjusted_fermi_level(efermi, cbm, band_structure):
# make a working copy of band_structure
bs_working = BandStructureSymmLine.from_dict(band_structure.as_dict())
if bs_working.is_metal():
e = efermi
while e < cbm:
e += 0.01
bs_working._efermi = e
energy = efermi
while energy < cbm:
energy += 0.01
bs_working._efermi = energy
if not bs_working.is_metal():
return e
return energy
return efermi


Expand Down Expand Up @@ -4249,7 +4249,7 @@ def __init__(self, filename="WAVECAR", verbose=False, precision="normal", vasp_t
# and occupations in way that does not span FORTRAN records, but
# reader below appears to assume that record boundaries can be ignored
# (see OUTWAV vs. OUTWAV_4 in vasp fileio.F)
raise ValueError(f"invalid {rtag=}, must be one of {valid_rtags}")
raise ValueError(f"Invalid {rtag=}, must be one of {valid_rtags}")

# padding to end of fortran REC=1
np.fromfile(f, dtype=np.float64, count=recl8 - 3)
Expand Down

0 comments on commit af2ed4d

Please sign in to comment.