We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN 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
```




--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pandera/typing/common.py`
Content:
```
1 """Common typing functionality."""
2 # pylint:disable=abstract-method,disable=too-many-ancestors
3 
4 import inspect
5 from typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar
6 
7 import pandas as pd
8 import typing_inspect
9 
10 from .. import dtypes
11 from ..engines import numpy_engine, pandas_engine
12 
13 Bool = dtypes.Bool  #: ``"bool"`` numpy dtype
14 Date = dtypes.Date  #: ``datetime.date`` object dtype
15 DateTime = dtypes.DateTime  #: ``"datetime64[ns]"`` numpy dtype
16 Decimal = dtypes.Decimal  #: ``decimal.Decimal`` object dtype
17 Timedelta = dtypes.Timedelta  #: ``"timedelta64[ns]"`` numpy dtype
18 Category = dtypes.Category  #: pandas ``"categorical"`` datatype
19 Float = dtypes.Float  #: ``"float"`` numpy dtype
20 Float16 = dtypes.Float16  #: ``"float16"`` numpy dtype
21 Float32 = dtypes.Float32  #: ``"float32"`` numpy dtype
22 Float64 = dtypes.Float64  #: ``"float64"`` numpy dtype
23 Int = dtypes.Int  #: ``"int"`` numpy dtype
24 Int8 = dtypes.Int8  #: ``"int8"`` numpy dtype
25 Int16 = dtypes.Int16  #: ``"int16"`` numpy dtype
26 Int32 = dtypes.Int32  #: ``"int32"`` numpy dtype
27 Int64 = dtypes.Int64  #: ``"int64"`` numpy dtype
28 UInt8 = dtypes.UInt8  #: ``"uint8"`` numpy dtype
29 UInt16 = dtypes.UInt16  #: ``"uint16"`` numpy dtype
30 UInt32 = dtypes.UInt32  #: ``"uint32"`` numpy dtype
31 UInt64 = dtypes.UInt64  #: ``"uint64"`` numpy dtype
32 INT8 = pandas_engine.INT8  #: ``"Int8"`` pandas dtype:: pandas 0.24.0+
33 INT16 = pandas_engine.INT16  #: ``"Int16"`` pandas dtype: pandas 0.24.0+
34 INT32 = pandas_engine.INT32  #: ``"Int32"`` pandas dtype: pandas 0.24.0+
35 INT64 = pandas_engine.INT64  #: ``"Int64"`` pandas dtype: pandas 0.24.0+
36 UINT8 = pandas_engine.UINT8  #: ``"UInt8"`` pandas dtype:: pandas 0.24.0+
37 UINT16 = pandas_engine.UINT16  #: ``"UInt16"`` pandas dtype: pandas 0.24.0+
38 UINT32 = pandas_engine.UINT32  #: ``"UInt32"`` pandas dtype: pandas 0.24.0+
39 UINT64 = pandas_engine.UINT64  #: ``"UInt64"`` pandas dtype: pandas 0.24.0+
40 Object = numpy_engine.Object  #: ``"object"`` numpy dtype
41 String = dtypes.String  #: ``"str"`` numpy dtype
42 #: ``"string"`` pandas dtypes: pandas 1.0.0+. For <1.0.0, this enum will
43 #: fall back on the str-as-object-array representation.
44 STRING = pandas_engine.STRING  #: ``"str"`` numpy dtype
45 BOOL = pandas_engine.BOOL  #: ``"str"`` numpy dtype
46 
47 try:
48     Geometry = pandas_engine.Geometry  # : ``"geometry"`` geopandas dtype
49     GEOPANDAS_INSTALLED = True
50 except AttributeError:
51     GEOPANDAS_INSTALLED = False
52 
53 if GEOPANDAS_INSTALLED:
54     GenericDtype = TypeVar(  # type: ignore
55         "GenericDtype",
56         bool,
57         int,
58         str,
59         float,
60         pd.core.dtypes.base.ExtensionDtype,
61         Bool,
62         Date,
63         DateTime,
64         Decimal,
65         Timedelta,
66         Category,
67         Float,
68         Float16,
69         Float32,
70         Float64,
71         Int,
72         Int8,
73         Int16,
74         Int32,
75         Int64,
76         UInt8,
77         UInt16,
78         UInt32,
79         UInt64,
80         INT8,
81         INT16,
82         INT32,
83         INT64,
84         UINT8,
85         UINT16,
86         UINT32,
87         UINT64,
88         Object,
89         String,
90         STRING,
91         Geometry,
92         covariant=True,
93     )
94 else:
95     GenericDtype = TypeVar(  # type: ignore
96         "GenericDtype",
97         bool,
98         int,
99         str,
100         float,
101         pd.core.dtypes.base.ExtensionDtype,
102         Bool,
103         Date,
104         DateTime,
105         Decimal,
106         Timedelta,
107         Category,
108         Float,
109         Float16,
110         Float32,
111         Float64,
112         Int,
113         Int8,
114         Int16,
115         Int32,
116         Int64,
117         UInt8,
118         UInt16,
119         UInt32,
120         UInt64,
121         INT8,
122         INT16,
123         INT32,
124         INT64,
125         UINT8,
126         UINT16,
127         UINT32,
128         UINT64,
129         Object,
130         String,
131         STRING,
132         covariant=True,
133     )
134 
135 Schema = TypeVar("Schema", bound="SchemaModel")  # type: ignore
136 
137 
138 # pylint:disable=invalid-name
139 if TYPE_CHECKING:
140     T = TypeVar("T")  # pragma: no cover
141 else:
142     T = Schema
143 
144 
145 class DataFrameBase(Generic[T]):
146     # pylint: disable=too-few-public-methods
147     """
148     Pandera Dataframe base class for validating dataframes on
149     initialization.
150     """
151 
152     default_dtype: Optional[Type] = None
153 
154     def __setattr__(self, name: str, value: Any) -> None:
155         # pylint: disable=no-member
156         object.__setattr__(self, name, value)
157         if name == "__orig_class__":
158             orig_class = getattr(self, "__orig_class__")
159             class_args = getattr(orig_class, "__args__", None)
160             if class_args is not None and any(
161                 x.__name__ == "SchemaModel"
162                 for x in inspect.getmro(class_args[0])
163             ):
164                 schema_model = value.__args__[0]
165 
166             # prevent the double validation problem by preventing checks for
167             # dataframes with a defined pandera.schema
168             pandera_accessor = getattr(self, "pandera")
169             if (
170                 pandera_accessor.schema is None
171                 or pandera_accessor.schema != schema_model.to_schema()
172             ):
173                 pandera_accessor.add_schema(schema_model.to_schema())
174                 self.__dict__ = schema_model.validate(self).__dict__
175 
176 
177 # pylint:disable=too-few-public-methods
178 class SeriesBase(Generic[GenericDtype]):
179     """Pandera Series base class to use for all pandas-like APIs."""
180 
181     default_dtype: Optional[Type] = None
182 
183     def __get__(
184         self, instance: object, owner: Type
185     ) -> str:  # pragma: no cover
186         raise AttributeError("Series should resolve to Field-s")
187 
188 
189 # pylint:disable=too-few-public-methods
190 class IndexBase(Generic[GenericDtype]):
191     """Representation of pandas.Index, only used for type annotation.
192 
193     *new in 0.5.0*
194     """
195 
196     default_dtype: Optional[Type] = None
197 
198     def __get__(
199         self, instance: object, owner: Type
200     ) -> str:  # pragma: no cover
201         raise AttributeError("Indexes should resolve to pa.Index-s")
202 
203 
204 class AnnotationInfo:  # pylint:disable=too-few-public-methods
205     """Captures extra information about an annotation.
206 
207     Attributes:
208         origin: The non-parameterized generic class.
209         arg: The first generic type (SchemaModel does not support more than
210             1 argument).
211         literal: Whether the annotation is a literal.
212         optional: Whether the annotation is optional.
213         raw_annotation: The raw annotation.
214         metadata: Extra arguments passed to :data:`typing.Annotated`.
215     """
216 
217     def __init__(self, raw_annotation: Type) -> None:
218         self._parse_annotation(raw_annotation)
219 
220     @property
221     def is_generic_df(self) -> bool:
222         """True if the annotation is a DataFrameBase subclass."""
223         try:
224             if self.origin is None:
225                 return False
226             return issubclass(self.origin, DataFrameBase)
227         except TypeError:
228             return False
229 
230     def _parse_annotation(self, raw_annotation: Type) -> None:
231         """Parse key information from annotation.
232 
233         :param annotation: A subscripted type.
234         :returns: Annotation
235         """
236         self.raw_annotation = raw_annotation
237         self.origin = self.arg = None
238 
239         self.optional = typing_inspect.is_optional_type(raw_annotation)
240         if self.optional and typing_inspect.is_union_type(raw_annotation):
241             # Annotated with Optional or Union[..., NoneType]
242             # get_args -> (pandera.typing.Index[str], <class 'NoneType'>)
243             raw_annotation = typing_inspect.get_args(raw_annotation)[0]
244 
245         self.origin = typing_inspect.get_origin(raw_annotation)
246         # Replace empty tuple returned from get_args by None
247         args = typing_inspect.get_args(raw_annotation) or None
248         self.arg = args[0] if args else args
249 
250         self.metadata = getattr(self.arg, "__metadata__", None)
251         if self.metadata:
252             self.arg = typing_inspect.get_args(self.arg)[0]
253 
254         self.literal = typing_inspect.is_literal_type(self.arg)
255         if self.literal:
256             self.arg = typing_inspect.get_args(self.arg)[0]
257 
258         self.default_dtype = getattr(raw_annotation, "default_dtype", None)
259
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

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

{"golden_diff": "diff --git a/pandera/typing/common.py b/pandera/typing/common.py\n--- a/pandera/typing/common.py\n+++ b/pandera/typing/common.py\n@@ -2,7 +2,7 @@\n # pylint:disable=abstract-method,disable=too-many-ancestors\n \n import inspect\n-from typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar\n+from typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar, Union\n \n import pandas as pd\n import typing_inspect\n@@ -53,83 +53,85 @@\n if GEOPANDAS_INSTALLED:\n     GenericDtype = TypeVar(  # type: ignore\n         \"GenericDtype\",\n-        bool,\n-        int,\n-        str,\n-        float,\n-        pd.core.dtypes.base.ExtensionDtype,\n-        Bool,\n-        Date,\n-        DateTime,\n-        Decimal,\n-        Timedelta,\n-        Category,\n-        Float,\n-        Float16,\n-        Float32,\n-        Float64,\n-        Int,\n-        Int8,\n-        Int16,\n-        Int32,\n-        Int64,\n-        UInt8,\n-        UInt16,\n-        UInt32,\n-        UInt64,\n-        INT8,\n-        INT16,\n-        INT32,\n-        INT64,\n-        UINT8,\n-        UINT16,\n-        UINT32,\n-        UINT64,\n-        Object,\n-        String,\n-        STRING,\n-        Geometry,\n-        covariant=True,\n+        bound=Union[\n+            bool,\n+            int,\n+            str,\n+            float,\n+            pd.core.dtypes.base.ExtensionDtype,\n+            Bool,\n+            Date,\n+            DateTime,\n+            Decimal,\n+            Timedelta,\n+            Category,\n+            Float,\n+            Float16,\n+            Float32,\n+            Float64,\n+            Int,\n+            Int8,\n+            Int16,\n+            Int32,\n+            Int64,\n+            UInt8,\n+            UInt16,\n+            UInt32,\n+            UInt64,\n+            INT8,\n+            INT16,\n+            INT32,\n+            INT64,\n+            UINT8,\n+            UINT16,\n+            UINT32,\n+            UINT64,\n+            Object,\n+            String,\n+            STRING,\n+            Geometry,\n+        ],\n     )\n else:\n     GenericDtype = TypeVar(  # type: ignore\n         \"GenericDtype\",\n-        bool,\n-        int,\n-        str,\n-        float,\n-        pd.core.dtypes.base.ExtensionDtype,\n-        Bool,\n-        Date,\n-        DateTime,\n-        Decimal,\n-        Timedelta,\n-        Category,\n-        Float,\n-        Float16,\n-        Float32,\n-        Float64,\n-        Int,\n-        Int8,\n-        Int16,\n-        Int32,\n-        Int64,\n-        UInt8,\n-        UInt16,\n-        UInt32,\n-        UInt64,\n-        INT8,\n-        INT16,\n-        INT32,\n-        INT64,\n-        UINT8,\n-        UINT16,\n-        UINT32,\n-        UINT64,\n-        Object,\n-        String,\n-        STRING,\n-        covariant=True,\n+        bound=Union[\n+            bool,\n+            int,\n+            str,\n+            float,\n+            pd.core.dtypes.base.ExtensionDtype,\n+            Bool,\n+            Date,\n+            DateTime,\n+            Decimal,\n+            Timedelta,\n+            Category,\n+            Float,\n+            Float16,\n+            Float32,\n+            Float64,\n+            Int,\n+            Int8,\n+            Int16,\n+            Int32,\n+            Int64,\n+            UInt8,\n+            UInt16,\n+            UInt32,\n+            UInt64,\n+            INT8,\n+            INT16,\n+            INT32,\n+            INT64,\n+            UINT8,\n+            UINT16,\n+            UINT32,\n+            UINT64,\n+            Object,\n+            String,\n+            STRING,\n+        ],\n     )\n \n Schema = TypeVar(\"Schema\", bound=\"SchemaModel\")  # type: ignore\n", "issue": "mypy: pa.typing.Series does not support pd.DatetimeTZDtype as a type argument\n**Describe the bug**\r\n\r\nUnder mypy, `pa.typing.Series` does not support `pd.DatetimeTZDtype` as a valid type argument.\r\n\r\nBug occurs with and without `pandera.mypy` plugin\r\n\r\n- [x] I have checked that this issue has not already been reported.\r\n- [x] I have confirmed this bug exists on the latest version of pandera.\r\n- [ ] (optional) I have confirmed this bug exists on the master branch of pandera.\r\n\r\n#### Code Sample, a copy-pastable example\r\n\r\n```python\r\nfrom typing import Annotated\r\nimport pandas as pd\r\nimport pandera as pa\r\nfrom pandera.typing import Series\r\n\r\nclass MySchema(pa.SchemaModel):\r\n    # both lines taken from the pandera documentation\r\n    a: Series[Annotated[pd.DatetimeTZDtype, \"ns\", \"UTC\"]]\r\n    b: Series[pd.DatetimeTZDtype] = pa.Field(dtype_kwargs={\"unit\": \"ns\", \"tz\": \"UTC\"})\r\n```\r\n\r\n#### Expected behavior\r\n\r\nmypy should show no errors\r\n\r\n#### Actual behaviour\r\n\r\nmypy produces the following errors\r\n\r\n```\r\ntest.py:8: error: Value of type variable \"GenericDtype\" of \"Series\" cannot be \"DatetimeTZDtype\"\r\ntest.py:9: error: Value of type variable \"GenericDtype\" of \"Series\" cannot be \"DatetimeTZDtype\"\r\n```\r\n\r\n#### Versions\r\n\r\n```\r\npandas==1.5.0\r\npandas-stubs==1.4.3.220807\r\npandera==0.13.3\r\nmypy==0.982\r\nmypy-extensions==0.4.3\r\n```\r\n\r\n\r\n\n", "before_files": [{"content": "\"\"\"Common typing functionality.\"\"\"\n# pylint:disable=abstract-method,disable=too-many-ancestors\n\nimport inspect\nfrom typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar\n\nimport pandas as pd\nimport typing_inspect\n\nfrom .. import dtypes\nfrom ..engines import numpy_engine, pandas_engine\n\nBool = dtypes.Bool  #: ``\"bool\"`` numpy dtype\nDate = dtypes.Date  #: ``datetime.date`` object dtype\nDateTime = dtypes.DateTime  #: ``\"datetime64[ns]\"`` numpy dtype\nDecimal = dtypes.Decimal  #: ``decimal.Decimal`` object dtype\nTimedelta = dtypes.Timedelta  #: ``\"timedelta64[ns]\"`` numpy dtype\nCategory = dtypes.Category  #: pandas ``\"categorical\"`` datatype\nFloat = dtypes.Float  #: ``\"float\"`` numpy dtype\nFloat16 = dtypes.Float16  #: ``\"float16\"`` numpy dtype\nFloat32 = dtypes.Float32  #: ``\"float32\"`` numpy dtype\nFloat64 = dtypes.Float64  #: ``\"float64\"`` numpy dtype\nInt = dtypes.Int  #: ``\"int\"`` numpy dtype\nInt8 = dtypes.Int8  #: ``\"int8\"`` numpy dtype\nInt16 = dtypes.Int16  #: ``\"int16\"`` numpy dtype\nInt32 = dtypes.Int32  #: ``\"int32\"`` numpy dtype\nInt64 = dtypes.Int64  #: ``\"int64\"`` numpy dtype\nUInt8 = dtypes.UInt8  #: ``\"uint8\"`` numpy dtype\nUInt16 = dtypes.UInt16  #: ``\"uint16\"`` numpy dtype\nUInt32 = dtypes.UInt32  #: ``\"uint32\"`` numpy dtype\nUInt64 = dtypes.UInt64  #: ``\"uint64\"`` numpy dtype\nINT8 = pandas_engine.INT8  #: ``\"Int8\"`` pandas dtype:: pandas 0.24.0+\nINT16 = pandas_engine.INT16  #: ``\"Int16\"`` pandas dtype: pandas 0.24.0+\nINT32 = pandas_engine.INT32  #: ``\"Int32\"`` pandas dtype: pandas 0.24.0+\nINT64 = pandas_engine.INT64  #: ``\"Int64\"`` pandas dtype: pandas 0.24.0+\nUINT8 = pandas_engine.UINT8  #: ``\"UInt8\"`` pandas dtype:: pandas 0.24.0+\nUINT16 = pandas_engine.UINT16  #: ``\"UInt16\"`` pandas dtype: pandas 0.24.0+\nUINT32 = pandas_engine.UINT32  #: ``\"UInt32\"`` pandas dtype: pandas 0.24.0+\nUINT64 = pandas_engine.UINT64  #: ``\"UInt64\"`` pandas dtype: pandas 0.24.0+\nObject = numpy_engine.Object  #: ``\"object\"`` numpy dtype\nString = dtypes.String  #: ``\"str\"`` numpy dtype\n#: ``\"string\"`` pandas dtypes: pandas 1.0.0+. For <1.0.0, this enum will\n#: fall back on the str-as-object-array representation.\nSTRING = pandas_engine.STRING  #: ``\"str\"`` numpy dtype\nBOOL = pandas_engine.BOOL  #: ``\"str\"`` numpy dtype\n\ntry:\n    Geometry = pandas_engine.Geometry  # : ``\"geometry\"`` geopandas dtype\n    GEOPANDAS_INSTALLED = True\nexcept AttributeError:\n    GEOPANDAS_INSTALLED = False\n\nif GEOPANDAS_INSTALLED:\n    GenericDtype = TypeVar(  # type: ignore\n        \"GenericDtype\",\n        bool,\n        int,\n        str,\n        float,\n        pd.core.dtypes.base.ExtensionDtype,\n        Bool,\n        Date,\n        DateTime,\n        Decimal,\n        Timedelta,\n        Category,\n        Float,\n        Float16,\n        Float32,\n        Float64,\n        Int,\n        Int8,\n        Int16,\n        Int32,\n        Int64,\n        UInt8,\n        UInt16,\n        UInt32,\n        UInt64,\n        INT8,\n        INT16,\n        INT32,\n        INT64,\n        UINT8,\n        UINT16,\n        UINT32,\n        UINT64,\n        Object,\n        String,\n        STRING,\n        Geometry,\n        covariant=True,\n    )\nelse:\n    GenericDtype = TypeVar(  # type: ignore\n        \"GenericDtype\",\n        bool,\n        int,\n        str,\n        float,\n        pd.core.dtypes.base.ExtensionDtype,\n        Bool,\n        Date,\n        DateTime,\n        Decimal,\n        Timedelta,\n        Category,\n        Float,\n        Float16,\n        Float32,\n        Float64,\n        Int,\n        Int8,\n        Int16,\n        Int32,\n        Int64,\n        UInt8,\n        UInt16,\n        UInt32,\n        UInt64,\n        INT8,\n        INT16,\n        INT32,\n        INT64,\n        UINT8,\n        UINT16,\n        UINT32,\n        UINT64,\n        Object,\n        String,\n        STRING,\n        covariant=True,\n    )\n\nSchema = TypeVar(\"Schema\", bound=\"SchemaModel\")  # type: ignore\n\n\n# pylint:disable=invalid-name\nif TYPE_CHECKING:\n    T = TypeVar(\"T\")  # pragma: no cover\nelse:\n    T = Schema\n\n\nclass DataFrameBase(Generic[T]):\n    # pylint: disable=too-few-public-methods\n    \"\"\"\n    Pandera Dataframe base class for validating dataframes on\n    initialization.\n    \"\"\"\n\n    default_dtype: Optional[Type] = None\n\n    def __setattr__(self, name: str, value: Any) -> None:\n        # pylint: disable=no-member\n        object.__setattr__(self, name, value)\n        if name == \"__orig_class__\":\n            orig_class = getattr(self, \"__orig_class__\")\n            class_args = getattr(orig_class, \"__args__\", None)\n            if class_args is not None and any(\n                x.__name__ == \"SchemaModel\"\n                for x in inspect.getmro(class_args[0])\n            ):\n                schema_model = value.__args__[0]\n\n            # prevent the double validation problem by preventing checks for\n            # dataframes with a defined pandera.schema\n            pandera_accessor = getattr(self, \"pandera\")\n            if (\n                pandera_accessor.schema is None\n                or pandera_accessor.schema != schema_model.to_schema()\n            ):\n                pandera_accessor.add_schema(schema_model.to_schema())\n                self.__dict__ = schema_model.validate(self).__dict__\n\n\n# pylint:disable=too-few-public-methods\nclass SeriesBase(Generic[GenericDtype]):\n    \"\"\"Pandera Series base class to use for all pandas-like APIs.\"\"\"\n\n    default_dtype: Optional[Type] = None\n\n    def __get__(\n        self, instance: object, owner: Type\n    ) -> str:  # pragma: no cover\n        raise AttributeError(\"Series should resolve to Field-s\")\n\n\n# pylint:disable=too-few-public-methods\nclass IndexBase(Generic[GenericDtype]):\n    \"\"\"Representation of pandas.Index, only used for type annotation.\n\n    *new in 0.5.0*\n    \"\"\"\n\n    default_dtype: Optional[Type] = None\n\n    def __get__(\n        self, instance: object, owner: Type\n    ) -> str:  # pragma: no cover\n        raise AttributeError(\"Indexes should resolve to pa.Index-s\")\n\n\nclass AnnotationInfo:  # pylint:disable=too-few-public-methods\n    \"\"\"Captures extra information about an annotation.\n\n    Attributes:\n        origin: The non-parameterized generic class.\n        arg: The first generic type (SchemaModel does not support more than\n            1 argument).\n        literal: Whether the annotation is a literal.\n        optional: Whether the annotation is optional.\n        raw_annotation: The raw annotation.\n        metadata: Extra arguments passed to :data:`typing.Annotated`.\n    \"\"\"\n\n    def __init__(self, raw_annotation: Type) -> None:\n        self._parse_annotation(raw_annotation)\n\n    @property\n    def is_generic_df(self) -> bool:\n        \"\"\"True if the annotation is a DataFrameBase subclass.\"\"\"\n        try:\n            if self.origin is None:\n                return False\n            return issubclass(self.origin, DataFrameBase)\n        except TypeError:\n            return False\n\n    def _parse_annotation(self, raw_annotation: Type) -> None:\n        \"\"\"Parse key information from annotation.\n\n        :param annotation: A subscripted type.\n        :returns: Annotation\n        \"\"\"\n        self.raw_annotation = raw_annotation\n        self.origin = self.arg = None\n\n        self.optional = typing_inspect.is_optional_type(raw_annotation)\n        if self.optional and typing_inspect.is_union_type(raw_annotation):\n            # Annotated with Optional or Union[..., NoneType]\n            # get_args -> (pandera.typing.Index[str], <class 'NoneType'>)\n            raw_annotation = typing_inspect.get_args(raw_annotation)[0]\n\n        self.origin = typing_inspect.get_origin(raw_annotation)\n        # Replace empty tuple returned from get_args by None\n        args = typing_inspect.get_args(raw_annotation) or None\n        self.arg = args[0] if args else args\n\n        self.metadata = getattr(self.arg, \"__metadata__\", None)\n        if self.metadata:\n            self.arg = typing_inspect.get_args(self.arg)[0]\n\n        self.literal = typing_inspect.is_literal_type(self.arg)\n        if self.literal:\n            self.arg = typing_inspect.get_args(self.arg)[0]\n\n        self.default_dtype = getattr(raw_annotation, \"default_dtype\", None)\n", "path": "pandera/typing/common.py"}], "after_files": [{"content": "\"\"\"Common typing functionality.\"\"\"\n# pylint:disable=abstract-method,disable=too-many-ancestors\n\nimport inspect\nfrom typing import TYPE_CHECKING, Any, Generic, Optional, Type, TypeVar, Union\n\nimport pandas as pd\nimport typing_inspect\n\nfrom .. import dtypes\nfrom ..engines import numpy_engine, pandas_engine\n\nBool = dtypes.Bool  #: ``\"bool\"`` numpy dtype\nDate = dtypes.Date  #: ``datetime.date`` object dtype\nDateTime = dtypes.DateTime  #: ``\"datetime64[ns]\"`` numpy dtype\nDecimal = dtypes.Decimal  #: ``decimal.Decimal`` object dtype\nTimedelta = dtypes.Timedelta  #: ``\"timedelta64[ns]\"`` numpy dtype\nCategory = dtypes.Category  #: pandas ``\"categorical\"`` datatype\nFloat = dtypes.Float  #: ``\"float\"`` numpy dtype\nFloat16 = dtypes.Float16  #: ``\"float16\"`` numpy dtype\nFloat32 = dtypes.Float32  #: ``\"float32\"`` numpy dtype\nFloat64 = dtypes.Float64  #: ``\"float64\"`` numpy dtype\nInt = dtypes.Int  #: ``\"int\"`` numpy dtype\nInt8 = dtypes.Int8  #: ``\"int8\"`` numpy dtype\nInt16 = dtypes.Int16  #: ``\"int16\"`` numpy dtype\nInt32 = dtypes.Int32  #: ``\"int32\"`` numpy dtype\nInt64 = dtypes.Int64  #: ``\"int64\"`` numpy dtype\nUInt8 = dtypes.UInt8  #: ``\"uint8\"`` numpy dtype\nUInt16 = dtypes.UInt16  #: ``\"uint16\"`` numpy dtype\nUInt32 = dtypes.UInt32  #: ``\"uint32\"`` numpy dtype\nUInt64 = dtypes.UInt64  #: ``\"uint64\"`` numpy dtype\nINT8 = pandas_engine.INT8  #: ``\"Int8\"`` pandas dtype:: pandas 0.24.0+\nINT16 = pandas_engine.INT16  #: ``\"Int16\"`` pandas dtype: pandas 0.24.0+\nINT32 = pandas_engine.INT32  #: ``\"Int32\"`` pandas dtype: pandas 0.24.0+\nINT64 = pandas_engine.INT64  #: ``\"Int64\"`` pandas dtype: pandas 0.24.0+\nUINT8 = pandas_engine.UINT8  #: ``\"UInt8\"`` pandas dtype:: pandas 0.24.0+\nUINT16 = pandas_engine.UINT16  #: ``\"UInt16\"`` pandas dtype: pandas 0.24.0+\nUINT32 = pandas_engine.UINT32  #: ``\"UInt32\"`` pandas dtype: pandas 0.24.0+\nUINT64 = pandas_engine.UINT64  #: ``\"UInt64\"`` pandas dtype: pandas 0.24.0+\nObject = numpy_engine.Object  #: ``\"object\"`` numpy dtype\nString = dtypes.String  #: ``\"str\"`` numpy dtype\n#: ``\"string\"`` pandas dtypes: pandas 1.0.0+. For <1.0.0, this enum will\n#: fall back on the str-as-object-array representation.\nSTRING = pandas_engine.STRING  #: ``\"str\"`` numpy dtype\nBOOL = pandas_engine.BOOL  #: ``\"str\"`` numpy dtype\n\ntry:\n    Geometry = pandas_engine.Geometry  # : ``\"geometry\"`` geopandas dtype\n    GEOPANDAS_INSTALLED = True\nexcept AttributeError:\n    GEOPANDAS_INSTALLED = False\n\nif GEOPANDAS_INSTALLED:\n    GenericDtype = TypeVar(  # type: ignore\n        \"GenericDtype\",\n        bound=Union[\n            bool,\n            int,\n            str,\n            float,\n            pd.core.dtypes.base.ExtensionDtype,\n            Bool,\n            Date,\n            DateTime,\n            Decimal,\n            Timedelta,\n            Category,\n            Float,\n            Float16,\n            Float32,\n            Float64,\n            Int,\n            Int8,\n            Int16,\n            Int32,\n            Int64,\n            UInt8,\n            UInt16,\n            UInt32,\n            UInt64,\n            INT8,\n            INT16,\n            INT32,\n            INT64,\n            UINT8,\n            UINT16,\n            UINT32,\n            UINT64,\n            Object,\n            String,\n            STRING,\n            Geometry,\n        ],\n    )\nelse:\n    GenericDtype = TypeVar(  # type: ignore\n        \"GenericDtype\",\n        bound=Union[\n            bool,\n            int,\n            str,\n            float,\n            pd.core.dtypes.base.ExtensionDtype,\n            Bool,\n            Date,\n            DateTime,\n            Decimal,\n            Timedelta,\n            Category,\n            Float,\n            Float16,\n            Float32,\n            Float64,\n            Int,\n            Int8,\n            Int16,\n            Int32,\n            Int64,\n            UInt8,\n            UInt16,\n            UInt32,\n            UInt64,\n            INT8,\n            INT16,\n            INT32,\n            INT64,\n            UINT8,\n            UINT16,\n            UINT32,\n            UINT64,\n            Object,\n            String,\n            STRING,\n        ],\n    )\n\nSchema = TypeVar(\"Schema\", bound=\"SchemaModel\")  # type: ignore\n\n\n# pylint:disable=invalid-name\nif TYPE_CHECKING:\n    T = TypeVar(\"T\")  # pragma: no cover\nelse:\n    T = Schema\n\n\nclass DataFrameBase(Generic[T]):\n    # pylint: disable=too-few-public-methods\n    \"\"\"\n    Pandera Dataframe base class for validating dataframes on\n    initialization.\n    \"\"\"\n\n    default_dtype: Optional[Type] = None\n\n    def __setattr__(self, name: str, value: Any) -> None:\n        # pylint: disable=no-member\n        object.__setattr__(self, name, value)\n        if name == \"__orig_class__\":\n            orig_class = getattr(self, \"__orig_class__\")\n            class_args = getattr(orig_class, \"__args__\", None)\n            if class_args is not None and any(\n                x.__name__ == \"SchemaModel\"\n                for x in inspect.getmro(class_args[0])\n            ):\n                schema_model = value.__args__[0]\n\n            # prevent the double validation problem by preventing checks for\n            # dataframes with a defined pandera.schema\n            pandera_accessor = getattr(self, \"pandera\")\n            if (\n                pandera_accessor.schema is None\n                or pandera_accessor.schema != schema_model.to_schema()\n            ):\n                pandera_accessor.add_schema(schema_model.to_schema())\n                self.__dict__ = schema_model.validate(self).__dict__\n\n\n# pylint:disable=too-few-public-methods\nclass SeriesBase(Generic[GenericDtype]):\n    \"\"\"Pandera Series base class to use for all pandas-like APIs.\"\"\"\n\n    default_dtype: Optional[Type] = None\n\n    def __get__(\n        self, instance: object, owner: Type\n    ) -> str:  # pragma: no cover\n        raise AttributeError(\"Series should resolve to Field-s\")\n\n\n# pylint:disable=too-few-public-methods\nclass IndexBase(Generic[GenericDtype]):\n    \"\"\"Representation of pandas.Index, only used for type annotation.\n\n    *new in 0.5.0*\n    \"\"\"\n\n    default_dtype: Optional[Type] = None\n\n    def __get__(\n        self, instance: object, owner: Type\n    ) -> str:  # pragma: no cover\n        raise AttributeError(\"Indexes should resolve to pa.Index-s\")\n\n\nclass AnnotationInfo:  # pylint:disable=too-few-public-methods\n    \"\"\"Captures extra information about an annotation.\n\n    Attributes:\n        origin: The non-parameterized generic class.\n        arg: The first generic type (SchemaModel does not support more than\n            1 argument).\n        literal: Whether the annotation is a literal.\n        optional: Whether the annotation is optional.\n        raw_annotation: The raw annotation.\n        metadata: Extra arguments passed to :data:`typing.Annotated`.\n    \"\"\"\n\n    def __init__(self, raw_annotation: Type) -> None:\n        self._parse_annotation(raw_annotation)\n\n    @property\n    def is_generic_df(self) -> bool:\n        \"\"\"True if the annotation is a DataFrameBase subclass.\"\"\"\n        try:\n            if self.origin is None:\n                return False\n            return issubclass(self.origin, DataFrameBase)\n        except TypeError:\n            return False\n\n    def _parse_annotation(self, raw_annotation: Type) -> None:\n        \"\"\"Parse key information from annotation.\n\n        :param annotation: A subscripted type.\n        :returns: Annotation\n        \"\"\"\n        self.raw_annotation = raw_annotation\n        self.origin = self.arg = None\n\n        self.optional = typing_inspect.is_optional_type(raw_annotation)\n        if self.optional and typing_inspect.is_union_type(raw_annotation):\n            # Annotated with Optional or Union[..., NoneType]\n            # get_args -> (pandera.typing.Index[str], <class 'NoneType'>)\n            raw_annotation = typing_inspect.get_args(raw_annotation)[0]\n\n        self.origin = typing_inspect.get_origin(raw_annotation)\n        # Replace empty tuple returned from get_args by None\n        args = typing_inspect.get_args(raw_annotation) or None\n        self.arg = args[0] if args else args\n\n        self.metadata = getattr(self.arg, \"__metadata__\", None)\n        if self.metadata:\n            self.arg = typing_inspect.get_args(self.arg)[0]\n\n        self.literal = typing_inspect.is_literal_type(self.arg)\n        if self.literal:\n            self.arg = typing_inspect.get_args(self.arg)[0]\n\n        self.default_dtype = getattr(raw_annotation, \"default_dtype\", None)\n", "path": "pandera/typing/common.py"}]}