Repository: unionai-oss/pandera

Issue:
mypy: pa.typing.Series does not support pd.DatetimeTZDtype as a type argument
**Describe the bug**

Under mypy, `pa.typing.Series` does not support `pd.DatetimeTZDtype` as a valid type argument.

Bug occurs with and without `pandera.mypy` plugin

- [x] I have checked that this issue has not already been reported.
- [x] I have confirmed this bug exists on the latest version of pandera.
- [ ] (optional) I have confirmed this bug exists on the master branch of pandera.

#### Code Sample, a copy-pastable example

```python
from typing import Annotated
import pandas as pd
import pandera as pa
from pandera.typing import Series

class MySchema(pa.SchemaModel):
    # both lines taken from the pandera documentation
    a: Series[Annotated[pd.DatetimeTZDtype, "ns", "UTC"]]
    b: Series[pd.DatetimeTZDtype] = pa.Field(dtype_kwargs={"unit": "ns", "tz": "UTC"})
```

#### Expected behavior

mypy should show no errors

#### Actual behaviour

mypy produces the following errors

```
test.py:8: error: Value of type variable "GenericDtype" of "Series" cannot be "DatetimeTZDtype"
test.py:9: error: Value of type variable "GenericDtype" of "Series" cannot be "DatetimeTZDtype"
```

#### Versions

```
pandas==1.5.0
pandas-stubs==1.4.3.220807
pandera==0.13.3
mypy==0.982
mypy-extensions==0.4.3
```





Discussion:

Resolving patch:
diff --git a/pandera/typing/common.py b/pandera/typing/common.py
--- a/pandera/typing/common.py
+++ b/pandera/typing/common.py
@@ -2,7 +2,7 @@
 # pylint:disable=abstract-method,disable=too-many-ancestors
 
 import inspect
-from typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar
+from typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar, Union
 
 import pandas as pd
 import typing_inspect
@@ -53,83 +53,85 @@
 if GEOPANDAS_INSTALLED:
     GenericDtype = TypeVar(  # type: ignore
         "GenericDtype",
-        bool,
-        int,
-        str,
-        float,
-        pd.core.dtypes.base.ExtensionDtype,
-        Bool,
-        Date,
-        DateTime,
-        Decimal,
-        Timedelta,
-        Category,
-        Float,
-        Float16,
-        Float32,
-        Float64,
-        Int,
-        Int8,
-        Int16,
-        Int32,
-        Int64,
-        UInt8,
-        UInt16,
-        UInt32,
-        UInt64,
-        INT8,
-        INT16,
-        INT32,
-        INT64,
-        UINT8,
-        UINT16,
-        UINT32,
-        UINT64,
-        Object,
-        String,
-        STRING,
-        Geometry,
-        covariant=True,
+        bound=Union[
+            bool,
+            int,
+            str,
+            float,
+            pd.core.dtypes.base.ExtensionDtype,
+            Bool,
+            Date,
+            DateTime,
+            Decimal,
+            Timedelta,
+            Category,
+            Float,
+            Float16,
+            Float32,
+            Float64,
+            Int,
+            Int8,
+            Int16,
+            Int32,
+            Int64,
+            UInt8,
+            UInt16,
+            UInt32,
+            UInt64,
+            INT8,
+            INT16,
+            INT32,
+            INT64,
+            UINT8,
+            UINT16,
+            UINT32,
+            UINT64,
+            Object,
+            String,
+            STRING,
+            Geometry,
+        ],
     )
 else:
     GenericDtype = TypeVar(  # type: ignore
         "GenericDtype",
-        bool,
-        int,
-        str,
-        float,
-        pd.core.dtypes.base.ExtensionDtype,
-        Bool,
-        Date,
-        DateTime,
-        Decimal,
-        Timedelta,
-        Category,
-        Float,
-        Float16,
-        Float32,
-        Float64,
-        Int,
-        Int8,
-        Int16,
-        Int32,
-        Int64,
-        UInt8,
-        UInt16,
-        UInt32,
-        UInt64,
-        INT8,
-        INT16,
-        INT32,
-        INT64,
-        UINT8,
-        UINT16,
-        UINT32,
-        UINT64,
-        Object,
-        String,
-        STRING,
-        covariant=True,
+        bound=Union[
+            bool,
+            int,
+            str,
+            float,
+            pd.core.dtypes.base.ExtensionDtype,
+            Bool,
+            Date,
+            DateTime,
+            Decimal,
+            Timedelta,
+            Category,
+            Float,
+            Float16,
+            Float32,
+            Float64,
+            Int,
+            Int8,
+            Int16,
+            Int32,
+            Int64,
+            UInt8,
+            UInt16,
+            UInt32,
+            UInt64,
+            INT8,
+            INT16,
+            INT32,
+            INT64,
+            UINT8,
+            UINT16,
+            UINT32,
+            UINT64,
+            Object,
+            String,
+            STRING,
+        ],
     )
 
 Schema = TypeVar("Schema", bound="SchemaModel")  # type: ignore


Test patch: