Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit ef2b323

Browse files
author
Jim Fulton
committed
using match.groups() throws off pytypes, also fix some type hints.
1 parent 411c336 commit ef2b323

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

google/cloud/bigquery/dbapi/_helpers.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import functools
2020
import numbers
2121
import re
22+
import typing
2223

2324
from google.cloud import bigquery
2425
from google.cloud.bigquery import table, enums, query
@@ -156,7 +157,9 @@ def split_struct_fields(fields):
156157
yield field
157158

158159

159-
def complex_query_parameter_type(name: str, type_: str, base: str):
160+
def complex_query_parameter_type(
161+
name: typing.Optional[str], type_: str, base: str
162+
):
160163
type_ = type_.strip()
161164
if "<" not in type_:
162165
# Scalar
@@ -176,7 +179,7 @@ def complex_query_parameter_type(name: str, type_: str, base: str):
176179
m = complex_query_parameter_parse(type_)
177180
if not m:
178181
raise exceptions.ProgrammingError(f"Invalid parameter type, {type_}")
179-
tname, sub = m.groups()
182+
tname, sub = m.group(1, 2)
180183
tname = tname.upper()
181184
sub = sub.strip()
182185
if tname == "ARRAY":
@@ -198,7 +201,9 @@ def complex_query_parameter_type(name: str, type_: str, base: str):
198201
return query.StructQueryParameterType(*fields, name=name)
199202

200203

201-
def complex_query_parameter(name, value, type_, base=None):
204+
def complex_query_parameter(
205+
name: typing.Optional[str], value, type_: str, base: typing.Optional[str] = None
206+
):
202207
"""
203208
Construct a query parameter for a complex type (array or struct record)
204209
@@ -224,7 +229,7 @@ def complex_query_parameter(name, value, type_, base=None):
224229
m = complex_query_parameter_parse(type_)
225230
if not m:
226231
raise exceptions.ProgrammingError(f"Invalid parameter type, {type_}")
227-
tname, sub = m.groups()
232+
tname, sub = m.group(1, 2)
228233
tname = tname.upper()
229234
sub = sub.strip()
230235
if tname == "ARRAY":

0 commit comments

Comments
 (0)