@@ -211,13 +211,13 @@ def from_dict(cls, data, app=None):
211211 tflite_format = TFLiteFormat .from_dict (tflite_format_data )
212212 model = Model (model_format = tflite_format )
213213 model ._data = data_copy # pylint: disable=protected-access
214- model ._app = app # pylint: disable=protected-access
214+ model ._app = app # pylint: disable=protected-access
215215 return model
216216
217217 def _update_from_dict (self , data ):
218218 copy = Model .from_dict (data )
219219 self .model_format = copy .model_format
220- self ._data = copy ._data # pylint: disable=protected-access
220+ self ._data = copy ._data # pylint: disable=protected-access
221221
222222 def __eq__ (self , other ):
223223 if isinstance (other , self .__class__ ):
@@ -334,7 +334,7 @@ def model_format(self):
334334 def model_format (self , model_format ):
335335 if model_format is not None :
336336 _validate_model_format (model_format )
337- self ._model_format = model_format #Can be None
337+ self ._model_format = model_format # Can be None
338338 return self
339339
340340 def as_dict (self , for_upload = False ):
@@ -370,7 +370,7 @@ def from_dict(cls, data):
370370 """Create an instance of the object from a dict."""
371371 data_copy = dict (data )
372372 tflite_format = TFLiteFormat (model_source = cls ._init_model_source (data_copy ))
373- tflite_format ._data = data_copy # pylint: disable=protected-access
373+ tflite_format ._data = data_copy # pylint: disable=protected-access
374374 return tflite_format
375375
376376 def __eq__ (self , other ):
@@ -405,7 +405,7 @@ def model_source(self, model_source):
405405 if model_source is not None :
406406 if not isinstance (model_source , TFLiteModelSource ):
407407 raise TypeError ('Model source must be a TFLiteModelSource object.' )
408- self ._model_source = model_source # Can be None
408+ self ._model_source = model_source # Can be None
409409
410410 @property
411411 def size_bytes (self ):
@@ -485,7 +485,7 @@ def __init__(self, gcs_tflite_uri, app=None):
485485
486486 def __eq__ (self , other ):
487487 if isinstance (other , self .__class__ ):
488- return self ._gcs_tflite_uri == other ._gcs_tflite_uri # pylint: disable=protected-access
488+ return self ._gcs_tflite_uri == other ._gcs_tflite_uri # pylint: disable=protected-access
489489 return False
490490
491491 def __ne__ (self , other ):
@@ -775,7 +775,7 @@ def _validate_display_name(display_name):
775775
776776def _validate_tags (tags ):
777777 if not isinstance (tags , list ) or not \
778- all (isinstance (tag , str ) for tag in tags ):
778+ all (isinstance (tag , str ) for tag in tags ):
779779 raise TypeError ('Tags must be a list of strings.' )
780780 if not all (_TAG_PATTERN .match (tag ) for tag in tags ):
781781 raise ValueError ('Tag format is invalid.' )
@@ -789,6 +789,7 @@ def _validate_gcs_tflite_uri(uri):
789789 raise ValueError ('GCS TFLite URI format is invalid.' )
790790 return uri
791791
792+
792793def _validate_auto_ml_model (model ):
793794 if not _AUTO_ML_MODEL_PATTERN .match (model ):
794795 raise ValueError ('Model resource name format is invalid.' )
@@ -809,7 +810,7 @@ def _validate_list_filter(list_filter):
809810
810811def _validate_page_size (page_size ):
811812 if page_size is not None :
812- if type (page_size ) is not int : # pylint: disable=unidiomatic-typecheck
813+ if type (page_size ) is not int : # pylint: disable=unidiomatic-typecheck
813814 # Specifically type() to disallow boolean which is a subtype of int
814815 raise TypeError ('Page size must be a number or None.' )
815816 if page_size < 1 or page_size > _MAX_PAGE_SIZE :
@@ -864,7 +865,7 @@ def _exponential_backoff(self, current_attempt, stop_time):
864865
865866 if stop_time is not None :
866867 max_seconds_left = (stop_time - datetime .datetime .now ()).total_seconds ()
867- if max_seconds_left < 1 : # allow a bit of time for rpc
868+ if max_seconds_left < 1 : # allow a bit of time for rpc
868869 raise exceptions .DeadlineExceededError ('Polling max time exceeded.' )
869870 wait_time_seconds = min (wait_time_seconds , max_seconds_left - 1 )
870871 time .sleep (wait_time_seconds )
@@ -925,7 +926,6 @@ def handle_operation(self, operation, wait_for_operation=False, max_time_seconds
925926 # If the operation is not complete or timed out, return a (locked) model instead
926927 return get_model (model_id ).as_dict ()
927928
928-
929929 def create_model (self , model ):
930930 _validate_model (model )
931931 try :
0 commit comments