Fix 4689 Exclude ``ThreadPoolExecutor`` and ``ProcessPoolExecutor`` from ``consider-using-with`` (#4721)
* Do not immediately emit ``consider-using-with`` if a context manager is assigned to a variable.
Instead check if it is used later on in a ``with`` block.
* Enhance check to also work for tuple unpacking in assignments
* Remove ``ThreadPoolExecutor`` and ``ProcessPoolExecutor`` from list of callables that trigger the ``consider-using-with`` message
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
5 files changed