tpaviot/pythonocc — Issue #38: Some overloaded methods need to be renamed in python
Author: doudz
Created: 2011-12-14 09:30:09+00:00
State: open

I wrote a small python script that scan *.i files in order to find ambiguous methods

Xw.i
--DisplaySize()
-----> [Standard_Integer, Standard_Integer]
-----> [Standard_Real, Standard_Real]
--Position()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer]
--Size()
-----> [Standard_Real, Standard_Real]
-----> [Standard_Integer, Standard_Integer]
IGESGeom.i
--Equation()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
BRepApprox.i
--Error()
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
Graphic2d.i
--TextSize()
-----> [Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
--Values(Standard_Integer aRank)
-----> [Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Integer, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
Extrema.i
--TrimmedSquareDistances()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
GeomAPI.i
--Parameters(Standard_Integer Index)
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
--LowerDistanceParameters()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
Bnd.i
--Get()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
BSplCLib.i
--Interpolate(Standard_Integer Degree, const FlatKnots, const Parameters, const ContactOrderArray, Standard_Integer ArrayDimension)
-----> [Standard_Real, Standard_Integer]
-----> [Standard_Real, Standard_Real, Standard_Integer]
--Eval(Standard_Real U, Standard_Boolean PeriodicFlag, Standard_Integer DerivativeRequest, Standard_Integer Degree, const FlatKnots, Standard_Integer ArrayDimension)
-----> [Standard_Integer, Standard_Real, Standard_Real]
-----> [Standard_Integer, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
BRepExtrema.i
--TrimmedSquareDistances()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
V3d.i
--GraphicValues()
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
--Convert(Standard_Integer Xp, Standard_Integer Yp)
-----> [Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real]
IntTools.i
--ComputeVE(const aV, const aE)
-----> Standard_Real
-----> [Standard_Real, Standard_Real]
Geom.i
--Resolution(Standard_Real Tolerance3D)
-----> [Standard_Real, Standard_Real]
-----> Standard_Real
--PeriodicNormalization()
-----> Standard_Real
-----> [Standard_Real, Standard_Real]
--Coefficients()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
BOPTools.i
--CurveOnSurface(const aE, const aF, Standard_Boolean aTrim3d)
-----> Standard_Real
-----> [Standard_Real, Standard_Real, Standard_Real]
Dynamic.i
--Value(Standard_CString aparameter)
-----> Standard_Integer
-----> Standard_Real
Intf.i
--InfoFirst()
-----> [Standard_Integer, Standard_Integer, Standard_Real]
-----> [Standard_Integer, Standard_Real]
-----> [Standard_Integer, Standard_Real, Standard_Integer, Standard_Real]
--InfoSecond()
-----> [Standard_Integer, Standard_Integer, Standard_Real]
-----> [Standard_Integer, Standard_Real]
-----> [Standard_Integer, Standard_Real, Standard_Integer, Standard_Real]
Graphic3d.i
--VertexColor(Standard_Integer anIndex)
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> Standard_Integer
Visual3d.i
--MinMaxValues(const ASet)
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
--Values()
-----> [Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
--MinMaxValues()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
GeomInt.i
--Error()
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
AdvApp2Var.i
--FirstNotApprox()
-----> Standard_Integer
-----> [Standard_Integer, Standard_Integer]
Aspect.i
--Position()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer]
--Values()
-----> [Standard_Integer, Standard_Integer]
-----> Standard_Real
--Size()
-----> [Standard_Integer, Standard_Integer]
-----> [Standard_Real, Standard_Real]
Interface.i
--Internals()
-----> [Standard_Integer, Standard_Integer, Standard_Integer]
-----> Standard_Integer
gp.i
--Transforms()
-----> [Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real]
--Coefficients()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
--Coord()
-----> [Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real, Standard_Real]
BRepClass3d.i
--FindAPointInTheFace(const F)
-----> Standard_Real
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
OSD.i
--Show()
-----> Standard_Real
-----> [Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Integer, Standard_Integer, Standard_Real]
IntSurf.i
--Parameters()
-----> [Standard_Real, Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
AppDef.i
--Error()
-----> [Standard_Real, Standard_Real, Standard_Real]
-----> [Standard_Real, Standard_Real]
Quantity.i
--Values()
-----> [Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer]
-----> [Standard_Integer, Standard_Integer]
-----> [Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer, Standard_Integer]
Materials.i
--Value(Standard_CString aparameter)
-----> Standard_Integer
-----> Standard_Real

the script :
```python
import os
import re

PATH = '/extra/tpaviot-pythonocc-4121dda/src/wrapper/SWIG_files/linux_darwin'
PATTERN = r'%feature\("autodoc","(.*) -> (.*)"\);'

def find_double(func_lst):
funcs = {}
funcs_double = {}
for func in func_lst:
if func == '1':
continue
if not funcs.has_key(func[0]):
funcs[func[0]] = func
elif func[1] != funcs[func[0]][1]:
if not funcs_double.has_key(func[0]):
funcs_double[func[0]] = [funcs[func[0]][1]]
if not func[1] in funcs_double[func[0]]:
funcs_double[func[0]].append(func[1])
return funcs_double

lst = os.listdir(PATH)

for f in lst:
fpath = os.path.join(PATH,f)
txt = open(fpath,'r').read()
g = re.findall(PATTERN,txt)
double = find_double(g)
if double:
print f
for k,v in double.items():
print '\t',k
for r in v:
print '\t'*2,'->',r

```