views:

122

answers:

1

Hi,

when generating python wrappers with swig the python wrapper classes in the generated python file do not have an explicit self parameter, for example see below:

class PySwigIterator(_object):
    def value(*args): return _spatiotemporalnmf.PySwigIterator_value(*args)
    def incr(*args): return _spatiotemporalnmf.PySwigIterator_incr(*args)
    def decr(*args): return _spatiotemporalnmf.PySwigIterator_decr(*args)
    def distance(*args): return _spatiotemporalnmf.PySwigIterator_distance(*args)

I am developing with the eclipse pluging Pydev. Pydev always shows an error when it detects a method without explicit self parameter. I am aware of two methods to get rid of the errors: First, disable error checking for the whole project in the Pydev preferences. Second, add a #@NoSelf to every line with an error. I don't want to use the first one, because I still want to get error warnings for my non-swig-generated files. Obviously the second one is also not very good, because I would have to do it by hand and every time I generate the file again, all #@NoSelfs will be gone.

My Question now is, is there a better way to achieve this?

Thanks

A: 

As from the documentation, any file with the comment

#@PydevCodeAnalysisIgnore

inside will not be analyzed.

Therefore, you just need to add it to all SWIG-generated files, and you should be OK. It is just one place to change, and you could even write a very small processor that will add it automatically.

Roberto Liffredo