Skip to content

Commit

Permalink
del doc str trailing blank lines
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Feb 8, 2024
1 parent c910356 commit 8db5a24
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 40 deletions.
3 changes: 0 additions & 3 deletions pymatgen/analysis/graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,6 @@ def set_node_attributes(self):
"""
Gives each node a "specie" and a "coords" attribute, updated with the
current species and coordinates.
"""
species = {}
coords = {}
Expand Down Expand Up @@ -1833,7 +1832,6 @@ def set_node_attributes(self):
"""
Replicates molecule site properties (specie, coords, etc.) in the
MoleculeGraph.
"""
species = {}
coords = {}
Expand Down Expand Up @@ -2048,7 +2046,6 @@ def build_unique_fragments(self):
"""
Find all possible fragment combinations of the MoleculeGraphs (in other
words, all connected induced subgraphs).
"""
self.set_node_attributes()

Expand Down
1 change: 0 additions & 1 deletion pymatgen/analysis/quasirrho.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ def from_qc_output(cls, output: QCOutput, **kwargs) -> QuasiRRHO:
Returns:
QuasiRRHO: QuasiRRHO class instantiated from a QChem Output
"""
mult = output.data["multiplicity"]
elec_e = output.data["SCF_energy_in_the_final_basis_set"]
Expand Down
2 changes: 0 additions & 2 deletions pymatgen/electronic_structure/cohp.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ def __init__(
are_cobis: if True, this are COBIs
orbitals: {[str(Orbital1)-str(Orbital2)]: {"icohp":{Spin.up: icohpvalue for spin.up, Spin.down:
icohpvalue for spin.down}, "orbitals":[Orbital1, Orbital2]}}.
"""
if are_coops and are_cobis:
raise ValueError("You cannot have info about COOPs and COBIs in the same file.")
Expand Down Expand Up @@ -938,7 +937,6 @@ def summed_orbital_icohp(self):
Returns:
{"str(Orbital1)-str(Ortibal2)": icohp value in eV}.
"""
orbital_icohp = {}
for orb, item in self._orbitals.items():
Expand Down
6 changes: 3 additions & 3 deletions pymatgen/io/abinit/abiobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ def __init__(self, occopt, tsmear):
self.tsmear = tsmear

def __str__(self):
s = f"occopt {self.occopt} # {self.mode} Smearing\n"
string = f"occopt {self.occopt} # {self.mode} Smearing\n"
if self.tsmear:
s += f"tsmear {self.tsmear}"
return s
string += f"tsmear {self.tsmear}"
return string

def __eq__(self, other: object) -> bool:
needed_attrs = ("occopt", "tsmear")
Expand Down
6 changes: 3 additions & 3 deletions pymatgen/io/abinit/netcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def to_str(self, verbose=0, title=None, **kwargs):
"""
from pprint import pformat

s = pformat(self, **kwargs)
header_str = pformat(self, **kwargs)
if title is not None:
return "\n".join([marquee(title, mark="="), s])
return s
return "\n".join([marquee(title, mark="="), header_str])
return header_str
26 changes: 13 additions & 13 deletions pymatgen/io/adf.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def __init__(self, name, options=None, subkeys=None):
def _options_string(self):
"""Return the option string."""
if len(self.options) > 0:
s = ""
opt_str = ""
for op in self.options:
if self._sized_op:
s += f"{op[0]}={op[1]} "
opt_str += f"{op[0]}={op[1]} "
else:
s += f"{op} "
return s.strip()
opt_str += f"{op} "
return opt_str.strip()
return ""

