Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions LUPY/ancestry.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import pathlib
import inspect

from xml.etree import cElementTree
from xml.etree import ElementTree as ET

from LUPY import xmlNode as xmlNodeMode # Wrapper around the xml parser.
from LUPY import checksums as checksumsModule
Expand Down Expand Up @@ -651,7 +651,7 @@ def parseXMLString(cls, string, **kwargs):

if not isinstance(string, str): raise TypeError('Invalid string.')

node = cElementTree.fromstring(string)
node = ET.fromstring(string)
node = xmlNodeMode.XML_node(node, xmlNodeMode.XML_node.etree)

instance = cls.parseNodeUsingClass(node, [], {}, **kwargs)
Expand All @@ -675,7 +675,7 @@ def readXML_file(cls, fileName, **kwargs):
fileName = str(fileName)
if not isinstance(fileName, str): raise TypeError('Invalid file name.')

node = cElementTree.parse(fileName).getroot()
node = ET.parse(fileName).getroot()
node = xmlNodeMode.XML_node(node, xmlNodeMode.XML_node.etree)

if node.tag != cls.moniker:
Expand Down
8 changes: 4 additions & 4 deletions PoPs/Test/Misc/c.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>

from xml.etree import cElementTree
from xml.etree import ElementTree as ET

from PoPs import database as databaseModule
from PoPs import alias as aliasModule
Expand All @@ -16,7 +16,7 @@

pops = databaseModule.Database( 'LLNL', '0.0.1' )

element = cElementTree.parse( 'pops.xml' )
element = ET.parse( 'pops.xml' )
element = element.getroot( )

def aliases( element ) :
Expand All @@ -33,12 +33,12 @@ def gaugeBosons( element ) :
def baryons( element ) :

for child in element :
pops.add baryonModule.Particle.parseNodeUsingClass(child , [], [ ))
pops.add(baryonModule.Particle.parseNodeUsingClass(child , [], [] ))

def chemicalElements( element ) :

for child in element :
pops.add chemicalElementModule.Suite.parseNodeUsingClass(child, [], []))
pops.add(chemicalElementModule.Suite.parseNodeUsingClass(child, [], []))

for child in element :
if( child.tag == 'aliases' ) :
Expand Down
2 changes: 0 additions & 2 deletions PoPs/Test/Misc/za.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# <<END-copyright>>

from xml.etree import cElementTree

from PoPs import database as databaseModule

from PoPs import misc as miscModule
Expand Down
2 changes: 1 addition & 1 deletion PoPs/bin/Q.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def compoundZandA(pops, particleList):

for particleId in particleIds:
particle = pops[particleId]
Zp, Ap, dummy, dummy = chemicalElementsMiscModule.ZAInfo(particle)
Zp, Ap, _, _ = chemicalElementsMiscModule.ZAInfo(particle)
Z += Zp
A += Ap

Expand Down
2 changes: 1 addition & 1 deletion PoPs/bin/checkPoPs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def printMissing(message, missing):
if len(missing) > 0:
idFormat = '%%-%ds' % max([len(pid) for pid in missing])
diff = sorted([[pid.lower(), pid] for pid in missing])
pids = [idFormat % pid for dummy, pid in diff]
pids = [idFormat % pid for _, pid in diff]
for index in range(0, len(pids), args.missingPerLine):
print(' %s' % ' '.join(pids[index:index+args.missingPerLine]))

Expand Down
4 changes: 2 additions & 2 deletions PoPs/bin/diffPoPs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def missingIds(pops, args, set1, set2, first):
if len(diffList) > 0:
idFormat = '%%-%ds' % max([len(pid) for pid in diffList])
diff = sorted([[pid.lower(), pid] for pid in diffList])
pids = [idFormat % pid for dummy, pid in diff]
pids = [idFormat % pid for _, pid in diff]
for index in range(0, len(pids), args.missingPerLine):
print(' %s' % ' '.join(pids[index:index+args.missingPerLine]))

Expand All @@ -79,7 +79,7 @@ def missingIds(pops, args, set1, set2, first):
missingIds(pops2, args, set2, set1, False)

