Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

W0622: Redefining built-in 'help' (redefined-builtin)

I have this method that causes a pylint issue:

def add_ssh_config_path(self,
                        help="Enter ssh-config path for ssh connection to the host.",
                        required=False, metavar="<SSH_CONFIG_PATH>"):
    self._parser.add_argument("--ssh-config-path", metavar=metavar,
                              required=required, help=help, type=str)
    return self

The issue is:

W0622: Redefining built-in 'help' (redefined-builtin)

I am not able to understand the issue. Why is help a built-in in the context of a method definition? How do I get around this issue?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The issue occurs because help is a built-in function, and using it as a parameter name shadows the built-in, triggering pylint’s W0622 warning. You can fix it by renaming the parameter, then you’ll avoid the conflict:

def add_ssh_config_path(self,
                        help_text="Enter ssh-config path for ssh connection to the host.",
                        required=False, metavar="<SSH_CONFIG_PATH>"):
    self._parser.add_argument("--ssh-config-path", metavar=metavar,
                              required=required, help=help_text, type=str)
    return self
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading