In this question, an answer to how to remove read-only files is presented. It's super effective but requires having unused parameters. In this other question it was asked how to tell pylint that multiple non-adjacent parameters are unused without adding a specific comment (e.g., by using _
). Many of the answers were approximately "ZOMG YOU'RE DESIGNING IT WRONG" so I promised I would put up an example where this is needed and out of my control. Here is that example.
shutil.rmtree(self._temp_dir, onerror=del_rw)
def del_rw(action, name, exc):
os.chmod(name, stat.S_IWRITE)
os.remove(name)
The "answer" so that pylint would not complain about action
and exc
is to
shutil.rmtree(self._temp_dir, onerror=del_rw)
def del_rw(_action, name, _exc):
os.chmod(name, stat.S_IWRITE)
os.remove(name)
but the new question is, how to do this without having _action
or _exc
as parameters?