Warning in python file when i m using pychecker.

Dave Angel davea at davea.name
Fri Apr 26 02:57:33 EDT 2013


On 04/26/2013 02:42 AM, Avnesh Shakya wrote:
> hi,
>     I am trying to run my file using pychecker, but it's showing warning. I am unable to get these warning. Please help me, how to remove these warning. I am using pychecker first time.
>
> avin at HP:~/github/UdacitySiteData$ pychecker udacity_to_jsonFinal.py
> Processing module udacity_to_jsonFinal (udacity_to_jsonFinal.py)...
>
> Warnings...
>
> [system path]/dist-packages/bs4/__init__.py:206: Parameter (successor) not used
> [system path]/dist-packages/bs4/__init__.py:209: Parameter (successor) not used
> [system path]/dist-packages/bs4/__init__.py:213: Local variable (tag) not used
>
> [system path]/dist-packages/bs4/element.py:306: Parameter (kwargs) not used
> [system path]/dist-packages/bs4/element.py:507: (id) shadows builtin
> [system path]/dist-packages/bs4/element.py:791: (next) shadows builtin
> [system path]/dist-packages/bs4/element.py:903: Invalid arguments to (__repr__), got 2, expected 1
>
> Thanks.
>

What's not clear about any of these?  On line 206, you defined some 
function and one of the formal parameters was called successor.  You 
don't use that value anywhere in the function.  The fix?  Omit the 
unused parameter in the function definition, and change all the caller 
sites.  Sometimes this is impractical, for example in functions that are 
callbacks from code you don't control.

Likewise for the next 3.

id() is a built-in function, so you shouldn't use that name for your own 
functions or variables.  rename it.

Likewise next, which is even more likely to cause confusion, since next 
is frequently used in real code, while id() is more likely a debugging aid.

If you want anything more detailed, perhaps you should show the context 
around each warning.  You have the line numbers, so that should be easy.


-- 
DaveA



More information about the Python-list mailing list