@@ -210,13 +210,13 @@ def from_dict(cls, data, app=None):
210210 tflite_format = TFLiteFormat .from_dict (tflite_format_data )
211211 model = Model (model_format = tflite_format )
212212 model ._data = data_copy # pylint: disable=protected-access
213- model ._app = app # pylint: disable=protected-access
213+ model ._app = app # pylint: disable=protected-access
214214 return model
215215
216216 def _update_from_dict (self , data ):
217217 copy = Model .from_dict (data )
218218 self .model_format = copy .model_format
219- self ._data = copy ._data # pylint: disable=protected-access
219+ self ._data = copy ._data # pylint: disable=protected-access
220220
221221 def __eq__ (self , other ):
222222 if isinstance (other , self .__class__ ):
@@ -333,7 +333,7 @@ def model_format(self):
333333 def model_format (self , model_format ):
334334 if model_format is not None :
335335 _validate_model_format (model_format )
336- self ._model_format = model_format #Can be None
336+ self ._model_format = model_format # Can be None
337337 return self
338338
339339 def as_dict (self , for_upload = False ):
@@ -369,7 +369,7 @@ def from_dict(cls, data):
369369 """Create an instance of the object from a dict."""
370370 data_copy = dict (data )
371371 tflite_format = TFLiteFormat (model_source = cls ._init_model_source (data_copy ))
372- tflite_format ._data = data_copy # pylint: disable=protected-access
372+ tflite_format ._data = data_copy # pylint: disable=protected-access
373373 return tflite_format
374374
375375 def __eq__ (self , other ):
@@ -401,7 +401,7 @@ def model_source(self, model_source):
401401 if model_source is not None :
402402 if not isinstance (model_source , TFLiteModelSource ):
403403 raise TypeError ('Model source must be a TFLiteModelSource object.' )
404- self ._model_source = model_source # Can be None
404+ self ._model_source = model_source # Can be None
405405
406406 @property
407407 def size_bytes (self ):
@@ -481,7 +481,7 @@ def __init__(self, gcs_tflite_uri, app=None):
481481
482482 def __eq__ (self , other ):
483483 if isinstance (other , self .__class__ ):
484- return self ._gcs_tflite_uri == other ._gcs_tflite_uri # pylint: disable=protected-access
484+ return self ._gcs_tflite_uri == other ._gcs_tflite_uri # pylint: disable=protected-access
485485 return False
486486
487487 def __ne__ (self , other ):
@@ -766,7 +766,7 @@ def _validate_display_name(display_name):
766766
767767def _validate_tags (tags ):
768768 if not isinstance (tags , list ) or not \
769- all (isinstance (tag , str ) for tag in tags ):
769+ all (isinstance (tag , str ) for tag in tags ):
770770 raise TypeError ('Tags must be a list of strings.' )
771771 if not all (_TAG_PATTERN .match (tag ) for tag in tags ):
772772 raise ValueError ('Tag format is invalid.' )
@@ -780,6 +780,7 @@ def _validate_gcs_tflite_uri(uri):
780780 raise ValueError ('GCS TFLite URI format is invalid.' )
781781 return uri
782782
783+
783784def _validate_auto_ml_model (model ):
784785 if not _AUTO_ML_MODEL_PATTERN .match (model ):
785786 raise ValueError ('Model resource name format is invalid.' )
@@ -800,7 +801,7 @@ def _validate_list_filter(list_filter):
800801
801802def _validate_page_size (page_size ):
802803 if page_size is not None :
803- if type (page_size ) is not int : # pylint: disable=unidiomatic-typecheck
804+ if type (page_size ) is not int : # pylint: disable=unidiomatic-typecheck
804805 # Specifically type() to disallow boolean which is a subtype of int
805806 raise TypeError ('Page size must be a number or None.' )
806807 if page_size < 1 or page_size > _MAX_PAGE_SIZE :
@@ -855,7 +856,7 @@ def _exponential_backoff(self, current_attempt, stop_time):
855856
856857 if stop_time is not None :
857858 max_seconds_left = (stop_time - datetime .datetime .now ()).total_seconds ()
858- if max_seconds_left < 1 : # allow a bit of time for rpc
859+ if max_seconds_left < 1 : # allow a bit of time for rpc
859860 raise exceptions .DeadlineExceededError ('Polling max time exceeded.' )
860861 wait_time_seconds = min (wait_time_seconds , max_seconds_left - 1 )
861862 time .sleep (wait_time_seconds )
@@ -916,7 +917,6 @@ def handle_operation(self, operation, wait_for_operation=False, max_time_seconds
916917 # If the operation is not complete or timed out, return a (locked) model instead
917918 return get_model (model_id ).as_dict ()
918919
919-
920920 def create_model (self , model ):
921921 _validate_model (model )
922922 try :
0 commit comments