This question answers the question of how to delete read-only files. This is super efficient, but requires unused parameters. In this other question , the question was asked how to tell pylint that several non-contiguous parameters are not used without adding a specific comment (e.g. using _ ). Many of the answers were roughly βZOMG, YOU DESIGN WRONGβ, so I promised that I would give an example where it is needed and out of control. Here is an example.
shutil.rmtree(self._temp_dir, onerror=del_rw) def del_rw(action, name, exc): os.chmod(name, stat.S_IWRITE) os.remove(name)
"Answer" so that pylint does not complain about action and exc on
shutil.rmtree(self._temp_dir, onerror=del_rw) def del_rw(_action, name, _exc): os.chmod(name, stat.S_IWRITE) os.remove(name)
but a new question: how to do this without having _action or _exc as parameters?
python pylint
TinyTheBrontosaurus
source share