] > [Python-projects] Ignore line/block (Logilab.org)

Email [Python-projects] Ignore line/block

subject
[Python-projects] Ignore line/block
date
2005/07/12 13:47
Hello,

          Looking through the docs I can see that it is possible to 
enable/disable messages for a module - however is it possible to 
enable-disable message for a section of code.  For example I have :

<code>

def getAllSerialPortNames():
    '''
    :Purpose: Scan for available ports. return a list of tuples (num, name)
    :Value: A list containing tuples of num:name of the port IDs
    '''
    lstAvailable = []
    for i in range(256):
        try:
            objSer = serial.Serial(i)
            lstAvailable.append( (i, objSer.portstr))
            objSer.close()
        except serial.SerialException:
            pass
    return lstAvailable

</code>

    In this case, due to limitations of the serial api - I have no 
choice but to catch the error and pass on it.  What I want to do is to 
tell pyLint - yes I know its bad style, I have no choice please don't 
report an error on this code for error ID 'W0704' for these lines (but 
re-enable it after that).  I want to exclude lines not code blocks 
(function, methods, etc).  I have several examples of this throughout 
our code base and I want to give my developers the option to exclude 
bits they want to (these exclusions are then followed up by a code 
review so that people don't simply exclude because they he/she can't be 
bothered to fix it ;-)).

    Any and all help much appreciated.

Cheers,

Neil

-- 

Neil Benn
Senior Automation Engineer
Cenix BioScience
BioInnovations Zentrum
Tatzberg 46
D-01307
Dresden
Germany

Tel : +49 (0)351 4173 154
e-mail : benn@cenix-bioscience.com
Cenix Website : http://www.cenix-bioscience.com

_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects


has reply