Skip to content

Commit

Permalink
pyInterface: fix pylint errors
Browse files Browse the repository at this point in the history
Fix pylint errors for version 1.7.1:
* Do not use `len(SEQUENCE)` as condition value
* Unnecessary "else" after "return"

Version 1.7.1 cannot yet be made the default for Travis, as this version
cannot handle the way we install out Python module using symbolic links
(pylint-dev/pylint#1470).
  • Loading branch information
suhlatwork authored and bgrube committed Jul 13, 2017
1 parent 345a2e8 commit 1394fd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion pyInterface/scripts/calcAmplitudes.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
sys.exit(1)
waveList = [allWaveNames[args.keyfileIndex]]
pyRootPwa.utils.printInfo("using keyfile index " + str(args.keyfileIndex) + " resulting in the wave name '" + waveList[0] + "'.")
if len(waveList) == 0:
if not waveList:
waveList = fileManager.getWaveNameList()

eventsTypes = []
Expand Down
28 changes: 14 additions & 14 deletions pyInterface/scripts/convertTreeToEvt.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
import pyRootPwa.core

def writeParticleToFile (outFile, particleName, particleMomentum):
if pyRootPwa.core.particleDataTable.isInTable(particleName):
partProperties = pyRootPwa.core.particleDataTable.entry(particleName)
charge = partProperties.charge
energy = math.sqrt(particleMomentum.Px()**2 + particleMomentum.Py()**2 + particleMomentum.Pz()**2 + partProperties.mass2)
outFile.write(
str(pyRootPwa.core.particleDataTable.geantIdFromParticleName(particleName)) + " " +
str(charge) + " " +
'%.16e' % particleMomentum.Px() + " " +
'%.16e' % particleMomentum.Py() + " " +
'%.16e' % particleMomentum.Pz() + " " +
'%.16e' % energy + "\n"
)
return True
else:
if not pyRootPwa.core.particleDataTable.isInTable(particleName):
pyRootPwa.utils.printErr("particle '" + particleName + "' not found in particleDataTable.")
return False

partProperties = pyRootPwa.core.particleDataTable.entry(particleName)
charge = partProperties.charge
energy = math.sqrt(particleMomentum.Px()**2 + particleMomentum.Py()**2 + particleMomentum.Pz()**2 + partProperties.mass2)
outFile.write(
str(pyRootPwa.core.particleDataTable.geantIdFromParticleName(particleName)) + " " +
str(charge) + " " +
'%.16e' % particleMomentum.Px() + " " +
'%.16e' % particleMomentum.Py() + " " +
'%.16e' % particleMomentum.Pz() + " " +
'%.16e' % energy + "\n"
)
return True

if __name__ == "__main__":

parser = argparse.ArgumentParser(
Expand Down
2 changes: 1 addition & 1 deletion pyInterface/scripts/plotAngles.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def getPermutationsForIsobarCombinations(topology, isobarCombinations):
parser.add_argument("--disable-bose-symmetrization", action="store_true", dest="disableBoseSymmetrization", help="do not consider Bose-symmetric permutations")
parser.add_argument("--weight-file", type=str, metavar="weightFile", dest="weightFile", help="weightFile")
arguments = parser.parse_args()
if len(arguments.massBins) == 0:
if not arguments.massBins:
arguments.massBins.append("all")

if arguments.type not in ["data", "acc", "gen"]:
Expand Down

0 comments on commit 1394fd6

Please sign in to comment.