theochem / iodata

Redundant list comprehension can be replaced using generator PYL-R1728
Performance
Minor
3 months ago4 months old
Consider using a generator instead 'sum(1 for st in shell_types if st == 3)'
678                )
679
680        num_pure_d_shells = sum([1 for st in shell_types if st == 2])
681        num_pure_f_shells = sum([1 for st in shell_types if st == 3])682
683        _dump_integer_scalars("Number of basis functions", data.obasis.nbasis, f)
684        _dump_integer_scalars("Number of independent functions", data.obasis.nbasis, f)
Consider using a generator instead 'sum(1 for st in shell_types if st == 2)'
677                    "Call prepare_dump first."
678                )
679
680        num_pure_d_shells = sum([1 for st in shell_types if st == 2])681        num_pure_f_shells = sum([1 for st in shell_types if st == 3])
682
683        _dump_integer_scalars("Number of basis functions", data.obasis.nbasis, f)
Consider using a generator instead 'max(shell.angmoms[0] for shell in obasis.shells)'
598    expns = [shell.exponents[0] for shell in obasis.shells for _ in range(shell.nbasis)]
599    angmom_prim = {}
600    count = 1
601    for angmom in range(max([shell.angmoms[0] for shell in obasis.shells]) + 1):602        angmom_prim[angmom] = [count + i for i in range(len(obasis.conventions[angmom, "c"]))]
603        count += len(obasis.conventions[angmom, "c"])
604    types = [item for shell in obasis.shells for item in angmom_prim[shell.angmoms[0]]]
Consider using a generator instead 'max(shell.angmoms[0] for shell in obasis.shells)'
489    # write primitive types
490    angmom_prim = {}
491    count = 1
492    for angmom in range(max([shell.angmoms[0] for shell in obasis.shells]) + 1):493        angmom_prim[angmom] = [count + i for i in range(len(obasis.conventions[angmom, "c"]))]
494        count += len(obasis.conventions[angmom, "c"])
495    prim_types = [item for shell in obasis.shells for item in angmom_prim[shell.angmoms[0]]]