theochem / iodata

Consider using f-strings PYL-C0209
Performance
Minor
3 months ago4 months old
Formatting a regular string which could be a f-string
 35__all__ = ("convert",)
 36
 37
 38DESCRIPTION = """\ 39Convert between file formats supported by IOData. This only works if the input
 40contains sufficient data for the output.
 41
Formatting a regular string which could be a f-string
 85        A temporary directory where the truncated file is stored.
 86
 87    """
 88    fn_truncated = "%s/truncated_%i_%s" % (tmpdir, nline, os.path.basename(fn_orig)) 89    with open(fn_orig) as f_orig, open(fn_truncated, "w") as f_truncated:
 90        for counter, line in enumerate(f_orig):
 91            if counter >= nline:
Formatting a regular string which could be a f-string
619def dump_one(f: TextIO, data: IOData):
620    """Do not edit this docstring. It will be overwritten."""
621    # write title
622    print("{:72}".format(data.title or "FCHK generated by IOData"), file=f)623
624    # write run type, level of theory, and basis set name (all in uppercase)
625    items = [getattr(data, item) or "NA" for item in ["run_type", "lot", "obasis_name"]]
Formatting a regular string which could be a f-string
866            if last_icenter != -1:
867                f.write("\n")
868            last_icenter = shell.icenter
869            f.write("%3i 0\n" % (shell.icenter + 1))870        # Write out the basis.
871        # It is guaranteed to be segmented when reaching this part of the code.
872        angmom = shell.angmoms[0]
Formatting a regular string which could be a f-string
376        )
377    if occupations.max() > occ_max + eps:
378        raise ValueError(
379            "The density matrix has eigenvalues considerably larger than "380            "max. error=%e" % (occupations.max() - 1)
381        )
382