def is_block_key(self) -> bool:
Expand All @@ -145,27 +145,27 @@ def __str__(self):
If this key is 'Atoms' and the coordinates are in Cartesian form, a
different string format will be used.
"""
s = f"{self.key}"
adf_str = f"{self.key}"
if len(self.options) > 0:
s += f" {self._options_string()}"
s += "\n"
adf_str += f" {self._options_string()}"
adf_str += "\n"
if len(self.subkeys) > 0:
if self.key.lower() == "atoms":
for subkey in self.subkeys:
s += (
adf_str += (
f"{subkey.name:2s} {subkey.options[0]: 14.8f}"
f" {subkey.options[1]: 14.8f} {subkey.options[2]: 14.8f}\n"
)
else:
for subkey in self.subkeys:
s += str(subkey)
adf_str += str(subkey)
if self.is_block_key():
s += "END\n"
adf_str += "END\n"
else:
s += "subend\n"
adf_str += "subend\n"
elif self.key.upper() in self._full_blocks:
s += "END\n"
return s
adf_str += "END\n"
return adf_str

def __eq__(self, other: object) -> bool:
if not isinstance(other, AdfKey):
Expand Down
1 change: 0 additions & 1 deletion pymatgen/io/aims/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ def parameters(self, parameters: dict[str, Any]) -> None:
Args:
parameters (dict[str, Any]): The new set of parameters to use
"""
self._parameters = parameters
if "output" not in self._parameters:
Expand Down
1 change: 0 additions & 1 deletion pymatgen/io/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ def to_cube(self, filename, comment=None):
Args:
filename (str): Name of the cube file to be written.
comment (str): If provided, this will be added to the second comment line
"""
with zopen(filename, mode="wt") as file:
file.write(f"# Cube file for {self.structure.formula} generated by Pymatgen\n")
Expand Down
13 changes: 6 additions & 7 deletions pymatgen/io/cp2k/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,15 +536,14 @@ def by_path(self, path: str):
Args:
path (str): Path to section of form 'SUBSECTION1/SUBSECTION2/SUBSECTION_OF_INTEREST'
"""
_path = path.split("/")
if _path[0].upper() == self.name.upper():
_path = _path[1:]
s = self
sec_str = self
for p in _path:
s = s.get_section(p)
return s
sec_str = sec_str.get_section(p)
return sec_str

def get_str(self) -> str:
"""Get string representation of Section."""
Expand Down Expand Up @@ -690,10 +689,10 @@ def __init__(self, name: str = "CP2K_INPUT", subsections: dict | None = None, **

def get_str(self):
"""Get string representation of the Cp2kInput."""
s = ""
string = ""
for v in self.subsections.values():
s += v.get_str()
return s
string += v.get_str()
return string

@classmethod
def _from_dict(cls, d):
Expand Down
2 changes: 1 addition & 1 deletion pymatgen/io/cp2k/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,10 +1491,10 @@ def parse_raman(self):

@staticmethod
def _gauss_smear(densities, energies, npts, width):
"""Return a gaussian smeared DOS"""
if not width:
return densities

"""Return a gaussian smeared DOS"""
dct = np.zeros(npts)
e_s = np.linspace(min(energies), max(energies), npts)

Expand Down
4 changes: 2 additions & 2 deletions pymatgen/io/nwchem.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,8 @@ def _parse_job(output):
def fort2py(x):
return x.replace("D", "e")

def isfloatstring(s):
return s.find(".") == -1
def isfloatstring(in_str):
return in_str.find(".") == -1

parse_hess = False
parse_proj_hess = False
Expand Down
1 change: 0 additions & 1 deletion pymatgen/io/qchem/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ def molecule_template(molecule: Molecule | list[Molecule] | Literal["read"]) ->
Returns:
(str) Molecule template.
"""
# TODO: add ghost atoms
mol_list = []
Expand Down
3 changes: 1 addition & 2 deletions tests/command_line/test_gulp_caller.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ def test_run(self):
gin += "O shel O shel 22764.000 0.14900 27.87900 0.0 12.0\n"
gc = GulpCaller()

"""Some inherent checks are in the run_gulp function itself.
They should be sufficient for raising errors."""
# some inherent checks are in the run_gulp function itself. should be sufficient for raising errors
gc.run(gin)

def test_decimal(self):
Expand Down

0 comments on commit 8db5a24

Please sign in to comment.