My code contains what seems to be common practise, using:
import threading
mylock = threading.Lock()
def myfunction():
with mylock:
do_something()
But my PEP8 pylinter is squawking about:
Context manager 'lock' doesn't implement __enter__ and __exit__
Is there something I'm doing wrong in this code? I could just ignore the error, as I haven't seen any issues thus far, but I'd prefer to not just ignore & hope. I read on another post about the documentation for the __enter__ and __exit__, so I assume they must actually exist in some form.