Date: Fri, 25 Mar 2022 13:50:47 GMT From: Po-Chuan Hsieh <sunpoet@FreeBSD.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org Subject: git: 218115b6aab5 - main - science/py-paida: Fix build with setuptools 58.0.0+ Message-ID: <202203251350.22PDolOS037412@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by sunpoet: URL: https://cgit.FreeBSD.org/ports/commit/?id=218115b6aab538b4bbfa7333f5a72db52338170d commit 218115b6aab538b4bbfa7333f5a72db52338170d Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org> AuthorDate: 2022-03-25 13:33:35 +0000 Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org> CommitDate: 2022-03-25 13:38:19 +0000 science/py-paida: Fix build with setuptools 58.0.0+ With hat: python --- science/py-paida/Makefile | 2 +- science/py-paida/files/patch-2to3 | 2038 +++++++++++++++++++++++++++++++++++++ 2 files changed, 2039 insertions(+), 1 deletion(-) diff --git a/science/py-paida/Makefile b/science/py-paida/Makefile index 486a046b5734..c1c3a1ed2af4 100644 --- a/science/py-paida/Makefile +++ b/science/py-paida/Makefile @@ -13,7 +13,7 @@ BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}tkinter>0:x11-toolkits/py-tkinter@${PY_FLA MAINTAINER= ports@FreeBSD.org COMMENT= Pure Python scientific analysis package -USES= python:3.6+ +USES= dos2unix python:3.6+ USE_PYTHON= distutils autoplist .include <bsd.port.mk> diff --git a/science/py-paida/files/patch-2to3 b/science/py-paida/files/patch-2to3 new file mode 100644 index 000000000000..8d31edcad6f1 --- /dev/null +++ b/science/py-paida/files/patch-2to3 @@ -0,0 +1,2038 @@ +--- paida/math/array/matrix.py.orig 2022-03-18 21:34:04 UTC ++++ paida/math/array/matrix.py +@@ -12,8 +12,8 @@ class matrix: + if hasattr(data, '__iter__'): + if not hasattr(data[0], '__iter__'): + data = [data] +- self._indicesR = range(len(data)) +- self._indicesC = range(len(data[0])) ++ self._indicesR = list(range(len(data))) ++ self._indicesC = list(range(len(data[0]))) + self.data = copy.deepcopy(data) + + def _createCopyLinked(self, indicesR, indicesC): +@@ -35,7 +35,7 @@ class matrix: + return matrix(data = result) + + def _format(self, data): +- return `data` ++ return repr(data) + + def __str__(self): + if len(self._indicesR) == 1: +@@ -574,7 +574,7 @@ class matrix: + V, H, ort = self._orthes(V, H, ort) + d, e, V, H = self._hqr2(d, e, V, H) + +- eigenvalues = zip(d, e) ++ eigenvalues = list(zip(d, e)) + eigenvectors = [] + for j in range(n): + eigenvector = [] +--- paida/math/optimize/pyoptimize.py.orig 2022-03-18 21:34:04 UTC ++++ paida/math/optimize/pyoptimize.py +@@ -55,7 +55,7 @@ def _constraint(evaluatorParameterSpace, constraints): + for constraint in constraints: + ### Jython2.1 doesn't understand exec(code, globals(), locals()) properly. + #eval(constraint, _normalNameSpace, evaluatorParameterSpace) +- exec constraint in _normalNameSpace, evaluatorParameterSpace ++ exec(constraint, _normalNameSpace, evaluatorParameterSpace) + + def copyEvaluatorParameterSpace(evaluatorParameterSpace): + newEvaluatorParameterSpace = evaluatorParameterSpace.copy() +@@ -261,7 +261,7 @@ def fmin_ncg(evaluatorValue, evaluatorGradient, evalua + break + + ### Compute a search direction by applying the CG method. +- gradient = map(evaluatorGradient, [evaluatorParameterSpace] * nFreeParameters, freeIndices) ++ gradient = list(map(evaluatorGradient, [evaluatorParameterSpace] * nFreeParameters, freeIndices)) + maggrad = 0.0 + psupi = [] + dri0 = 0.0 +@@ -364,16 +364,16 @@ def fmin_ncg(evaluatorValue, evaluatorGradient, evalua + warnflag = 1 + mesg = "Maximum number of iterations has been exceeded." + if display: +- print mesg +- print "\tCurrent function value: %f" % fval +- print "\tIterations: %d" % nIterations ++ print(mesg) ++ print("\tCurrent function value: %f" % fval) ++ print("\tIterations: %d" % nIterations) + else: + warnflag = 0 + mesg = "Optimization terminated successfully." + if display: +- print mesg +- print "\tCurrent function value: %f" % fval +- print "\tIterations: %d" % nIterations ++ print(mesg) ++ print("\tCurrent function value: %f" % fval) ++ print("\tIterations: %d" % nIterations) + + return fval, hessian, warnflag, mesg + +@@ -492,7 +492,7 @@ def geneticAlgorithm(evaluatorValue, evaluatorGradient + island2.terminate() + fval, hessian, warnflag, mesg = result + if display: +- print mesg ++ print(mesg) + threadEvaluatorParameterSpace = island.getEvaluatorParameterSpace() + _i2o(threadEvaluatorParameterSpace, limits, freeIndices, freeParameterNames) + updateEvaluatorParameterSpace(threadEvaluatorParameterSpace, evaluatorParameterSpace) +@@ -514,7 +514,7 @@ def geneticAlgorithm(evaluatorValue, evaluatorGradient + warnflag = 1 + mesg = "Maximum number of iterations has been exceeded." + if display: +- print mesg ++ print(mesg) + threadEvaluatorParameterSpace = island.getEvaluatorParameterSpace() + _i2o(threadEvaluatorParameterSpace, limits, freeIndices, freeParameterNames) + updateEvaluatorParameterSpace(threadEvaluatorParameterSpace, evaluatorParameterSpace) +@@ -782,8 +782,8 @@ class _Island(threading.Thread): + islanders[migratorIndex] = migrators[i] + + if display: +- print self, generation +- print best, evaluationMinimum / ndf ++ print(self, generation) ++ print(best, evaluationMinimum / ndf) + + condition = migrationService.getCondition() + condition.acquire() +--- paida/math/pylapack/ilaenv.py.orig 2022-03-18 21:34:04 UTC ++++ paida/math/pylapack/ilaenv.py +@@ -211,7 +211,7 @@ def ilaenv(ispec, name, opts, n1, n2, n3, n4): + c3 = subnam[3:6] + c4 = c3[1:3] + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 3: + subnam = name.upper() +@@ -224,39 +224,39 @@ def ilaenv(ispec, name, opts, n1, n2, n3, n4): + c3 = subnam[3:6] + c4 = c3[1:3] + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 4: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 5: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 6: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 7: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 8: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 9: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 10: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + elif ispec == 11: + error = 'ilaenv(ispec = %d) is not implemented yet.' % ispec +- print error ++ print(error) + raise error + else: + return -1 +--- paida/math/pylapack/pyblas/xerbla.py.orig 2022-03-18 21:34:04 UTC ++++ paida/math/pylapack/pyblas/xerbla.py +@@ -31,5 +31,5 @@ def xerbla(srname, info): + The position of the invalid parameter in the parameter list of the calling routine. + """ + +- print ' ** On entry to %s parameter number %d had an illegal value' % (srname, info[0]) ++ print(' ** On entry to %s parameter number %d had an illegal value' % (srname, info[0])) + raise stop() +--- paida/paida_core/IBaseStyle.py.orig 2022-03-18 21:34:04 UTC ++++ paida/paida_core/IBaseStyle.py +@@ -6,7 +6,7 @@ import types + class _convertException: + def __init__(self, message=None): + if message != None: +- print message ++ print(message) + + class baseParameter: + def __init__(self, default): +@@ -39,11 +39,11 @@ class listParameter(baseParameter): + baseParameter.__init__(self, default) + + def convert(self, dataString): +- if isinstance(dataString, types.StringTypes): ++ if isinstance(dataString, (str,)): + return list(eval(dataString)) +- elif isinstance(dataString, types.ListType): ++ elif isinstance(dataString, list): + return dataString +- elif isinstance(dataString, types.TupleType): ++ elif isinstance(dataString, tuple): + return list(dataString) + else: + raise _convertException('The parameter was not converted to list type.') +@@ -216,7 +216,7 @@ class IBaseStyle: + return self._parameters[parameterName] + + def availableParameters(self): +- names = self._parameters.keys() ++ names = list(self._parameters.keys()) + names.sort() + return names + +@@ -262,5 +262,5 @@ class IBaseStyle: + + + import paida.paida_gui.PRoot +-if not locals().has_key('fontList'): ++if 'fontList' not in locals(): + fontList, defaultFont = paida.paida_gui.PRoot.getFontList(['Courier', 'courier']) +--- paida/paida_core/IFilter.py.orig 2022-03-18 21:34:04 UTC ++++ paida/paida_core/IFilter.py +@@ -28,7 +28,7 @@ class IFilter: + return bool(eval(self._code, self._globals, {'_row': self._tupleRows[self._tupleObject._rowIndex]})) + else: + if self._count >= self._rowsToProcess: +- raise IndexError, "Reached to the specified rowsToProcess." ++ raise IndexError("Reached to the specified rowsToProcess.") + else: + self._count += 1 + return bool(eval(self._code, self._globals, {'_row': self._tupleRows[self._tupleObject._rowIndex]})) +--- paida/paida_core/IFitter.py.orig 2022-03-18 21:34:04 UTC ++++ paida/paida_core/IFitter.py +@@ -83,12 +83,12 @@ class IFitter: + return self._fitMethod + + def fitParameterSettings(self, name): +- if not self._fitParameterSettings.has_key(name): ++ if name not in self._fitParameterSettings: + self._fitParameterSettings[name] = IFitParameterSettings(name) + return self._fitParameterSettings[name] + + def listParameterSettings(self): +- return self._fitParameterSettings.keys() ++ return list(self._fitParameterSettings.keys()) + + def resetParameterSettings(self): + self._fitParameterSettings = {} +@@ -139,13 +139,13 @@ class IFitter: + self._checkFitType(fitData) + _function = data2 + guessed = False +- elif isinstance(data1, IFitData) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, IFitData) and isinstance(data2, (str,)) and (data3 == None): + fitData = data1 + self._checkFitType(fitData) + _functionFactory = IFunctionFactory(None) + _function = _functionFactory.createFunctionByName(data2, data2, inner = True) + guessed = False +- elif isinstance(data1, IFitData) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, IFitData) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = data1 + self._checkFitType(fitData) + _functionFactory = IFunctionFactory(None) +@@ -186,84 +186,84 @@ class IFitter: + fitData.create3DConnection(data1) + return self.fit(fitData, data2) + +- elif isinstance(data1, IHistogram1D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, IHistogram1D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create1DConnection(data1) + return self.fit(fitData, data2) +- elif isinstance(data1, IProfile1D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, IProfile1D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create1DConnection(data1) + return self.fit(fitData, data2) +- elif isinstance(data1, ICloud1D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, ICloud1D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create1DConnection(data1) + return self.fit(fitData, data2) +- elif isinstance(data1, IHistogram2D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, IHistogram2D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create2DConnection(data1) + return self.fit(fitData, data2) +- elif isinstance(data1, IProfile2D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, IProfile2D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create2DConnection(data1) + return self.fit(fitData, data2) +- elif isinstance(data1, ICloud2D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, ICloud2D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create2DConnection(data1) + return self.fit(fitData, data2) +- elif isinstance(data1, IHistogram3D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, IHistogram3D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create3DConnection(data1) + return self.fit(fitData, data2) +- elif isinstance(data1, ICloud3D) and isinstance(data2, types.StringTypes) and (data3 == None): ++ elif isinstance(data1, ICloud3D) and isinstance(data2, (str,)) and (data3 == None): + fitData = IFitData() + fitData.create3DConnection(data1) + return self.fit(fitData, data2) + +- elif isinstance(data1, IHistogram1D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, IHistogram1D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create1DConnection(data1) + return self.fit(fitData, data2, data3) +- elif isinstance(data1, IProfile1D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, IProfile1D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create1DConnection(data1) + return self.fit(fitData, data2, data3) +- elif isinstance(data1, ICloud1D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, ICloud1D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create1DConnection(data1) + return self.fit(fitData, data2, data3) +- elif isinstance(data1, IHistogram2D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, IHistogram2D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create2DConnection(data1) + return self.fit(fitData, data2, data3) +- elif isinstance(data1, IProfile2D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, IProfile2D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create2DConnection(data1) + return self.fit(fitData, data2, data3) +- elif isinstance(data1, ICloud2D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, ICloud2D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create2DConnection(data1) + return self.fit(fitData, data2, data3) +- elif isinstance(data1, IHistogram3D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, IHistogram3D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create3DConnection(data1) + return self.fit(fitData, data2, data3) +- elif isinstance(data1, ICloud3D) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): ++ elif isinstance(data1, ICloud3D) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): + fitData = IFitData() + fitData.create3DConnection(data1) + return self.fit(fitData, data2, data3) + + elif isinstance(data1, IDataPointSet) and isinstance(data2, IFunction) and (data3 == None): +- indices = range(data1.dimension()) ++ indices = list(range(data1.dimension())) + fitData = IFitData() + fitData.createConnection(data1, indices[:-1], indices[-1]) + return self.fit(fitData, data2) +- elif isinstance(data1, IDataPointSet) and isinstance(data2, types.StringTypes) and (data3 == None): +- indices = range(data1.dimension()) ++ elif isinstance(data1, IDataPointSet) and isinstance(data2, (str,)) and (data3 == None): ++ indices = list(range(data1.dimension())) + fitData = IFitData() + fitData.createConnection(data1, indices[:-1], indices[-1]) + return self.fit(fitData, data2) +- elif isinstance(data1, IDataPointSet) and isinstance(data2, types.StringTypes) and hasattr(data3, '__iter__'): +- indices = range(data1.dimension()) ++ elif isinstance(data1, IDataPointSet) and isinstance(data2, (str,)) and hasattr(data3, '__iter__'): ++ indices = list(range(data1.dimension())) + fitData = IFitData() + fitData.createConnection(data1, indices[:-1], indices[-1]) + return self.fit(fitData, data2, data3) +@@ -362,7 +362,7 @@ class IFitter: + raise RuntimeError() + + ### Verbose mode? +- if self._option.has_key('verbose'): ++ if 'verbose' in self._option: + if self._option['verbose'] == True: + verbose = True + else: +@@ -376,7 +376,7 @@ class IFitter: + elif engineName in ['SimpleGA', 'GA']: + minimum, hessian, warnflag, mesg = geneticAlgorithm(evaluatorValue, evaluatorGradient, evaluatorHessian, evaluatorParameterSpace, freeParameterNames, limits, constraints, freeIndices, fixedIndices, ndf, display = verbose) + else: +- raise RuntimeError, 'Unknown engine name:', engineName ++ raise RuntimeError('Unknown engine name:').with_traceback(engineName) + resultValues = _function.parameters() + + ### Is valid? +@@ -540,7 +540,7 @@ class IFitter: + for parameterIndex, parameterName in enumerate(function.parameterNames()): + parameterValue = function.parameter(parameterName) + ### This parameter has any setting? +- if fitParameterSettings.has_key(parameterName): ++ if parameterName in fitParameterSettings: + setting = fitParameterSettings[parameterName] + ### This parameter is fixed or bound? + if setting.isFixed(): +--- paida/paida_core/IFunction.py.orig 2022-03-18 21:34:04 UTC ++++ paida/paida_core/IFunction.py +@@ -89,7 +89,7 @@ class IFunction: + codeletList.append(expression) + codeletList.append('catalog') + else: +- raise ValueError, 'Unknown typeName "%s".' % typeName ++ raise ValueError('Unknown typeName "%s".' % typeName) + self._codeletString = ':'.join(codeletList) + + def _getParentFactory(self): +@@ -146,12 +146,12 @@ class IFunction: + for constraint in constraints: + ### Jython2.1 doesn't understand exec(code, globals(), locals()) properly. + #eval(constraint, _normalNameSpace, parameterNameSpace) +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fp = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + parameterNameSpace.update(currents) + parameterNameSpace[parameterName] -= eps2 + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fm = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + result = (fp - fm) / 2.0 / eps2 + parameterNameSpace.update(currents) +@@ -205,42 +205,42 @@ class IFunction: + + if parameterIndex1 == parameterIndex2: + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fc = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + parameterNameSpace.update(currents) + parameterNameSpace[parameterName1] += eps + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fp = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + parameterNameSpace.update(currents) + parameterNameSpace[parameterName1] -= eps + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fm = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + result = (fp + fm - 2.0 * fc) / eps**2 + else: + parameterNameSpace[parameterName1] += eps + parameterNameSpace[parameterName2] += eps + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fpp = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + parameterNameSpace.update(currents) + parameterNameSpace[parameterName1] -= eps + parameterNameSpace[parameterName2] -= eps + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fmm = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + parameterNameSpace.update(currents) + parameterNameSpace[parameterName1] += eps + parameterNameSpace[parameterName2] -= eps + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fpm = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + parameterNameSpace.update(currents) + parameterNameSpace[parameterName1] -= eps + parameterNameSpace[parameterName2] += eps + for constraint in constraints: +- exec constraint in innerNameSpace, parameterNameSpace ++ exec(constraint, innerNameSpace, parameterNameSpace) + fmp = eval(compiledDeriv0, innerNameSpace, parameterNameSpace) + result = (fpp + fmm - fpm - fmp) / eps**2 / 4.0 + +--- paida/paida_core/IFunctionFactory.py.orig 2022-03-18 21:34:04 UTC ++++ paida/paida_core/IFunctionFactory.py +@@ -311,7 +311,7 @@ class IFunctionFactory: + + def _log(self, data): + if data._0 in self._zeros: +- raise ValueError, 'Called log(0.0).' ++ raise ValueError('Called log(0.0).') + elif data._1 in self._zeros: + _0 = 'log(%s)' % (data._0) + _1 = '0.0' +@@ -424,7 +424,7 @@ class IFunctionFactory: + evalNameSpace = {} + eval2NameSpace = {} + evalExpression = '' +- functionNameList = innerNameSpace.keys() ++ functionNameList = list(innerNameSpace.keys()) + try: + while 1: + item = parser.get_token() +@@ -515,7 +515,7 @@ class IFunctionFactory: + parser = _Shlex(expression) + evalNameSpace = {} + evalExpression = '' +- functionNameList = innerNameSpace.keys() ++ functionNameList = list(innerNameSpace.keys()) + try: + while 1: + item = parser.get_token() +@@ -561,28 +561,28 @@ class IFunctionFactory: + if item in functionNameList: + item2 = parser.get_token() + if item2 != '.': +- raise RuntimeError, 'Expected "." but "%s".' % (item2) ++ raise RuntimeError('Expected "." but "%s".' % (item2)) + item2 = parser.get_token() + if item2 != '_getDeriv1': +- raise RuntimeError, 'Expected "_getDeriv1" but "%s".' % (item2) ++ raise RuntimeError('Expected "_getDeriv1" but "%s".' % (item2)) + item2 = parser.get_token() + if item2 != '(': +- raise RuntimeError, 'Expected "(" but "%s".' % (item2) ++ raise RuntimeError('Expected "(" but "%s".' % (item2)) + item2 = parser.get_token() + if item2 != '_parameterNameSpace_': +- raise RuntimeError, 'Expected "_parameterNameSpace_" but "%s".' % (item2) ++ raise RuntimeError('Expected "_parameterNameSpace_" but "%s".' % (item2)) + item2 = parser.get_token() + if item2 != ',': +- raise RuntimeError, 'Expected "," but "%s".' % (item2) ++ raise RuntimeError('Expected "," but "%s".' % (item2)) + item2 = parser.get_token() + if item2 != ' ': +- raise RuntimeError, 'Expected " " but "%s".' % (item2) ++ raise RuntimeError('Expected " " but "%s".' % (item2)) + + deriv1Index = int(parser.get_token()) + + item2 = parser.get_token() + if item2 != ')': +- raise RuntimeError, 'Expected ")" but "%s".' % (item2) ++ raise RuntimeError('Expected ")" but "%s".' % (item2)) + + innerFunction = innerNameSpace[item] + if innerFunction._deriv1 == None: +@@ -624,7 +624,7 @@ class IFunctionFactory: + def createFunctionByName(self, path, expression, parameterNamePrefix = None, inner = False): + parameterNames, dimension = self._getParameterNamesByName(expression) + if parameterNames == None: +- raise ValueError, 'The expression contains unknown function name.' ++ raise ValueError('The expression contains unknown function name.') + newParameterNames = [] + for parameterName in parameterNames: + if parameterNamePrefix == None: +@@ -655,7 +655,7 @@ class IFunctionFactory: + if inner == False: + if self._catalog.add(name, newFunction) == False: + ### Catalogging failed. +- raise RuntimeError, 'Catalogging "%s" function failed.' % name ++ raise RuntimeError('Catalogging "%s" function failed.' % name) + self._tree._mkObject(path, newFunction) + return newFunction + +@@ -705,7 +705,7 @@ class IFunctionFactory: + if inner == False: + if self._catalog.add(name, newFunction) == False: + ### Catalogging failed. +- raise RuntimeError, 'Catalogging "%s" function failed.' % name ++ raise RuntimeError('Catalogging "%s" function failed.' % name) + self._tree._mkObject(path, newFunction) + return newFunction + +--- paida/paida_core/IPlotter.py.orig 2022-03-18 21:34:04 UTC ++++ paida/paida_core/IPlotter.py +@@ -61,7 +61,7 @@ class IPlotter: + return self._parameters[parameterName] + + def availableParameters(self): +- names = self._parameters.keys() ++ names = list(self._parameters.keys()) + names.sort() + return names + +@@ -222,22 +222,22 @@ class IPlotter: + y = self._tabY + w = 1.0 - 2 * x + h = 1.0 - 2 * y +- elif (type(x) == types.FloatType) and (y == None) and (w == None) and (h == None): ++ elif (type(x) == float) and (y == None) and (w == None) and (h == None): + x = float(x) + y = self._tabY + w = 1.0 - x - self._tabX + h = 1.0 - 2 * y +- elif (type(x) == types.FloatType) and (type(y) == types.FloatType) and (w == None) and (h == None): ++ elif (type(x) == float) and (type(y) == float) and (w == None) and (h == None): + x = float(x) + y = float(y) + w = 1.0 - x - self._tabX + h = 1.0 - y - self._tabY +- elif (type(x) == types.FloatType) and (type(y) == types.FloatType) and (type(w) == types.FloatType) and (h == None): ++ elif (type(x) == float) and (type(y) == float) and (type(w) == float) and (h == None): + x = float(x) + y = float(y) + w = float(w) + h = 1.0 - y - self._tabY +- elif (type(x) == types.FloatType) and (type(y) == types.FloatType) and (type(w) == types.FloatType) and (type(h) == types.FloatType): ++ elif (type(x) == float) and (type(y) == float) and (type(w) == float) and (type(h) == float): + x = float(x) + y = float(y) + w = float(w) +@@ -258,12 +258,12 @@ class IPlotter: + columns = 1 + rows = 1 + index = 0 +- elif (type(columns) == types.IntType) and (rows == None) and (index == None): ++ elif (type(columns) == int) and (rows == None) and (index == None): + rows = 1 + index = 0 +- elif (type(columns) == types.IntType) and (type(rows) == types.IntType) and (index == None): ++ elif (type(columns) == int) and (type(rows) == int) and (index == None): + index = 0 +- elif (type(columns) == types.IntType) and (type(rows) == types.IntType) and (type(index) == types.IntType): ++ elif (type(columns) == int) and (type(rows) == int) and (type(index) == int): + pass + else: + raise IllegalArgumentException() +@@ -294,7 +294,7 @@ class IPlotter: + else: + raise IllegalArgumentException() + +- def next(self): ++ def __next__(self): + self.setCurrentRegionNumber((self.currentRegionNumber() + 1) % self.numberOfRegions()) + return self.currentRegion() + +@@ -389,7 +389,7 @@ class IPlotter: + self._getGuiPlotter().setImageWrite(fileName, self._parameterData('landscape'), fileType) + + else: +- raise RuntimeError, 'Unknown GUI engine name "%s".' % engineName ++ raise RuntimeError('Unknown GUI engine name "%s".' % engineName) + + def _postScriptCreate(self, fileName): + ### Get postscript strings. +@@ -467,7 +467,7 @@ class IPlotter: + self._getGuiPlotter().setTitle(title) + + def setTitle(self, title): +- if type(title) in types.StringTypes: ++ if type(title) in (str,): + self._setWindowTitle(title) + tags = ['globalTitle'] + guiPlotter = self._getGuiPlotter() +--- paida/paida_core/IPlotterRegion.py.orig 2022-03-18 21:34:04 UTC ++++ paida/paida_core/IPlotterRegion.py +@@ -592,10 +592,10 @@ class IPlotterRegion: + elif (isinstance(data1, IHistogram1D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, IHistogram1D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, IHistogram1D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, IHistogram1D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, IHistogram1D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -605,10 +605,10 @@ class IPlotterRegion: + elif (isinstance(data1, IHistogram2D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, IHistogram2D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, IHistogram2D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, IHistogram2D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, IHistogram2D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -618,10 +618,10 @@ class IPlotterRegion: + elif (isinstance(data1, IHistogram3D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, IHistogram3D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, IHistogram3D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, IHistogram3D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, IHistogram3D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -631,10 +631,10 @@ class IPlotterRegion: + elif (isinstance(data1, ICloud1D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, ICloud1D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, ICloud1D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, ICloud1D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, ICloud1D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -644,10 +644,10 @@ class IPlotterRegion: + elif (isinstance(data1, ICloud2D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, ICloud2D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, ICloud2D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, ICloud2D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, ICloud2D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -657,10 +657,10 @@ class IPlotterRegion: + elif (isinstance(data1, ICloud3D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, ICloud3D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, ICloud3D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, ICloud3D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, ICloud3D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -670,10 +670,10 @@ class IPlotterRegion: + elif (isinstance(data1, IProfile1D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, IProfile1D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, IProfile1D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, IProfile1D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, IProfile1D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -683,10 +683,10 @@ class IPlotterRegion: + elif (isinstance(data1, IProfile2D)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, IProfile2D)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, IProfile2D)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, IProfile2D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, IProfile2D)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -696,10 +696,10 @@ class IPlotterRegion: + elif (isinstance(data1, IFunction)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, IFunction)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, IFunction)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, IFunction)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, IFunction)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -709,10 +709,10 @@ class IPlotterRegion: + elif (isinstance(data1, IDataPointSet)) and (isinstance(data2, IPlotterStyle)) and (data3 == None): + plotterStyle = data2 + options = optionAnalyzer(None) +- elif (isinstance(data1, IDataPointSet)) and (type(data2) in types.StringTypes) and (data3 == None): ++ elif (isinstance(data1, IDataPointSet)) and (type(data2) in (str,)) and (data3 == None): + plotterStyle = self.style() + options = optionAnalyzer(data2) +- elif (isinstance(data1, IDataPointSet)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in types.StringTypes): ++ elif (isinstance(data1, IDataPointSet)) and (isinstance(data2, IPlotterStyle)) and (type(data3) in (str,)): + plotterStyle = data2 + options = optionAnalyzer(data3) + +@@ -816,7 +816,7 @@ class IPlotterRegion: + return False + + def _needReplace(self, options): +- if options.has_key('mode'): ++ if 'mode' in options: + if options['mode'] == 'replace': + return True + elif options['mode'] == 'overlay': +@@ -830,7 +830,7 @@ class IPlotterRegion: + def _needRescale(self, options): + if self._needReplace(options): + return False +- elif options.has_key('rescale'): ++ elif 'rescale' in options: + if options['rescale'] == True: + if self._getNItemData() == 1: + return False +@@ -868,63 +868,63 @@ class IPlotterRegion: + def _getOrderedBins2D(self, axisX, axisY, surfaceYZz, surfaceZXz): + if surfaceYZz < 0.0 and surfaceZXz < 0.0: + #0 +- binsX = range(axisX.bins() - 1, -1, -1) +- binsY = range(axisY.bins() - 1, -1, -1) ++ binsX = list(range(axisX.bins() - 1, -1, -1)) ++ binsY = list(range(axisY.bins() - 1, -1, -1)) + elif surfaceYZz < 0.0 and surfaceZXz >= 0.0: + #3 +- binsX = range(axisX.bins() - 1, -1, -1) +- binsY = range(axisY.bins()) ++ binsX = list(range(axisX.bins() - 1, -1, -1)) ++ binsY = list(range(axisY.bins())) + elif surfaceYZz >= 0.0 and surfaceZXz < 0.0: + #1 +- binsX = range(axisX.bins()) +- binsY = range(axisY.bins() - 1, -1, -1) ++ binsX = list(range(axisX.bins())) ++ binsY = list(range(axisY.bins() - 1, -1, -1)) + elif surfaceYZz >= 0.0 and surfaceZXz >= 0.0: + #2 +- binsX = range(axisX.bins()) +- binsY = range(axisY.bins()) ++ binsX = list(range(axisX.bins())) ++ binsY = list(range(axisY.bins())) + return binsX, binsY + + def _getOrderedBins3D(self, axisX, axisY, axisZ, surfaceXYz, surfaceYZz, surfaceZXz): + if surfaceXYz < 0.0 and surfaceYZz < 0.0 and surfaceZXz < 0.0: + #0 +- binsX = range(axisX.bins() - 1, -1, -1) +- binsY = range(axisY.bins() - 1, -1, -1) +- binsZ = range(axisZ.bins() - 1, -1, -1) ++ binsX = list(range(axisX.bins() - 1, -1, -1)) ++ binsY = list(range(axisY.bins() - 1, -1, -1)) ++ binsZ = list(range(axisZ.bins() - 1, -1, -1)) + elif surfaceXYz < 0.0 and surfaceYZz < 0.0 and surfaceZXz >= 0.0: + #3 +- binsX = range(axisX.bins() - 1, -1, -1) +- binsY = range(axisY.bins()) +- binsZ = range(axisZ.bins() - 1, -1, -1) ++ binsX = list(range(axisX.bins() - 1, -1, -1)) ++ binsY = list(range(axisY.bins())) ++ binsZ = list(range(axisZ.bins() - 1, -1, -1)) + elif surfaceXYz < 0.0 and surfaceYZz >= 0.0 and surfaceZXz < 0.0: + #1 +- binsX = range(axisX.bins()) +- binsY = range(axisY.bins() - 1, -1, -1) +- binsZ = range(axisZ.bins() - 1, -1, -1) ++ binsX = list(range(axisX.bins())) ++ binsY = list(range(axisY.bins() - 1, -1, -1)) ++ binsZ = list(range(axisZ.bins() - 1, -1, -1)) + elif surfaceXYz < 0.0 and surfaceYZz >= 0.0 and surfaceZXz >= 0.0: + #2 +- binsX = range(axisX.bins()) +- binsY = range(axisY.bins()) +- binsZ = range(axisZ.bins() - 1, -1, -1) ++ binsX = list(range(axisX.bins())) ++ binsY = list(range(axisY.bins())) ++ binsZ = list(range(axisZ.bins() - 1, -1, -1)) + elif surfaceXYz >= 0.0 and surfaceYZz < 0.0 and surfaceZXz < 0.0: + #4 +- binsX = range(axisX.bins() - 1, -1, -1) +- binsY = range(axisY.bins() - 1, -1, -1) +- binsZ = range(axisZ.bins()) ++ binsX = list(range(axisX.bins() - 1, -1, -1)) ++ binsY = list(range(axisY.bins() - 1, -1, -1)) ++ binsZ = list(range(axisZ.bins())) + elif surfaceXYz >= 0.0 and surfaceYZz < 0.0 and surfaceZXz >= 0.0: + #7 +- binsX = range(axisX.bins() - 1, -1, -1) +- binsY = range(axisY.bins()) +- binsZ = range(axisZ.bins()) ++ binsX = list(range(axisX.bins() - 1, -1, -1)) ++ binsY = list(range(axisY.bins())) ++ binsZ = list(range(axisZ.bins())) + elif surfaceXYz >= 0.0 and surfaceYZz >= 0.0 and surfaceZXz < 0.0: + #5 +- binsX = range(axisX.bins()) +- binsY = range(axisY.bins() - 1, -1, -1) +- binsZ = range(axisZ.bins()) ++ binsX = list(range(axisX.bins())) ++ binsY = list(range(axisY.bins() - 1, -1, -1)) ++ binsZ = list(range(axisZ.bins())) + elif surfaceXYz >= 0.0 and surfaceYZz >= 0.0 and surfaceZXz >= 0.0: + #6 +- binsX = range(axisX.bins()) +- binsY = range(axisY.bins()) +- binsZ = range(axisZ.bins()) ++ binsX = list(range(axisX.bins())) ++ binsY = list(range(axisY.bins())) ++ binsZ = list(range(axisZ.bins())) + return binsX, binsY, binsZ + + def _plotHistogram1D(self, item, plotterStyle, options): +@@ -973,7 +973,7 @@ class IPlotterRegion: + parameterShowMarkers = dataStyle._parameterData('showMarkers') + parameterShowErrorBars = dataStyle._parameterData('showErrorBars') + binsX = [axisX.UNDERFLOW_BIN] +- binsX.extend(range(axisX.bins())) ++ binsX.extend(list(range(axisX.bins()))) + binsX.append(axisX.OVERFLOW_BIN) + previousHeight = y1 + tempFillLineStyle = ILineStyle() +@@ -1057,7 +1057,7 @@ class IPlotterRegion: + parameterShowErrorBars = dataStyle._parameterData('showErrorBars') + + if parameterFormat == 'histogram': +- if options.has_key('nBinsX'): ++ if 'nBinsX' in options: + nBinsX = int(options['nBinsX']) + else: + nBinsX = 50 +@@ -1144,7 +1144,7 @@ class IPlotterRegion: + parameterShowMarkers = dataStyle._parameterData('showMarkers') + parameterShowErrorBars = dataStyle._parameterData('showErrorBars') + binsX = [axisX.UNDERFLOW_BIN] +- binsX.extend(range(axisX.bins())) ++ binsX.extend(list(range(axisX.bins()))) + binsX.append(axisX.OVERFLOW_BIN) + tempErrorLineStyle = ILineStyle() + if dataStyle._getCustomized('errorBarsColor'): +@@ -1299,13 +1299,13 @@ class IPlotterRegion: + bestLowerY, bestUpperY = self._getAxisValueRangeY() + else: + ### X range. +- if options.has_key('minX'): ++ if 'minX' in options: + bestLowerX = float(options['minX']) + elif self._getXLimits()[0] != None: + bestLowerX = self._getXLimits()[0] + else: + bestLowerX = -10.0 +- if options.has_key('maxX'): ++ if 'maxX' in options: + bestUpperX = float(options['maxX']) + elif self._getXLimits()[1] != None: + bestUpperX = self._getXLimits()[1] +@@ -1313,13 +1313,13 @@ class IPlotterRegion: + bestUpperX = 10.0 + + ### Y range. +- if options.has_key('minY'): ++ if 'minY' in options: + bestLowerY = float(options['minY']) + elif self._getYLimits()[0] != None: + bestLowerY = self._getYLimits()[0] + else: + bestLowerY = -10.0 +- if options.has_key('maxY'): ++ if 'maxY' in options: + bestUpperY = float(options['maxY']) + elif self._getYLimits()[1] != None: + bestUpperY = self._getYLimits()[1] +@@ -1336,11 +1336,11 @@ class IPlotterRegion: + convertX, convertY = self._getConvertersToCanvas() + + ### Plot. +- if options.has_key('minX'): *** 1088 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202203251350.22PDolOS037412>