intersection = sorted([[pid.lower(), pid] for pid in set1.intersection(set2)])
intersection = list(pid for dummy, pid in intersection)
intersection = list(pid for _, pid in intersection)
if args.mass:
print('Mass difference (%s):' % massUnit)
header = ' %-12s %-20s %-20s %-10s %-10s' % ('id', 'mass-1', 'mass-2', 'diff', 'rel-diff')
Expand Down
2 changes: 1 addition & 1 deletion PoPs/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def estimateMass(self, pid, unit, maxASpan=4):
except:
pass

dummy, symbol, A, level, dummy, dummy, dummy = chemicalElementsMiscModule.chemicalElementALevelIDsAndAnti(pid)
_, symbol, A, level, _, _, _ = chemicalElementsMiscModule.chemicalElementALevelIDsAndAnti(pid)
if symbol is None:
return None
try:
Expand Down
8 changes: 4 additions & 4 deletions bin/HDFtoXML.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import sys
import os

from xml.etree import cElementTree as etree
from xml.etree import ElementTree as ET
import numpy
import h5py

Expand All @@ -33,11 +33,11 @@ def addNode( parent, node ):
name = attrs.pop( "_xmltag" )

try:
xmlnode = etree.Element( name )
xmlnode = ET.Element( name )
for key,val in attrs.items():
if key.startswith("_xml"): continue
xmlnode.set( str(key), str(val) )
if isinstance( parent, etree.ElementTree ): parent._setroot( xmlnode )
if isinstance( parent, ET.ElementTree ): parent._setroot( xmlnode )
else: parent.append( xmlnode )
newParent = xmlnode

Expand Down Expand Up @@ -71,7 +71,7 @@ def addDataset( parent, dataset ):
h5file = sys.argv[1]
h5 = h5py.File( h5file, "r" )

xdoc = etree.ElementTree()
xdoc = ET.ElementTree()

root = list(h5.values())[0]
addNode( xdoc, root )
Expand Down
5 changes: 2 additions & 3 deletions bin/XMLtoHDF.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import numpy
from collections import Counter

from xml.etree import cElementTree
from xml.etree import ElementTree as ET
import h5py

parser = argparse.ArgumentParser()
Expand Down Expand Up @@ -121,7 +121,7 @@ def addDocumentation( parent, node, index, suffix=None ):
if __name__ == '__main__':
args = parser.parse_args()

xdoc = cElementTree.parse( args.xml )
xdoc = ET.parse( args.xml )

if args.output is not None:
h5file = args.output
Expand All @@ -140,4 +140,3 @@ def addDocumentation( parent, node, index, suffix=None ):

root = xdoc.getroot()
addNode( h5, root, index=0 )

2 changes: 1 addition & 1 deletion bin/checkExternalFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def checkProtare(path):
for externalFile in protare.externalFiles:
realpath = externalFile.realpath()
if pathlib.Path(realpath).exists():
name, dummy = GNDS_fileModule.type(realpath)
name, _ = GNDS_fileModule.type(realpath)
if name == GNDS_fileModule.HDF5_values:
pass
elif name == covarianceSuiteModule.CovarianceSuite.moniker:
Expand Down
6 changes: 3 additions & 3 deletions bin/checkMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def checkProtare( protareFileName, map, entry ) :
for externalFile in protare.externalFiles:
realpath = externalFile.realpath()
if os.path.exists(realpath):
name, dummy = GNDS_fileModule.type(realpath)
name, _ = GNDS_fileModule.type(realpath)
if name == GNDS_fileModule.HDF5_values:
hdf5ExternalFiles.add(realpath)
hdf5Directories.add(os.path.dirname(realpath))
Expand Down Expand Up @@ -209,7 +209,7 @@ def checkMap(mapFileName, path, priorMaps=[]):
dirsInDirectories.add( file )
else :
try:
name, dummy = GNDS_fileModule.type(file)
name, _ = GNDS_fileModule.type(file)
if( name == mapModule.Map.moniker ) :
mapsInDirectories.add( file )
elif( name == reactionSuiteModule.ReactionSuite.moniker ) :
Expand All @@ -234,7 +234,7 @@ def checkMap(mapFileName, path, priorMaps=[]):
if( os.path.isdir( file ) ) :
mapsInDirectories.add( file )
else :
name, dummy = GNDS_fileModule.type(file)
name, _ = GNDS_fileModule.type(file)
if( name != GNDS_fileModule.HDF5_values) : unknownsInHDF5_directories.add(file)
except :
unknownsInHDF5_directories.add( file )
Expand Down
2 changes: 1 addition & 1 deletion bin/cullStyles.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

