1313# limitations under the License.
1414from __future__ import annotations
1515
16- from typing import Any , Callable , Dict , Type , Union , Optional
17- from typing_extensions import TypeAlias
16+ from typing import Any , Callable , Dict , Type , Optional , Union
1817
1918from google .protobuf .message import Message
2019from google .protobuf .internal .enum_type_wrapper import EnumTypeWrapper
@@ -44,8 +43,8 @@ def _parse_array_type(
4443 value : PBValue ,
4544 metadata_type : SqlType .Array ,
4645 column_name : str | None ,
47- column_info : dict [str , Union [ Message , EnumTypeWrapper ] ] | None = None ,
48- ) -> Any :
46+ column_info : dict [str , Message | EnumTypeWrapper ] | None = None ,
47+ ) -> list [ Any ] :
4948 """
5049 used for parsing an array represented as a protobuf to a python list.
5150 """
@@ -63,8 +62,8 @@ def _parse_map_type(
6362 value : PBValue ,
6463 metadata_type : SqlType .Map ,
6564 column_name : str | None ,
66- column_info : dict [str , Union [ Message , EnumTypeWrapper ] ] | None = None ,
67- ) -> Any :
65+ column_info : dict [str , Message | EnumTypeWrapper ] | None = None ,
66+ ) -> dict [ Any , Any ] :
6867 """
6968 used for parsing a map represented as a protobuf to a python dict.
7069
@@ -104,7 +103,7 @@ def _parse_struct_type(
104103 value : PBValue ,
105104 metadata_type : SqlType .Struct ,
106105 column_name : str | None ,
107- column_info : dict [str , Union [ Message , EnumTypeWrapper ] ] | None = None ,
106+ column_info : dict [str , Message | EnumTypeWrapper ] | None = None ,
108107) -> Struct :
109108 """
110109 used for parsing a struct represented as a protobuf to a
@@ -138,7 +137,7 @@ def _parse_timestamp_type(
138137 value : PBValue ,
139138 metadata_type : SqlType .Timestamp ,
140139 column_name : str | None ,
141- column_info : dict [str , Union [ Message , EnumTypeWrapper ] ] | None = None ,
140+ column_info : dict [str , Message | EnumTypeWrapper ] | None = None ,
142141) -> DatetimeWithNanoseconds :
143142 """
144143 used for parsing a timestamp represented as a protobuf to DatetimeWithNanoseconds
@@ -150,7 +149,7 @@ def _parse_proto_type(
150149 value : PBValue ,
151150 metadata_type : SqlType .Proto ,
152151 column_name : str | None ,
153- column_info : dict [str , Union [ Message , EnumTypeWrapper ] ] | None = None ,
152+ column_info : dict [str , Message | EnumTypeWrapper ] | None = None ,
154153) -> Message | bytes :
155154 """
156155 Parses a serialized protobuf message into a Message object using type information
@@ -188,7 +187,7 @@ def _parse_enum_type(
188187 value : PBValue ,
189188 metadata_type : SqlType .Enum ,
190189 column_name : str | None ,
191- column_info : dict [str , Union [ Message , EnumTypeWrapper ] ] | None = None ,
190+ column_info : dict [str , Message | EnumTypeWrapper ] | None = None ,
192191) -> int | str :
193192 """
194193 Parses an integer value into a Protobuf enum name string using type information
@@ -221,7 +220,7 @@ def _parse_enum_type(
221220 return value .int_value
222221
223222
224- ParserCallable : TypeAlias = Callable [
223+ ParserCallable = Callable [
225224 [PBValue , Any , Optional [str ], Optional [Dict [str , Union [Message , EnumTypeWrapper ]]]],
226225 Any ,
227226]
@@ -240,7 +239,7 @@ def _parse_pb_value_to_python_value(
240239 value : PBValue ,
241240 metadata_type : SqlType .Type ,
242241 column_name : str | None ,
243- column_info : dict [str , Union [ Message , EnumTypeWrapper ] ] | None = None ,
242+ column_info : dict [str , Message | EnumTypeWrapper ] | None = None ,
244243) -> Any :
245244 """
246245 used for converting the value represented as a protobufs to a python object.
0 commit comments