Extracted from and improved over #2102 for ease of review.
Removed unused imports spotted by type-checkers. Not removing imports where it's uncertain whether they are causing side-effects. This is mostly manual changes. Then re-ran pycln.
Please validate whether some of those unused imports were meant to be re-exported symbols as part of that module's API.
Extracted from and improved over #2102 for ease of review. Removed unused imports spotted by type-checkers. Not removing imports where it's uncertain whether they are causing side-effects. This is mostly manual changes. Then re-ran pycln. Please validate whether some of those unused imports were meant to be re-exported symbols as part of that module's API.