Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
futurize fixes: lib2to3.fixes.fix_dict
cmd:
find . -name '*.py' | xargs futurize -w -n --no-diff -j6 -f lib2to3.fixes.fix_dict
  • Loading branch information
shadowwalkersb committed Jul 13, 2018
1 parent a84983d commit 69bd08b
Show file tree
Hide file tree
Showing 117 changed files with 435 additions and 435 deletions.
2 changes: 1 addition & 1 deletion broken/e2avg_ffts.py
Expand Up @@ -53,7 +53,7 @@ def avg_this_pixel (filename, imagedict, thr, i,j,k):
# suma2=0.
num=0
numth=0
for filename in imagedict.keys():
for filename in list(imagedict.keys()):
# print filename, i,j,k
re= imagedict[filename].get_value_at(i,j,k)
im= imagedict[filename].get_value_at(i+1,j,k)
Expand Down
2 changes: 1 addition & 1 deletion broken/e2plotFSC.py
Expand Up @@ -75,7 +75,7 @@ def main():
print("Rubbish!!!, no FSC curves found!!!")
return
db = db_open_dict(db_name,ro=True)
keys = db.keys()
keys = list(db.keys())

# Load desired FSC curves
res = []
Expand Down
2 changes: 1 addition & 1 deletion broken/e2preferences.py
Expand Up @@ -106,7 +106,7 @@ def write_db_entries(self,params):
HOMEDB.open_dict("e2tomoboxer_preferences")
db_tomo = HOMEDB.e2tomoboxer_preferences
tmp_db = None
for key,value in params.items():
for key,value in list(params.items()):
if key in self.__tomoboxer_entries:
tmp_db = db_tomo
elif key in self.__display_entries:
Expand Down
2 changes: 1 addition & 1 deletion broken/e2remoted.py
Expand Up @@ -181,7 +181,7 @@ def recv_file(stdin,path):
def send_bdb(stdout,path):
"Sends a BDB to stdout as a set of compressed pickled key/value pairs, terminated by a None key"
db=db_open_dict(path)
keys=db.keys()
keys=list(db.keys())
for k in keys:
write_obj(stdout,k)
write_obj(stdout,db[k])
Expand Down
2 changes: 1 addition & 1 deletion broken/e2scp.py
Expand Up @@ -212,7 +212,7 @@ def recv_file(stdin,path):
def send_bdb(stdout,path):
"Sends a BDB to stdout as a set of compressed pickled key/value pairs, terminated by a None key"
db=db_open_dict(path)
keys=db.keys()
keys=list(db.keys())
for k in keys:
write_obj(stdout,k)
write_obj(stdout,db[k])
Expand Down
16 changes: 8 additions & 8 deletions doc/modular_class_html/docgen.py
Expand Up @@ -71,7 +71,7 @@ def write_processor(processorname, output, bgcolor):

typedict = processor.get_param_types()
output.write(" <td>")
typekeys = typedict.keys()
typekeys = list(typedict.keys())

for typekey in typekeys:
output.write(typedict.get_type(typekey).lower() + " ")
Expand All @@ -91,7 +91,7 @@ def write_cmp(cmp_name, output, bgcolor):

typedict = cmp.get_param_types()
output.write(" <td>")
typekeys = typedict.keys()
typekeys = list(typedict.keys())

for typekey in typekeys:
output.write(typedict.get_type(typekey).lower() + " ")
Expand All @@ -111,7 +111,7 @@ def write_aligner(aligner_name, output, bgcolor):

typedict = align.get_param_types()
output.write(" <td>")
typekeys = typedict.keys()
typekeys = list(typedict.keys())

for typekey in typekeys:
output.write(typedict.get_type(typekey).lower() + " ")
Expand All @@ -131,7 +131,7 @@ def write_projector(projector_name, output, bgcolor):

typedict = project.get_param_types()
output.write(" <td>")
typekeys = typedict.keys()
typekeys = list(typedict.keys())

for typekey in typekeys:
output.write(typedict.get_type(typekey).lower() + " ")
Expand All @@ -151,7 +151,7 @@ def write_reconstructor(reconstructor_name, output, bgcolor):

typedict = reconstruct.get_param_types()
output.write(" <td>")
typekeys = typedict.keys()
typekeys = list(typedict.keys())

for typekey in typekeys:
output.write(typedict.get_type(typekey).lower() + " ")
Expand All @@ -171,7 +171,7 @@ def write_averager(averager_name, output, bgcolor):

typedict = average.get_param_types()
output.write(" <td>")
typekeys = typedict.keys()
typekeys = list(typedict.keys())

for typekey in typekeys:
output.write(typedict.get_type(typekey).lower() + " ")
Expand All @@ -191,7 +191,7 @@ def write_analyzer(analyzer_name, output, bgcolor):

typedict = analyze.get_param_types()
output.write(" <td>")
typekeys = typedict.keys()
typekeys = list(typedict.keys())

for typekey in typekeys:
output.write(typedict.get_type(typekey).lower() + " ")
Expand Down Expand Up @@ -356,7 +356,7 @@ def write_group_processors():
gout = open("processor_groups.html", "wb")
write_header(gout, 'Processor Group')
processorgroups = group_processors()
groupnames = processorgroups.keys()
groupnames = list(processorgroups.keys())
bgcolor1 = 'f0f0fa'
bgcolor2 = 'fafaf0'
bgcolor = bgcolor1
Expand Down
2 changes: 1 addition & 1 deletion examples/e2extractctf.py
Expand Up @@ -8,7 +8,7 @@
db=db_open_dict("bdb:e2ctf.parms",True)

out=open("ctf_parms.txt","w")
for k in db.keys():
for k in list(db.keys()):
ctf=EMAN2Ctf()
ctf.from_string(db[k][0])
out.write( "%s,%1.3f,%1.1f\n"%(k,ctf.defocus,ctf.bfactor))
2 changes: 1 addition & 1 deletion examples/e2melonball.py
Expand Up @@ -402,7 +402,7 @@ def getptcltransforms(options):

ptclts = {}

keys = jsonfileopen.keys()
keys = list(jsonfileopen.keys())
keys.sort()
#n = len(keys)
for j in xrange(0,n):
Expand Down
2 changes: 1 addition & 1 deletion examples/e2plot_de_motion.py
Expand Up @@ -231,7 +231,7 @@ def main():
print("\n(DE_translation_plotter)(main) ids before are {} type={} ".format( ids, type(ids) ))
print("\ndatadict is {}".format(datadict))

datadictsorted = sorted(datadict.items(), key=lambda e: e[1][0])
datadictsorted = sorted(list(datadict.items()), key=lambda e: e[1][0])

if options.verbose > 9:
print("\n(DE_translation_plotter)(main) datadictsorted is {}".format(datadictsorted))
Expand Down
2 changes: 1 addition & 1 deletion examples/e2plotfig.py
Expand Up @@ -349,7 +349,7 @@ def plotdata( options, data ):

#import string
#markers=string.printable
markers = matplotlib.markers.MarkerStyle.markers.keys()
markers = list(matplotlib.markers.MarkerStyle.markers.keys())
marker=''


Expand Down
2 changes: 1 addition & 1 deletion examples/e2simmxptclqual.py
Expand Up @@ -96,7 +96,7 @@ def main():
except: bvecs[N]=im

# normalize all vector sums
for im in bvecs.values():
for im in list(bvecs.values()):
im.process_inplace("normalize.unitlen")

# Make an output image of vectors
Expand Down
2 changes: 1 addition & 1 deletion examples/e2spt_eval_orient.py
Expand Up @@ -62,7 +62,7 @@ def main():
out=open(options.output,"w")

alts=[ [] for i in xrange(18)]
for k in db.keys():
for k in list(db.keys()):
xf=db[k][0].inverse()
xfd=xf.get_params("eman")
out.write("%1.3f,\t%1.3f,\t%1.3f,\t%1.3g\n"%(xfd["az"],xfd["alt"],xfd["phi"],float(db[k][1])))
Expand Down
2 changes: 1 addition & 1 deletion examples/e2spt_extract_align.py
Expand Up @@ -115,7 +115,7 @@ def main():
print("Line of coordinates to add",line)
tomograms[tomogram].append(line)

for tomogram in tomograms.keys():
for tomogram in list(tomograms.keys()):
#coordsfile = options.path + '/' + options.input.replace('.hdf','_coords.txt')
coordsfile = options.path + '/' + tomogram.split('.')[0] + '_coords.txt'

Expand Down
2 changes: 1 addition & 1 deletion examples/e2spt_group.py
Expand Up @@ -176,7 +176,7 @@ def main():
dataset.update({i:scores[i]})
#x.append(i)

dataset = sorted( dataset.items(), key=itemgetter(1), reverse=True )
dataset = sorted( list(dataset.items()), key=itemgetter(1), reverse=True )

if options.normalizeplot:
#for s in scores:
Expand Down
2 changes: 1 addition & 1 deletion examples/e2spt_radialdensityplot.py
Expand Up @@ -203,7 +203,7 @@ def main():

cc=0
for ele in finalvalues:
thisfile = ele.keys()[0]
thisfile = list(ele.keys())[0]
key = thisfile

n = EMUtil.get_image_count(thisfile)
Expand Down
4 changes: 2 additions & 2 deletions examples/e2spt_reconfromtilts.py
Expand Up @@ -21,7 +21,7 @@ def main():

sptpath=os.path.dirname(options.json)
js=js_open_dict(options.json)
print("Read alignment of {:d} 3D particles.".format(len(js.keys())))
print("Read alignment of {:d} 3D particles.".format(len(list(js.keys()))))
ks=[eval(str(s)) for s in sorted(js.keys())]

### lists in dictionaries in dictionaries.....
Expand All @@ -48,7 +48,7 @@ def main():

lst=[LSXFile(m, False) for m in lname]

pnames=ptclnames.keys()
pnames=list(ptclnames.keys())
for pname in pnames:
modelids=sorted(ptclnames[pname].keys())
num=EMUtil.get_image_count(pname)
Expand Down
2 changes: 1 addition & 1 deletion examples/e2spt_transform.py
Expand Up @@ -116,7 +116,7 @@ def main():
n = int(nt)
print("\nWARNING: more particles/coordinates n={} than transform parameters nt={}".format(n,nt))

