1616
1717from __future__ import annotations
1818
19- from typing import cast , Mapping , Optional
19+ import typing
20+ from typing import Mapping , Optional
2021
2122from google .cloud import bigquery
2223
@@ -78,7 +79,7 @@ def predict(self, X: utils.ArrayType) -> bpd.DataFrame:
7879 if self .model_path is None :
7980 raise ValueError ("Model GCS path must be provided." )
8081 self ._bqml_model = self ._create_bqml_model ()
81- self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
82+ self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
8283
8384 (X ,) = utils .batch_convert_to_dataframe (X )
8485
@@ -99,7 +100,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> TensorFlowModel:
99100 if self .model_path is None :
100101 raise ValueError ("Model GCS path must be provided." )
101102 self ._bqml_model = self ._create_bqml_model ()
102- self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
103+ self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
103104
104105 new_model = self ._bqml_model .copy (model_name , replace )
105106 return new_model .session .read_gbq_model (model_name )
@@ -157,7 +158,7 @@ def predict(self, X: utils.ArrayType) -> bpd.DataFrame:
157158 if self .model_path is None :
158159 raise ValueError ("Model GCS path must be provided." )
159160 self ._bqml_model = self ._create_bqml_model ()
160- self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
161+ self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
161162
162163 (X ,) = utils .batch_convert_to_dataframe (X , session = self ._bqml_model .session )
163164
@@ -178,7 +179,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> ONNXModel:
178179 if self .model_path is None :
179180 raise ValueError ("Model GCS path must be provided." )
180181 self ._bqml_model = self ._create_bqml_model ()
181- self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
182+ self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
182183
183184 new_model = self ._bqml_model .copy (model_name , replace )
184185 return new_model .session .read_gbq_model (model_name )
@@ -276,7 +277,7 @@ def predict(self, X: utils.ArrayType) -> bpd.DataFrame:
276277 if self .model_path is None :
277278 raise ValueError ("Model GCS path must be provided." )
278279 self ._bqml_model = self ._create_bqml_model ()
279- self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
280+ self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
280281
281282 (X ,) = utils .batch_convert_to_dataframe (X , session = self ._bqml_model .session )
282283
@@ -297,7 +298,7 @@ def to_gbq(self, model_name: str, replace: bool = False) -> XGBoostModel:
297298 if self .model_path is None :
298299 raise ValueError ("Model GCS path must be provided." )
299300 self ._bqml_model = self ._create_bqml_model ()
300- self ._bqml_model = cast (core .BqmlModel , self ._bqml_model )
301+ self ._bqml_model = typing . cast (core .BqmlModel , self ._bqml_model )
301302
302303 new_model = self ._bqml_model .copy (model_name , replace )
303304 return new_model .session .read_gbq_model (model_name )
0 commit comments