[Python-projects] Supress checknig of imported module?

skip at pobox.com skip at pobox.com
Thu Nov 20 16:40:33 CET 2008


    >> I don't want to globally supress E1101 and I dont want to supress the
    >> error on ever line where I use omniDerivedThing. Is there a way to
    >> tell pylint to ignore a particular imported module? 
    ...
    Duncan> I had a similar problem with an EnumerationType abstract base
    Duncan> class written or adapted by a colleague, where each subclass was
    Duncan> defined:
    ...

There is only much pylint can do to divine module attributes.  Python is a
bit too dynamic to allow pylint to work flawlessly in this area.  Mailman
(and I think the email package) has a similar problem because it uses a lazy
import mechanism.  When pylint wants to check on desired attributes they
just aren't there.  The PyGTK stuff (gobject, glib, gtk, et al) yield
similar complaints though perhaps for a different reason (they are
implemented in C, so pylint can't build an ast to inspect *).

I'm not sure there's a good solution.  It would be nice to disable attribute
checks in specific modules.  Sylvain suggested ignored-classes.  Is there an
ignored-modules setting as well?

-- 
Skip Montanaro - skip at pobox.com - http://smontanaro.dyndns.org/

*  Something just occurred to me.  It might be kind of useful to generate a
   stub Python module from a C extension module.  Running something like

       generate-python-stub gobject gtk

   would cause the named modules to be imported and to the extent possible
   generate stub modules in Python which mimic the structure of the
   extension modules.  Pylint could then be directed to use those stub
   modules.


More information about the Python-Projects mailing list