How do I tell PyLint “it's a variable, not a constant” to stop message C0103?

前端 未结 6 2019
闹比i
闹比i 2020-12-13 08:27

I have a module-level variable in my Python 2.6 program named \"_log\", which PyLint complains about:

C0103: Invalid name \"_log\" (should match (([A-Z_][A-Z         


        
6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-13 08:56

    As other answers have indicated you can disable a specific PyLint warning (such C0103) as by including the following line:

    # pylint: disable=C0103
    

    but this generates the Locally disabling invalid-name warning. Note that this secondary warning could be useful if you want to be reminded of the disabled warning. If you want to disable the warning silently without altering your config file (which would disable the warning globally) you can use:

    # pylint: disable=I0011,C0103
    

    Note that PyLint does not issue a warning that you are disabling I0011!

提交回复
热议问题