Commit 10be600a authored by François Kneib's avatar François Kneib Committed by Janek Kozicki

[Python3] Futurize --stage2 with default opts.

parent c7ea3759
from __future__ import print_function
#!${pyExecutable}
# encoding: utf-8
# syntax:python
from __future__ import print_function
from past.builtins import execfile
from builtins import str
import sys,os,os.path,time
try:
import _io
......
from __future__ import print_function
#!${pyExecutable}
# encoding: utf-8
#
# vim: syntax=python
# portions © 2008 Václav Šmilauer <[email protected]>
import os, sys, thread, time, logging, pipes, socket, xmlrpclib, re, shutil, random
from __future__ import print_function
from __future__ import division
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
from past.utils import old_div
import os, sys, _thread, time, logging, pipes, socket, xmlrpc.client, re, shutil, random
# Add search path for yade Python-modules
# It allows to use both Yade-versions (packaged and self-compiled one).
......@@ -33,7 +41,7 @@ executable=os.path.join(prefix,'bin','yade'+suffix)
import yade, yade.utils, yade.config, yade.remote
class JobInfo():
class JobInfo(object):
def __init__(self,num,id,command,hrefCommand,log,nCores,script,table,lineNo,affinity):
self.started,self.finished,self.duration,self.durationSec,self.exitStatus=None,None,None,None,None # duration is a string, durationSec is a number
self.command=command; self.hrefCommand=hrefCommand; self.num=num; self.log=log; self.id=id; self.nCores=nCores; self.cores=set(); self.infoSocket=None
......@@ -73,7 +81,7 @@ finished: %s
for l in open(self.log,'r'):
if not l.startswith('XMLRPC info provider on'): continue
url=l[:-1].split()[4]
self.xmlrpcConn=xmlrpclib.ServerProxy(url,allow_none=True)
self.xmlrpcConn=xmlrpc.client.ServerProxy(url,allow_none=True)
self.hasXmlrpc=True
return True
if not self.hasXmlrpc: return False # catches the case where the magic line is not in the log yet
......@@ -107,8 +115,8 @@ finished: %s
if info:
ret+='<td>'
if info['stopAtIter']>0:
ret+='<nobr>%2.2f%% done</nobr><br/><nobr>step %d/%d</nobr>'%(info['iter']*100./info['stopAtIter'],info['iter'],info['stopAtIter'])
finishTime = str(time.ctime(time.time()+int((round(info['stopAtIter'] - info['iter'])/info['speed']))))
ret+='<nobr>%2.2f%% done</nobr><br/><nobr>step %d/%d</nobr>'%(old_div(info['iter']*100.,info['stopAtIter']),info['iter'],info['stopAtIter'])
finishTime = str(time.ctime(time.time()+int((old_div(round(info['stopAtIter'] - info['iter']),info['speed'])))))
ret+='<br/><font size="1"><nobr>%s finishes</nobr></font><br/>'%finishTime
else: ret+='<nobr>step %d</nobr>'%(info['iter'])
if info['realtime']!=0: ret+='<br/><nobr>speed %g/sec</nobr>'%(info['speed'])
......@@ -164,7 +172,7 @@ def globalHtmlStats():
ret+='<p><b>%d</b> total, <b>%d</b> <span style="background-color:yellow">running</span>, <b>%d</b> <span style="background-color:lime">done</span>%s</p>'%(len(jobs),len([j for j in jobs if j.status=='RUNNING']), len([j for j in jobs if j.status=='DONE']),' (<b>%d <span style="background-color:red"><b>failed</b></span>)'%nFailed if nFailed>0 else '')
return ret
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
from http.server import BaseHTTPRequestHandler,HTTPServer
import socket,re
class HttpStatsServer(BaseHTTPRequestHandler):
favicon=None # binary favicon, created when first requested
......@@ -259,7 +267,7 @@ def runHttpStatsServer():
while port<maxPort:
try:
server=HTTPServer(('',port),HttpStatsServer)
import thread; thread.start_new_thread(server.serve_forever,())
import _thread; _thread.start_new_thread(server.serve_forever,())
print("http://localhost:%d shows batch summary"%port)
break
except socket.error:
......@@ -317,7 +325,7 @@ def runJobs(jobs,numCores):
# only set cores if CPU affinity is desired; otherwise, just numer of cores is used
if j.affinity: j.cores=list(freeCores)[0:j.nCores] # take required number of free cores
# if overloaded, do not assign cores directly
thread.start_new_thread(runJob,(j,))
_thread.start_new_thread(runJob,(j,))
break
time.sleep(.5)
sys.stdout.flush()
......@@ -420,7 +428,7 @@ print("Will run simulation(s) %s using `%s', nice value %d, using max %d cores."
if table:
reader=yade.utils.TableParamReader(table)
params=reader.paramDict()
availableLines=params.keys()
availableLines=list(params.keys())
print("Will use table `%s', with available lines"%(table),', '.join([str(i) for i in availableLines])+'.')
......@@ -429,7 +437,7 @@ if table:
def numRange2List(s):
ret=[]
for l in s.split(','):
if "-" in l: ret+=range(*[int(s) for s in l.split('-')]); ret+=[ret[-1]+1]
if "-" in l: ret+=list(range(*[int(s) for s in l.split('-')])); ret+=[ret[-1]+1]
else: ret+=[int(l)]
return ret
useLines0=numRange2List(lineList)
......@@ -461,7 +469,7 @@ for i,l in enumerate(useLines):
jobExecutable=executable
jobAffinity=opts.affinity
jobCount=opts.timing
for col in params[l].keys():
for col in list(params[l].keys()):
if col[0]!='!': continue
val=params[l][col]
if col=='!OMP_NUM_THREADS' or col=='!THREADS': nCores=int(val)
......@@ -504,7 +512,7 @@ for i,l in enumerate(useLines):
hrefCmd=env+cmd+log
fullCmd=re.sub('(<a href="[^">]+">|</a>)','',hrefCmd)
desc=params[l]['description']
if '!SCRIPT' in params[l].keys(): desc=script+'.'+desc # prepend filename if script is specified explicitly
if '!SCRIPT' in list(params[l].keys()): desc=script+'.'+desc # prepend filename if script is specified explicitly
if opts.timing>0: desc+='[%d]'%j
jobs.append(JobInfo(jobNum,desc,fullCmd,hrefCmd,logFile2,nCores,script=script,table=table,lineNo=l,affinity=jobAffinity))
......@@ -523,7 +531,7 @@ if opts.plotAlwaysUpdateTime>0:
def updateAllPlots():
time.sleep(opts.plotAlwaysUpdateTime)
for job in jobs: job.updatePlots()
thread.start_new_thread(updateAllPlots,())
_thread.start_new_thread(updateAllPlots,())
# OK, go now
if not dryRun: runJobs(jobs,maxJobs)
......@@ -553,15 +561,15 @@ if opts.timing>0:
out=sys.stdout
# write header
out.write('## timing data, written '+time.asctime()+' with arguments\n## '+' '.join(sys.argv)+'\n##\n')
paramNames=params[params.keys()[0]].keys(); paramNames.sort()
paramNames=list(params[list(params.keys())[0]].keys()); paramNames.sort()
out.write('## line\tcount\tavg\tdev\trelDev\tmin\tmax\t|\t'+'\t'.join(paramNames)+'\n')
import math
for i,l in enumerate(useLines):
jobTimes=[j.durationSec for j in jobs if j.lineNo==l and j.durationSec!=None]
tSum=sum(jobTimes); tAvg=tSum/len(jobTimes)
tSum=sum(jobTimes); tAvg=old_div(tSum,len(jobTimes))
tMin,tMax=min(jobTimes),max(jobTimes)
tDev=math.sqrt(sum((t-tAvg)**2 for t in jobTimes)/len(jobTimes))
tRelDev=tDev/tAvg
tDev=math.sqrt(old_div(sum((t-tAvg)**2 for t in jobTimes),len(jobTimes)))
tRelDev=old_div(tDev,tAvg)
out.write('%d\t%d\t%.2f\t%.2f\t%.3g\t%.2f\t%.2f\t|\t'%(l,len(jobTimes),tAvg,tDev,tRelDev,tMin,tMax)+'\t'.join([params[l][p] for p in paramNames])+'\n')
if not gnuplotOut:
......
from __future__ import print_function
#!${pyExecutable}
# encoding: utf-8
#
......@@ -8,7 +7,14 @@ from __future__ import print_function
# This script is to be used with OAR task scheduler. May be an example to use use with other task scheduler for clusters
# Adapted from yade-batch
import os, sys, thread, time, logging, pipes, socket, xmlrpclib, re, shutil, random
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
import os, sys, _thread, time, logging, pipes, socket, xmlrpc.client, re, shutil, random
# Add search path for yade Python-modules
# It allows to use both Yade-versions (packaged and self-compiled one).
......@@ -45,7 +51,7 @@ except ImportError: # argparse not present, print error message
raise RuntimeError("\n\nPlease install 'python-argparse' package.\n")
class JobInfo():
class JobInfo(object):
def __init__(self,num,id,command,log,nCores,script,table,lineNo,affinity,oarprop):
self.started,self.finished,self.duration,self.durationSec,self.exitStatus=None,None,None,None,None # duration is a string, durationSec is a number
self.command=command; self.num=num; self.log=log; self.id=id; self.nCores=nCores; self.cores=set(); self.infoSocket=None
......@@ -127,7 +133,7 @@ print("Will run simulation(s) %s using `%s', nice value %d"%(scripts,executable,
if table:
reader=yade.utils.TableParamReader(table)
params=reader.paramDict()
availableLines=params.keys()
availableLines=list(params.keys())
print("Will use table `%s', with available lines"%(table),', '.join([str(i) for i in availableLines])+'.')
......@@ -136,7 +142,7 @@ if table:
def numRange2List(s):
ret=[]
for l in s.split(','):
if "-" in l: ret+=range(*[int(s) for s in l.split('-')]); ret+=[ret[-1]+1]
if "-" in l: ret+=list(range(*[int(s) for s in l.split('-')])); ret+=[ret[-1]+1]
else: ret+=[int(l)]
return ret
useLines0=numRange2List(lineList)
......@@ -170,7 +176,7 @@ for i,l in enumerate(useLines):
jobCount=opts.timing
walltime = opts.oar_t
oarprops = opts.oar_prop
for col in params[l].keys():
for col in list(params[l].keys()):
if col[0]!='!': continue
val=params[l][col]
if col=='!OMP_NUM_THREADS' or col=='!THREADS': nCores=int(val)
......@@ -203,7 +209,7 @@ for i,l in enumerate(useLines):
if table: env+='%s:%d'%(os.path.abspath(table),l) # keep YADE_BATCH empty (but still defined) if running a single simulation
cmd=' %s%s -j %i -x %s 2>&1'%(jobExecutable,' --nice=%s'%nice if nice!=None else '',nCores,os.path.abspath(script))
desc=params[l]['description']
if '!SCRIPT' in params[l].keys(): desc=script+'.'+desc # prepend filename if script is specified explicitly
if '!SCRIPT' in list(params[l].keys()): desc=script+'.'+desc # prepend filename if script is specified explicitly
if opts.timing>0: desc+='[%d]'%j
jobs.append(JobInfo(jobNum,desc,env+cmd,os.path.abspath('tmp/'+str(os.getpid())+'/'+logFile2),nCores,script=os.path.abspath(script),table=table,lineNo=l,affinity=jobAffinity,oarprop=oarprops))
......
......@@ -18,7 +18,7 @@ def readBib(filename):
if entry is None: break
key,type,dta=entry[0],entry[1],entry[4]
item={'type':type}
for field in dta.keys():
for field in list(dta.keys()):
expanded=bib.expand(bibfile,dta[field],-1)
#conv=bibRecode.recode(rq,expanded[2])
item[field]=expanded[2].strip()
......@@ -27,12 +27,12 @@ def readBib(filename):
return db
def dumpBib(db):
for k in db.keys():
for k in list(db.keys()):
print(k,db[k])
def formatRest(db):
ret=[]
keys=db.keys(); keys.sort()
keys=list(db.keys()); keys.sort()
for key in keys:
i=db[key]; type=i['type']
line=r'.. [%s] \ '%key ## ← HACK: explicit space to prevent docutils from using abbreviated first name (e.g. "F.") as enumeration item; it works!!
......
......@@ -22,6 +22,10 @@
## http://docutils.sourceforge.net/docs/howto/rst-roles.html
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
import sys, os, re
from docutils import nodes
from sphinx import addnodes
......@@ -37,10 +41,10 @@ import docutils
# xrefs: http://groups.google.com/group/sphinx-dev/browse_thread/thread/d719d19307654548
#
#
import __builtin__
if 'latex' in sys.argv: __builtin__.writer='latex'
elif 'html' in sys.argv: __builtin__.writer='html'
elif 'epub' in sys.argv: __builtin__.writer='epub'
import builtins
if 'latex' in sys.argv: builtins.writer='latex'
elif 'html' in sys.argv: builtins.writer='html'
elif 'epub' in sys.argv: builtins.writer='epub'
else: raise RuntimeError("Must have either 'latex' or 'html' on the command line (hack for reference styles)")
sys.path.append(os.path.abspath('./..'))
......@@ -85,11 +89,11 @@ def mkYrefNode(target,text,rawtext,role,explicitText,lineno,options={}):
Other targets are supposed to live in yade.wrapper (such as c++ classes)."""
writer=__builtin__.writer # to make sure not shadowed by a local var
writer=builtins.writer # to make sure not shadowed by a local var
import string
if target.startswith('yade.'):
module='.'.join(target.split('.')[0:2])
module2=(module if module not in moduleMap.keys() else moduleMap[module])
module2=(module if module not in list(moduleMap.keys()) else moduleMap[module])
if target==module: target='' # to reference the module itself
uri=('%%%s#%s'%(module2,target) if writer=='latex' else '%s.html#%s'%(module2,target))
if not explicitText and module!=module2:
......@@ -259,7 +263,7 @@ def boostFuncSignature(name,obj,removeSelf=False):
def fixSignature(app, what, name, obj, options, signature, return_annotation):
#print what,name,obj,signature#,dir(obj)
if what=='attribute':
doc=unicode(obj.__doc__)
doc=str(obj.__doc__)
ret=''
m=re.match('.*:ydefault:`(.*?)`.*',doc)
if m:
......
......@@ -22,6 +22,10 @@
## http://docutils.sourceforge.net/docs/howto/rst-roles.html
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
import sys, os, re
from docutils import nodes
from sphinx import addnodes
......@@ -37,10 +41,10 @@ import docutils
# xrefs: http://groups.google.com/group/sphinx-dev/browse_thread/thread/d719d19307654548
#
#
import __builtin__
if 'latex' in sys.argv: __builtin__.writer='latex'
elif 'html' in sys.argv: __builtin__.writer='html'
elif 'epub' in sys.argv: __builtin__.writer='epub'
import builtins
if 'latex' in sys.argv: builtins.writer='latex'
elif 'html' in sys.argv: builtins.writer='html'
elif 'epub' in sys.argv: builtins.writer='epub'
else: raise RuntimeError("Must have either 'latex' or 'html' on the command line (hack for reference styles)")
sys.path.append(os.path.abspath('./..'))
......@@ -85,11 +89,11 @@ def mkYrefNode(target,text,rawtext,role,explicitText,lineno,options={}):
Other targets are supposed to live in yade.wrapper (such as c++ classes)."""
writer=__builtin__.writer # to make sure not shadowed by a local var
writer=builtins.writer # to make sure not shadowed by a local var
import string
if target.startswith('yade.'):
module='.'.join(target.split('.')[0:2])
module2=(module if module not in moduleMap.keys() else moduleMap[module])
module2=(module if module not in list(moduleMap.keys()) else moduleMap[module])
if target==module: target='' # to reference the module itself
uri=('%%%s#%s'%(module2,target) if writer=='latex' else '%s.html#%s'%(module2,target))
if not explicitText and module!=module2:
......@@ -252,7 +256,7 @@ def boostFuncSignature(name,obj,removeSelf=False):
def fixSignature(app, what, name, obj, options, signature, return_annotation):
#print what,name,obj,signature#,dir(obj)
if what=='attribute':
doc=unicode(obj.__doc__)
doc=str(obj.__doc__)
ret=''
m=re.match('.*:ydefault:`(.*?)`.*',doc)
if m:
......
......@@ -22,6 +22,10 @@
## http://docutils.sourceforge.net/docs/howto/rst-roles.html
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
import sys, os, re
from docutils import nodes
from sphinx import addnodes
......@@ -37,10 +41,10 @@ import docutils
# xrefs: http://groups.google.com/group/sphinx-dev/browse_thread/thread/d719d19307654548
#
#
import __builtin__
if 'latex' in sys.argv: __builtin__.writer='latex'
elif 'html' in sys.argv: __builtin__.writer='html'
elif 'epub' in sys.argv: __builtin__.writer='epub'
import builtins
if 'latex' in sys.argv: builtins.writer='latex'
elif 'html' in sys.argv: builtins.writer='html'
elif 'epub' in sys.argv: builtins.writer='epub'
else: raise RuntimeError("Must have either 'latex' or 'html' on the command line (hack for reference styles)")
sys.path.append(os.path.abspath('./..'))
......@@ -85,11 +89,11 @@ def mkYrefNode(target,text,rawtext,role,explicitText,lineno,options={}):
Other targets are supposed to live in yade.wrapper (such as c++ classes)."""
writer=__builtin__.writer # to make sure not shadowed by a local var
writer=builtins.writer # to make sure not shadowed by a local var
import string
if target.startswith('yade.'):
module='.'.join(target.split('.')[0:2])
module2=(module if module not in moduleMap.keys() else moduleMap[module])
module2=(module if module not in list(moduleMap.keys()) else moduleMap[module])
if target==module: target='' # to reference the module itself
uri=('%%%s#%s'%(module2,target) if writer=='latex' else '%s.html#%s'%(module2,target))
if not explicitText and module!=module2:
......@@ -252,7 +256,7 @@ def boostFuncSignature(name,obj,removeSelf=False):
def fixSignature(app, what, name, obj, options, signature, return_annotation):
#print what,name,obj,signature#,dir(obj)
if what=='attribute':
doc=unicode(obj.__doc__)
doc=str(obj.__doc__)
ret=''
m=re.match('.*:ydefault:`(.*?)`.*',doc)
if m:
......
......@@ -22,6 +22,10 @@
## http://docutils.sourceforge.net/docs/howto/rst-roles.html
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
import sys, os, re
from docutils import nodes
from sphinx import addnodes
......@@ -37,10 +41,10 @@ import docutils
# xrefs: http://groups.google.com/group/sphinx-dev/browse_thread/thread/d719d19307654548
#
#
import __builtin__
if 'latex' in sys.argv: __builtin__.writer='latex'
elif 'html' in sys.argv: __builtin__.writer='html'
elif 'epub' in sys.argv: __builtin__.writer='epub'
import builtins
if 'latex' in sys.argv: builtins.writer='latex'
elif 'html' in sys.argv: builtins.writer='html'
elif 'epub' in sys.argv: builtins.writer='epub'
else: raise RuntimeError("Must have either 'latex' or 'html' on the command line (hack for reference styles)")
sys.path.append(os.path.abspath('./..'))
......@@ -85,11 +89,11 @@ def mkYrefNode(target,text,rawtext,role,explicitText,lineno,options={}):
Other targets are supposed to live in yade.wrapper (such as c++ classes)."""
writer=__builtin__.writer # to make sure not shadowed by a local var
writer=builtins.writer # to make sure not shadowed by a local var
import string
if target.startswith('yade.'):
module='.'.join(target.split('.')[0:2])
module2=(module if module not in moduleMap.keys() else moduleMap[module])
module2=(module if module not in list(moduleMap.keys()) else moduleMap[module])
if target==module: target='' # to reference the module itself
uri=('%%%s#%s'%(module2,target) if writer=='latex' else '%s.html#%s'%(module2,target))
if not explicitText and module!=module2:
......@@ -252,7 +256,7 @@ def boostFuncSignature(name,obj,removeSelf=False):
def fixSignature(app, what, name, obj, options, signature, return_annotation):
#print what,name,obj,signature#,dir(obj)
if what=='attribute':
doc=unicode(obj.__doc__)
doc=str(obj.__doc__)
ret=''
m=re.match('.*:ydefault:`(.*?)`.*',doc)
if m:
......
......@@ -22,6 +22,10 @@
## http://docutils.sourceforge.net/docs/howto/rst-roles.html
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
import sys, os, re
from docutils import nodes
from sphinx import addnodes
......@@ -37,10 +41,10 @@ import docutils
# xrefs: http://groups.google.com/group/sphinx-dev/browse_thread/thread/d719d19307654548
#
#
import __builtin__
if 'latex' in sys.argv: __builtin__.writer='latex'
elif 'html' in sys.argv: __builtin__.writer='html'
elif 'epub' in sys.argv: __builtin__.writer='epub'
import builtins
if 'latex' in sys.argv: builtins.writer='latex'
elif 'html' in sys.argv: builtins.writer='html'
elif 'epub' in sys.argv: builtins.writer='epub'
else: raise RuntimeError("Must have either 'latex' or 'html' on the command line (hack for reference styles)")
......@@ -88,11 +92,11 @@ def mkYrefNode(target,text,rawtext,role,explicitText,lineno,options={}):
Other targets are supposed to live in yade.wrapper (such as c++ classes)."""
writer=__builtin__.writer # to make sure not shadowed by a local var
writer=builtins.writer # to make sure not shadowed by a local var
import string
if target.startswith('yade.'):
module='.'.join(target.split('.')[0:2])
module2=(module if module not in moduleMap.keys() else moduleMap[module])
module2=(module if module not in list(moduleMap.keys()) else moduleMap[module])
if target==module: target='' # to reference the module itself
uri=('%%%s#%s'%(module2,target) if writer=='latex' else '%s.html#%s'%(module2,target))
if not explicitText and module!=module2:
......@@ -257,7 +261,7 @@ def boostFuncSignature(name,obj,removeSelf=False):
def fixSignature(app, what, name, obj, options, signature, return_annotation):
#print what,name,obj,signature#,dir(obj)
if what=='attribute':
doc=unicode(obj.__doc__)
doc=str(obj.__doc__)
ret=''
m=re.match('.*:ydefault:`(.*?)`.*',doc)
if m:
......
......@@ -58,7 +58,12 @@ from __future__ import print_function
#-----------------------------------------------------------------------------
# Stdlib
import cStringIO
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
import io
import imp
import os
import re
......@@ -93,7 +98,7 @@ sphinx_version = sphinx.__version__.split(".")
sphinx_version = tuple([int(re.split('[a-z]', x)[0])
for x in sphinx_version[:2]])
COMMENT, INPUT, OUTPUT = range(3)
COMMENT, INPUT, OUTPUT = list(range(3))
rc_override = {}
rgxin = re.compile('In \[(\d+)\]:\s?(.*)\s*')
rgxcont = re.compile(' \.+:\s?(.*)\s*')
......@@ -206,7 +211,7 @@ class EmbeddedSphinxShell(object):
def __init__(self):
self.cout = cStringIO.StringIO()
self.cout = io.StringIO()
IPython.Shell.Term.cout = self.cout
IPython.Shell.Term.cerr = self.cout
......
......@@ -58,7 +58,12 @@ from __future__ import print_function
#-----------------------------------------------------------------------------
# Stdlib
import cStringIO
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
import io
import os
import re
import sys
......@@ -93,7 +98,7 @@ from IPython.utils import io
# Globals
#-----------------------------------------------------------------------------
# for tokenizing blocks
COMMENT, INPUT, OUTPUT = range(3)
COMMENT, INPUT, OUTPUT = list(range(3))
#-----------------------------------------------------------------------------
# Functions and class declarations
......@@ -197,7 +202,7 @@ class EmbeddedSphinxShell(object):
def __init__(self):
self.cout = cStringIO.StringIO()
self.cout = io.StringIO()
# Create config object for IPython
......
......@@ -59,7 +59,12 @@ from __future__ import print_function
#-----------------------------------------------------------------------------
# Stdlib
import cStringIO
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
import io
import os
import re
import sys
......@@ -93,7 +98,7 @@ from IPython.utils import io
# Globals
#-----------------------------------------------------------------------------
# for tokenizing blocks
COMMENT, INPUT, OUTPUT = range(3)
COMMENT, INPUT, OUTPUT = list(range(3))
#-----------------------------------------------------------------------------
# Functions and class declarations
......@@ -197,7 +202,7 @@ class EmbeddedSphinxShell(object):
def __init__(self):
self.cout = cStringIO.StringIO()
self.cout = io.StringIO()
# Create config object for IPython
......
......@@ -126,6 +126,11 @@ from __future__ import print_function
#-----------------------------------------------------------------------------
# Stdlib
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from builtins import object
import os
import re
import sys
......@@ -157,13 +162,13 @@ from IPython.utils.py3compat import PY3
if PY3:
from io import StringIO
else:
from StringIO import StringIO
from io import StringIO
#-----------------------------------------------------------------------------
# Globals
#-----------------------------------------------------------------------------
# for tokenizing blocks
COMMENT, INPUT, OUTPUT = range(3)
COMMENT, INPUT, OUTPUT = list(range(3))
#-----------------------------------------------------------------------------
# Functions and class declarations
......
......@@ -126,6 +126,11 @@ from __future__ import print_function
#-----------------------------------------------------------------------------
# Stdlib