CLN: Remove unused functions/variables
Found by pyright's `reportUnused*`.

Unused functions/variables are not directly related to typing, but pyright warns about these cases because it is asked to do unnecessary work.
looks good, some failures A few of the private functions are only called by tests which caused them to fail. The only failing test now is codecov/patch for some reason. can you rebase @jreback rebased & green thanks @twoertwein did you need to turn on a pyright option to have this reported? e.g. can we have it always run? (or is it expensive)
 I didn't turn them one because we have false-positives. We "exclude" pandas/tests - if we were to "ignore" pandas/tests, we probaly wouldn't have these false-positives anymore but pyright might be 30-50s slower if it has to work through the mostly un-typed tests.

The four options from pyright are:

- reportUnusedClass: is only "offended" in one file (pickle compat) where a private class is refernced using only a string. We could disable reportUnusedClass for this file using with a comment at the top of the file.
- reportUnusedFunction: needs a discussion whether these private functions should either be moved (often they are used only one time, but defiend in a different file) or made "public" (at least remove the leading "_")
- reportUnusedImport: could probably be enabled if `__all__` or redundant import were used (main "offenders" are the api.py files)
- reportUnusedVariable: needs consensus to start unused variables with _ (flake8-bugbear has the same rules but it is not enabled because it is "controversial"). 