TYP: Make mypy 0.800 compatible
- [x] closes #39399
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them

LGTM cc @simonjayhawkins  @simonjayhawkins green.

Could you point me to an example of something like ``str | bytes``? Searched for something like this but could not find it > Could you point me to an example of something like `str | bytes`? Searched for something like this but could not find it

from http://mypy-lang.blogspot.com/

Two new Python features improve this situation and are now supported by mypy:

PEP 585 lets you use list[int] instead of List[int] (no need to import List and other generic collections from typing).
PEP 604 lets you write X | Y instead of Union[X, Y], and X | None instead of Optional[X] (no need to import Union or Optional from typing).
Note: Using list[int] requires Python 3.9 and X | Y requires Python 3.10 (alpha) in order to work at runtime. To use them on older versions of Python, use from \_\_future__ import annotations. This allows them to be used in type annotations, but the older variants (or string literal escaping) may be required in non-annotation contexts, such as in type aliases. See the docs for more details. thanks very much, should have looked there and not in our codebase :) @phofl also need to update the version in the doc/source/whatsnew/v1.3.0.rst Thx, did not think about this. #39419