1616
1717from __future__ import annotations
1818
19- import typing
20- from typing import Mapping , Optional
19+ from typing import cast , Mapping , Optional
2120
2221from google .cloud import bigquery
2322
@@ -79,7 +78,7 @@ def predict(self, X: utils.ArrayType) -> bpd.DataFrame:
7978 if self .model_path is None :
8079 raise ValueError ("Model GCS path must be provided." )
8180 self ._bqml_model = self ._create_bqml_model ()
82- self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
81+ self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
8382
8483 (X ,) = utils .batch_convert_to_dataframe (X )
8584
@@ -100,7 +99,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> TensorFlowModel:
10099 if self .model_path is None :
101100 raise ValueError ("Model GCS path must be provided." )
102101 self ._bqml_model = self ._create_bqml_model ()
103- self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
102+ self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
104103
105104 new_model = self ._bqml_model .copy (model_name , replace )
106105 return new_model .session .read_gbq_model (model_name )
@@ -158,7 +157,7 @@ def predict(self, X: utils.ArrayType) -> bpd.DataFrame:
158157 if self .model_path is None :
159158 raise ValueError ("Model GCS path must be provided." )
160159 self ._bqml_model = self ._create_bqml_model ()
161- self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
160+ self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
162161
163162 (X ,) = utils .batch_convert_to_dataframe (X , session = self ._bqml_model .session )
164163
@@ -179,7 +178,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> ONNXModel:
179178 if self .model_path is None :
180179 raise ValueError ("Model GCS path must be provided." )
181180 self ._bqml_model = self ._create_bqml_model ()
182- self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
181+ self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
183182
184183 new_model = self ._bqml_model .copy (model_name , replace )
185184 return new_model .session .read_gbq_model (model_name )
@@ -277,7 +276,7 @@ def predict(self, X: utils.ArrayType) -> bpd.DataFrame:
277276 if self .model_path is None :
278277 raise ValueError ("Model GCS path must be provided." )
279278 self ._bqml_model = self ._create_bqml_model ()
280- self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
279+ self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
281280
282281 (X ,) = utils .batch_convert_to_dataframe (X , session = self ._bqml_model .session )
283282
@@ -298,7 +297,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> XGBoostModel:
298297 if self .model_path is None :
299298 raise ValueError ("Model GCS path must be provided." )
300299 self ._bqml_model = self ._create_bqml_model ()
301- self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
300+ self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
302301
303302 new_model = self ._bqml_model .copy (model_name , replace )
304303 return new_model .session .read_gbq_model (model_name )
0 commit comments