@@ -211,13 +211,13 @@ def from_dict(cls, data, app=None):
|
211 | 211 | tflite_format = TFLiteFormat.from_dict(tflite_format_data)
|
212 | 212 | model = Model(model_format=tflite_format)
|
213 | 213 | model._data = data_copy # pylint: disable=protected-access
|
214 |
| -model._app = app # pylint: disable=protected-access |
| 214 | +model._app = app # pylint: disable=protected-access |
215 | 215 | return model
|
216 | 216 |
|
217 | 217 | def _update_from_dict(self, data):
|
218 | 218 | copy = Model.from_dict(data)
|
219 | 219 | self.model_format = copy.model_format
|
220 |
| -self._data = copy._data # pylint: disable=protected-access |
| 220 | +self._data = copy._data # pylint: disable=protected-access |
221 | 221 |
|
222 | 222 | def __eq__(self, other):
|
223 | 223 | if isinstance(other, self.__class__):
|
@@ -334,7 +334,7 @@ def model_format(self):
|
334 | 334 | def model_format(self, model_format):
|
335 | 335 | if model_format is not None:
|
336 | 336 | _validate_model_format(model_format)
|
337 |
| -self._model_format = model_format #Can be None |
| 337 | +self._model_format = model_format # Can be None |
338 | 338 | return self
|
339 | 339 |
|
340 | 340 | def as_dict(self, for_upload=False):
|
@@ -370,7 +370,7 @@ def from_dict(cls, data):
|
370 | 370 | """Create an instance of the object from a dict."""
|
371 | 371 | data_copy = dict(data)
|
372 | 372 | 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 |
374 | 374 | return tflite_format
|
375 | 375 |
|
376 | 376 | def __eq__(self, other):
|
@@ -405,7 +405,7 @@ def model_source(self, model_source):
|
405 | 405 | if model_source is not None:
|
406 | 406 | if not isinstance(model_source, TFLiteModelSource):
|
407 | 407 | 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 |
409 | 409 |
|
410 | 410 | @property
|
411 | 411 | def size_bytes(self):
|
@@ -485,7 +485,7 @@ def __init__(self, gcs_tflite_uri, app=None):
|
485 | 485 |
|
486 | 486 | def __eq__(self, other):
|
487 | 487 | 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 |
489 | 489 | return False
|
490 | 490 |
|
491 | 491 | def __ne__(self, other):
|
@@ -775,7 +775,7 @@ def _validate_display_name(display_name):
|
775 | 775 |
|
776 | 776 | def _validate_tags(tags):
|
777 | 777 | 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): |
779 | 779 | raise TypeError('Tags must be a list of strings.')
|
780 | 780 | if not all(_TAG_PATTERN.match(tag) for tag in tags):
|
781 | 781 | raise ValueError('Tag format is invalid.')
|
@@ -789,6 +789,7 @@ def _validate_gcs_tflite_uri(uri):
|
789 | 789 | raise ValueError('GCS TFLite URI format is invalid.')
|
790 | 790 | return uri
|
791 | 791 |
|
| 792 | + |
792 | 793 | def _validate_auto_ml_model(model):
|
793 | 794 | if not _AUTO_ML_MODEL_PATTERN.match(model):
|
794 | 795 | raise ValueError('Model resource name format is invalid.')
|
@@ -809,7 +810,7 @@ def _validate_list_filter(list_filter):
|
809 | 810 |
|
810 | 811 | def _validate_page_size(page_size):
|
811 | 812 | 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 |
813 | 814 | # Specifically type() to disallow boolean which is a subtype of int
|
814 | 815 | raise TypeError('Page size must be a number or None.')
|
815 | 816 | if page_size < 1 or page_size > _MAX_PAGE_SIZE:
|
@@ -864,7 +865,7 @@ def _exponential_backoff(self, current_attempt, stop_time):
|
864 | 865 |
|
865 | 866 | if stop_time is not None:
|
866 | 867 | 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 |
868 | 869 | raise exceptions.DeadlineExceededError('Polling max time exceeded.')
|
869 | 870 | wait_time_seconds = min(wait_time_seconds, max_seconds_left - 1)
|
870 | 871 | time.sleep(wait_time_seconds)
|
@@ -925,7 +926,6 @@ def handle_operation(self, operation, wait_for_operation=False, max_time_seconds
|
925 | 926 | # If the operation is not complete or timed out, return a (locked) model instead
|
926 | 927 | return get_model(model_id).as_dict()
|
927 | 928 |
|
928 |
| - |
929 | 929 | def create_model(self, model):
|
930 | 930 | _validate_model(model)
|
931 | 931 | try:
|
|
0 commit comments