[Python-projects] pylint reports false errors for wx module.

Carsten Koch Carsten.Koch at icem.com
Wed Aug 30 02:58:27 CEST 2006


Meding, Olaf wrote:
...
> You need to call the constructor of the class you inherit from.  Not
> sure if that would solve the problem.
> 
> class test(wx.Frame):
>    def __init__(self):
>       wx.Frame.__init__(self)
>       print wx.Platform

I made my original little test case program as short
as possible. I know that normally I have to
call the constructor of the class I inherit from.

The two problems are the pylint messages:

 Module 'wx' has no 'Platform' member
 Too many public methods (259/20)

The first one is simply untrue, the second one
complains abouth something which is outside my control.

These problems remain if I call the wx.Frame.__init__
method.

Just to keep the focus on the actual problems,
here is a version of my test case program that
changes all the things that I _can_ change,
but still gets the two error messages from pylint:


hp/py> cat test_wx_platform.py
" a pylint test. "
__revision__ = '2'

import wx

class Test(wx.Frame):
   """
      This class has only one method,
      but gets a Too many public methods
      error from pylint.
   """
   def __init__(self):
      wx.Frame.__init__(self, None)
      # wx.Platform does exist, but pylint says it does not.
      print wx.Platform

app = wx.PySimpleApp()
Test()
hp/py> python test_wx_platform.py
__WXGTK__
hp/py> pylint test_wx_platform.py
************* Module test_wx_platform
E: 15:Test.__init__: Module 'wx' has no 'Platform' member
R:  6:Test: Too many public methods (259/20)


Report
======
8 statements analysed.

Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |0        |=          |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |0.000    |=          |
+-------------------------+------+---------+-----------+



Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |8      |53.33 |8        |=          |
+----------+-------+------+---------+-----------+
|docstring |6      |40.00 |6        |=          |
+----------+-------+------+---------+-----------+
|comment   |0      |0.00  |0        |=          |
+----------+-------+------+---------+-----------+
|empty     |1      |6.67  |1        |=          |
+----------+-------+------+---------+-----------+



External dependencies
---------------------
::

    wx (test_wx_platform)



Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |1      |1          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |1      |1          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |1      |1          |=          |100.00      |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |0      |0          |=          |0.00        |0.00     |
+---------+-------+-----------+-----------+------------+---------+



Total errors / warnings
-----------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |0      |0        |=          |
+-----------+-------+---------+-----------+
|refactor   |1      |1        |=          |
+-----------+-------+---------+-----------+
|warning    |0      |0        |=          |
+-----------+-------+---------+-----------+
|error      |1      |1        |=          |
+-----------+-------+---------+-----------+



Messages
--------

+-----------+-----------+
|message id |occurences |
+===========+===========+
|R0904      |1          |
+-----------+-----------+
|E1101      |1          |
+-----------+-----------+



Global evaluation
-----------------
Your code has been rated at 2.50/10 (previous run: 2.50/10)



More information about the Python-Projects mailing list