args = parser.parse_args( )

name, dummy = GNDS_fileModule.type(args.gnds)
name, _ = GNDS_fileModule.type(args.gnds)

if( name == reactionSuiteModule.ReactionSuite.moniker ) :
gnds = GNDS_fileModule.read(args.gnds)
Expand Down
2 changes: 1 addition & 1 deletion bin/energySpectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def getSpectrum(reactions, reactionSuffix):

totalSpectraTime = timesModule.Times( )
reactionSpectrumNonDiscrete, discreteGammaData, totalCrossSection = getSpectrum(protare.reactions, '')
orphanSpectrum, dummy, dummy = getSpectrum(protare.orphanProducts, ' (orphan product)')
orphanSpectrum, _, _ = getSpectrum(protare.orphanProducts, ' (orphan product)')
totalSpectraTime = totalSpectraTime.toString( current = False )

discreteGammaSpectrum = discreteGammaSpectrumToPDF( discreteGammaData )
Expand Down
2 changes: 1 addition & 1 deletion bin/gnds2gnds.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
fileName = args.input

covariances = []
name, dummy = GNDS_fileModule.type(fileName)
name, _ = GNDS_fileModule.type(fileName)
if name == databaseModule.Database.moniker:
gnds = GNDS_fileModule.read(fileName, lazyParsing=False)
else:
Expand Down
2 changes: 1 addition & 1 deletion bin/listBreakupReactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
MTData = MTDatas[MT]
if( 3 in MTData ) :
MF3 = MTData[3]
dummy, dummy, dummy, LR, dummy, dummy = endfFileToGNDSMisc.sixFunkyFloatStringsToFloats(MF3[1])
_, _, _, LR, _, _ = endfFileToGNDSMisc.sixFunkyFloatStringsToFloats(MF3[1])
if( LR != 0 ) :
counter += 1
if( args.verbose ) :
Expand Down
2 changes: 1 addition & 1 deletion bin/processProtare.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

parserPreview = argparse.ArgumentParser(fromfile_prefix_chars='@', add_help=False)
parserPreview.add_argument('-mg', '--MultiGroup', action='store_true')
argsPreview, dummy = parserPreview.parse_known_args()
argsPreview, _ = parserPreview.parse_known_args()
multigroupPresent = argsPreview.MultiGroup