keys = jsonfileopen.keys()
keys = list(jsonfileopen.keys())
keys.sort()
for j in range(n):
label = keys[j]
Expand Down
2 changes: 1 addition & 1 deletion examples/e2starfiletoboxfile.py
Expand Up @@ -42,7 +42,7 @@ def main():

logger = E2init(sys.argv)

hdr = starf.keys()
hdr = list(starf.keys())

# resolve correct micrograph dictionary key

Expand Down
2 changes: 1 addition & 1 deletion examples/e2starfiletolstfile.py
Expand Up @@ -48,7 +48,7 @@

# in the below line, -1 tells it to append the line, the next value is the image number in that image, and the final value is the image name

for i in range(len(starf[starf.keys()[0]])):
for i in range(len(starf[list(starf.keys())[0]])):
if options.path:
filepath1=starf['rlnImageName'][i].split("@")[1].replace(".mrcs",".hdf").split("/")
filepath = options.path + "/" + filepath1[len(filepath1)-1]
Expand Down
4 changes: 2 additions & 2 deletions examples/e2tomogram_old.py
Expand Up @@ -112,7 +112,7 @@ def mode(vals):
try: d[i]=d[i]+1
except: d[i]=1

cnt=[(i[1],i[0]) for i in d.items()]
cnt=[(i[1],i[0]) for i in list(d.items())]

cnt.sort()

Expand Down Expand Up @@ -209,7 +209,7 @@ def main():

if options.mode=="modeshift" :
dct=matrixalign(im1,im2,options.box,options.box+options.maxshift,debug=i[0]==63)
vec=dct.values()
vec=list(dct.values())
vec.sort() # sort in order of peak height
vec2=vec[-len(vec)/4:] # take the 25% strongest correlation peaks

Expand Down
2 changes: 1 addition & 1 deletion examples/extractfsc.py
Expand Up @@ -42,7 +42,7 @@

db=db_open_dict("bdb:%s#convergence.results"%sys.argv[1],ro=True)

for k in db.keys():
for k in list(db.keys()):
curve=db[k]
out=open("fsc_%s_%s.txt"%(sys.argv[1].rsplit("_",1)[-1],k),"w")
for i in xrange(len(curve[0])): out.write("%1.5f\t%1.4f\n"%(curve[0][i],curve[1][i]))
2 changes: 1 addition & 1 deletion examples/extractptclfromseg.py
Expand Up @@ -226,7 +226,7 @@ def main():
jsname=info_name(tomoname)
js=js_open_dict(jsname)
if "class_list" in js:
clst=[int(k) for k in js["class_list"].keys()]
clst=[int(k) for k in list(js["class_list"].keys())]
for ii in range(100):
if ii not in clst:
mytag=ii
Expand Down
10 changes: 5 additions & 5 deletions examples/mergeproject.py
Expand Up @@ -68,7 +68,7 @@
# filter out images with low quality if requested
if minq>0 :
src2=db_open_dict("bdb:%s#e2ctf.parms"%source,ro=True)
for k in src2.keys():
for k in list(src2.keys()):
if src2[k][3]<minq :
print("%s excluded with quality %d"%(k,src2[k][3]))
try: del srcptcl[k]
Expand Down Expand Up @@ -99,29 +99,29 @@
print("Copy e2ctf.bg2d")
src=db_open_dict("bdb:%s#e2ctf.bg2d"%source,ro=True)
dest=db_open_dict("bdb:.#e2ctf.bg2d")
for k in src.keys():
for k in list(src.keys()):
print(k)
dest[k]=src[k]

print("Copy e2ctf.im2d")
src=db_open_dict("bdb:%s#e2ctf.im2d"%source,ro=True)
dest=db_open_dict("bdb:.#e2ctf.im2d")
for k in src.keys():
for k in list(src.keys()):
print(k)
dest[k]=src[k]

print("Copy e2ctf.parms")
src=db_open_dict("bdb:%s#e2ctf.parms"%source,ro=True)
dest=db_open_dict("bdb:.#e2ctf.parms")
for k in src.keys():
for k in list(src.keys()):
print(k)
dest[k]=src[k]

# Copy bad particles list
print("Copy bad particles lists")
src=db_open_dict("bdb:%s#select"%source,ro=True)
dest=db_open_dict("bdb:.#select")
for k in src.keys():
for k in list(src.keys()):
print(k)
dest[k]=src[k]

2 changes: 1 addition & 1 deletion examples/mergeproject2.py
Expand Up @@ -70,7 +70,7 @@
if minq>0 :
src2=db_open_dict("bdb:%s#e2ctf.parms"%source,ro=True)
goodkeys=[]
for k in src2.keys():
for k in list(src2.keys()):
if src2[k][3]<minq :
print("%s excluded with quality %d"%(k,src2[k][3]))
srcptcl=[i for i in srcptcl if not k in i]
Expand Down

0 comments on commit 69bd08b

Please sign in to comment.