1313# limitations under the License.
1414
1515# Pandas Extension Types
16+ from __future__ import annotations
1617
1718import numbers
1819import re
19- from typing import Union
2020
2121import numpy as np
2222import pandas as pd
@@ -38,7 +38,7 @@ class PandasBSONDtype(ExtensionDtype):
3838 def name (self ) -> str :
3939 return f"bson_{ self .__class__ .__name__ } "
4040
41- def __from_arrow__ (self , array : Union [ pa .Array , pa .ChunkedArray ] ) -> ExtensionArray :
41+ def __from_arrow__ (self , array : pa .Array | pa .ChunkedArray ) -> ExtensionArray :
4242 chunks = [array ] if isinstance (array , pa .Array ) else array .chunks
4343
4444 arr_type = self .construct_array_type ()
@@ -204,7 +204,7 @@ def name(self) -> str:
204204 return f"bson_{ self .type .__name__ } [{ self .subtype } ]"
205205
206206 @classmethod
207- def construct_array_type (cls ) -> type [" PandasBinaryArray" ]:
207+ def construct_array_type (cls ) -> type [PandasBinaryArray ]:
208208 return PandasBinaryArray
209209
210210 @classmethod
@@ -242,7 +242,7 @@ class PandasObjectId(PandasBSONDtype):
242242 type = ObjectId
243243
244244 @classmethod
245- def construct_array_type (cls ) -> type [" PandasObjectIdArray" ]:
245+ def construct_array_type (cls ) -> type [PandasObjectIdArray ]:
246246 return PandasObjectIdArray
247247
248248
@@ -266,7 +266,7 @@ class PandasDecimal128(PandasBSONDtype):
266266 type = Decimal128
267267
268268 @classmethod
269- def construct_array_type (cls ) -> type [" PandasDecimal128Array" ]:
269+ def construct_array_type (cls ) -> type [PandasDecimal128Array ]:
270270 return PandasDecimal128Array
271271
272272
@@ -290,7 +290,7 @@ class PandasCode(PandasBSONDtype):
290290 type = Code
291291
292292 @classmethod
293- def construct_array_type (cls ) -> type [" PandasCodeArray" ]:
293+ def construct_array_type (cls ) -> type [PandasCodeArray ]:
294294 return PandasCodeArray
295295
296296
0 commit comments