class ProcessProtareArgumentParser(argparse.ArgumentParser):
Expand Down
2 changes: 1 addition & 1 deletion brownies/LANL/toACE/gndsToACE.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def processEnergyData( massUnit, neutronMass, energyDatas, JXS, XSS, nonFissionE
for MT, EMin, EMax, energyData in energyDatas :
n_multiplicity = []
if MT in nonFissionEnergyDependentNeutronMultiplicities: # Fixup the TYR data whose abs( value ) is greater than 100.
TYR_index, index, multiplicity, dummy = nonFissionEnergyDependentNeutronMultiplicities[MT]
TYR_index, index, multiplicity, _ = nonFissionEnergyDependentNeutronMultiplicities[MT]
JXS5 = JXS[5-1]
if abs( XSS[JXS5+TYR_index-1] ) != index: raise Exception( 'Neutron multiplicity for index %s not found in TYR table' % index )
n_multiplicity = multiplicity.toACE( )
Expand Down
2 changes: 1 addition & 1 deletion brownies/LLNL/bin/bdflsToFluxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
orders.append( flux )
grid += flux
flux = [ ]
for energy, dummy in grid :
for energy, _ in grid :
energyLegendreCoefficients = '%s' % energy
for order in orders : energyLegendreCoefficients += ' %s' % order.evaluate( energy )
flux.append( energyLegendreCoefficients )
Expand Down
18 changes: 9 additions & 9 deletions brownies/bin/ENDF_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def LIST(fOut, label, lineIndex, MFData):
'''Writes to *fOut* an ENDF-6 list record that starts a line *lineIndex* of *MFData*.'''

priorIndex = lineIndex
dummy, dummy, dummy, dummy, NLP, dummy = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
_, _, _, _, NLP, _ = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
NLP = int(NLP)
lineIndex += 1 + (NLP + 5) // 6
printlines(fOut, label, priorIndex, lineIndex, MFData)
Expand All @@ -50,7 +50,7 @@ def TAB1(fOut, label, lineIndex, MFData):
'''Writes to *fOut* an ENDF-6 tab1 record that starts a line *lineIndex* of *MFData*.'''

priorIndex = lineIndex
dummy, dummy, dummy, dummy, NR, NP = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
_, _, _, _, NR, NP = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
NR, NP = int(NR), int(NP)
lineIndex += 1 + (NR + 2) // 3
lineIndex += (NP + 2) // 3
Expand All @@ -67,7 +67,7 @@ def TAB2header(fOut, label, lineIndex, MFData):
'''Writes the header information for an ENDF-6 tab2 record.'''

priorIndex = lineIndex
dummy, dummy, dummy, dummy, NR, NZ = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
_, _, _, _, NR, NZ = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
NR, NZ = int(NR), int(NZ)
lineIndex += 1 + (NR + 2) // 3

Expand Down Expand Up @@ -126,15 +126,15 @@ def LAW5(fOut, lineIndex, MFData):
def LAW6(fOut, lineIndex, MFData):
'''Writes to *fOut* MF 6, law 6 data.'''

APSX, dummy, dummy, dummy, dummy, NPSX = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
APSX, _, _, _, _, NPSX = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
printlines(fOut, '', lineIndex, lineIndex+1, MFData)
return lineIndex + 1

def LAW7(fOut, lineIndex, MFData):
'''Writes to *fOut* MF 6, law 7 data.'''

priorIndex = lineIndex
dummy, dummy, dummy, dummy, NR, NE = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
_, _, _, _, NR, NE = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
NR, NE = int(NR), int(NE)
lineIndex += 1 + (NR + 2) // 3
printlines(fOut, '', priorIndex, lineIndex, MFData)
Expand Down Expand Up @@ -169,8 +169,8 @@ def process(inputFile, outputDir):
TAB1(fOut, '', 1, MFData)
elif MF == 4:
priorIndex = lineIndex
ZA, AWR, dummy, LTT, dummy, dummy = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
dummy, AWR, LI, dummy, dummy, dummy = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex+1])
ZA, AWR, _, LTT, _, _ = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
_, AWR, LI, _, _, _ = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex+1])
lineIndex += 2

LTT = int(LTT)
Expand All @@ -188,7 +188,7 @@ def process(inputFile, outputDir):
lineIndex = TAB2withLIST(fOut, ' Energy', lineIndex, MFData)
lineIndex = TAB2withTAB1(fOut, '', ' Energy', lineIndex, MFData)
elif MF in [6, 26]:
ZA, AWR, JP, LCT, NK, dummy = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
ZA, AWR, JP, LCT, NK, _ = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
NK = int(NK)
lineIndex += 1
for productIndex in range(NK):
Expand Down Expand Up @@ -223,7 +223,7 @@ def process(inputFile, outputDir):
break
elif MF in [12, 13]:
fileName = filePrefix
ZA, AWR, LO, LG, NK, dummy = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
ZA, AWR, LO, LG, NK, _ = endfFileToGNDSMiscModule.sixFunkyFloatStringsToFloats(MFData[lineIndex])
LO = int(LO)
LG = int(LG)
NK = int(NK)
Expand Down
Loading