GeezerVison is showing github.com — docs: Updated docstrings with exception error classes (#894) · googleapis/python-aiplatform@f9aecd2
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/base.py +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -504,7 +504,7 @@ def _get_and_validate_project_location( | 504 | 504 | location(str): The location of the resource noun. | 505 | 505 |
| 506 | 506 | Raises: | 507 | | - RuntimeError if location is different from resource location | | 507 | + RuntimeError: If location is different from resource location | 508 | 508 | """ | 509 | 509 |
| 510 | 510 | fields = utils.extract_fields_from_resource_name( | @@ -604,7 +604,7 @@ def _assert_gca_resource_is_available(self) -> None: | 604 | 604 | """Helper method to raise when property is not accessible. | 605 | 605 |
| 606 | 606 | Raises: | 607 | | - RuntimeError if _gca_resource is has not been created. | | 607 | + RuntimeError: If _gca_resource is has not been created. | 608 | 608 | """ | 609 | 609 | if self._gca_resource is None: | 610 | 610 | raise RuntimeError( | @@ -1115,7 +1115,7 @@ def _wait_for_resource_creation(self) -> None: | 1115 | 1115 | job.run(sync=False, ...) | 1116 | 1116 | job._wait_for_resource_creation() | 1117 | 1117 | Raises: | 1118 | | - RuntimeError if the resource has not been scheduled to be created. | | 1118 | + RuntimeError: If the resource has not been scheduled to be created. | 1119 | 1119 | """ | 1120 | 1120 |
| 1121 | 1121 | # If the user calls this but didn't actually invoke an API to create | @@ -1141,7 +1141,7 @@ def _assert_gca_resource_is_available(self) -> None: | 1141 | 1141 | resource creation has failed asynchronously. | 1142 | 1142 |
| 1143 | 1143 | Raises: | 1144 | | - RuntimeError when resource has not been created. | | 1144 | + RuntimeError: When resource has not been created. | 1145 | 1145 | """ | 1146 | 1146 | if not getattr(self._gca_resource, "name", None): | 1147 | 1147 | raise RuntimeError( | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/datasets/_datasources.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -71,7 +71,7 @@ def __init__( | 71 | 71 | "bq://project.dataset.table_name" | 72 | 72 |
| 73 | 73 | Raises: | 74 | | - ValueError if source configuration is not valid. | | 74 | + ValueError: If source configuration is not valid. | 75 | 75 | """ | 76 | 76 |
| 77 | 77 | dataset_metadata = None | @@ -215,7 +215,7 @@ def create_datasource( | 215 | 215 | datasource (Datasource) | 216 | 216 |
| 217 | 217 | Raises: | 218 | | - ValueError when below scenarios happen | | 218 | + ValueError: When below scenarios happen: | 219 | 219 | - import_schema_uri is identified for creating TabularDatasource | 220 | 220 | - either import_schema_uri or gcs_source is missing for creating NonTabularDatasourceImportable | 221 | 221 | """ | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/datasets/dataset.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -91,7 +91,7 @@ def _validate_metadata_schema_uri(self) -> None: | 91 | 91 | """Validate the metadata_schema_uri of retrieved dataset resource. | 92 | 92 |
| 93 | 93 | Raises: | 94 | | - ValueError if the dataset type of the retrieved dataset resource is | | 94 | + ValueError: If the dataset type of the retrieved dataset resource is | 95 | 95 | not supported by the class. | 96 | 96 | """ | 97 | 97 | if self._supported_metadata_schema_uris and ( | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/explain/metadata/tf/v1/saved_model_metadata_builder.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -50,7 +50,7 @@ def __init__( | 50 | 50 | signature_name) specifies multiple outputs. | 51 | 51 |
| 52 | 52 | Raises: | 53 | | - ValueError if outputs_to_explain contains more than 1 element or | | 53 | + ValueError: If outputs_to_explain contains more than 1 element or | 54 | 54 | signature contains multiple outputs. | 55 | 55 | """ | 56 | 56 | if outputs_to_explain: | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/explain/metadata/tf/v2/saved_model_metadata_builder.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -49,8 +49,8 @@ def __init__( | 49 | 49 | Any keyword arguments to be passed to tf.saved_model.save() function. | 50 | 50 |
| 51 | 51 | Raises: | 52 | | - ValueError if outputs_to_explain contains more than 1 element. | 53 | | - ImportError if tf is not imported. | | 52 | + ValueError: If outputs_to_explain contains more than 1 element. | | 53 | + ImportError: If tf is not imported. | 54 | 54 | """ | 55 | 55 | if outputs_to_explain and len(outputs_to_explain) > 1: | 56 | 56 | raise ValueError( | @@ -91,7 +91,7 @@ def _infer_metadata_entries_from_model( | 91 | 91 | Inferred input metadata and output metadata from the model. | 92 | 92 |
| 93 | 93 | Raises: | 94 | | - ValueError if specified name is not found in signature outputs. | | 94 | + ValueError: If specified name is not found in signature outputs. | 95 | 95 | """ | 96 | 96 |
| 97 | 97 | loaded_sig = self._loaded_model.signatures[signature_name] | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/jobs.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1049,7 +1049,7 @@ def __init__( | 1049 | 1049 | staging_bucket set in aiplatform.init. | 1050 | 1050 |
| 1051 | 1051 | Raises: | 1052 | | - RuntimeError is not staging bucket was set using aiplatfrom.init and a staging | | 1052 | + RuntimeError: If staging bucket was not set using aiplatform.init and a staging | 1053 | 1053 | bucket was not passed in. | 1054 | 1054 | """ | 1055 | 1055 |
| @@ -1241,7 +1241,7 @@ def from_local_script( | 1241 | 1241 | staging_bucket set in aiplatform.init. | 1242 | 1242 |
| 1243 | 1243 | Raises: | 1244 | | - RuntimeError is not staging bucket was set using aiplatfrom.init and a staging | | 1244 | + RuntimeError: If staging bucket was not set using aiplatform.init and a staging | 1245 | 1245 | bucket was not passed in. | 1246 | 1246 | """ | 1247 | 1247 |
| |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/metadata/metadata.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -157,8 +157,8 @@ def log_metrics(self, metrics: Dict[str, Union[float, int]]): | 157 | 157 | metrics (Dict): | 158 | 158 | Required. Metrics key/value pairs. Only flot and int are supported format for value. | 159 | 159 | Raises: | 160 | | - TypeError if value contains unsupported types. | 161 | | - ValueError if Experiment or Run is not set. | | 160 | + TypeError: If value contains unsupported types. | | 161 | + ValueError: If Experiment or Run is not set. | 162 | 162 | """ | 163 | 163 |
| 164 | 164 | self._validate_experiment_and_run(method_name="log_metrics") | @@ -265,7 +265,7 @@ def _validate_metrics_value_type(metrics: Dict[str, Union[float, int]]): | 265 | 265 | metrics (Dict): | 266 | 266 | Required. Metrics key/value pairs. Only flot and int are supported format for value. | 267 | 267 | Raises: | 268 | | - TypeError if value contains unsupported types. | | 268 | + TypeError: If value contains unsupported types. | 269 | 269 | """ | 270 | 270 |
| 271 | 271 | for key, value in metrics.items(): | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/metadata/resource.py +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -451,7 +451,7 @@ def _extract_metadata_store_id(resource_name, resource_noun) -> str: | 451 | 451 | metadata_store_id (str): | 452 | 452 | The metadata store id for the particular resource name. | 453 | 453 | Raises: | 454 | | - ValueError if it does not exist. | | 454 | + ValueError: If it does not exist. | 455 | 455 | """ | 456 | 456 | pattern = re.compile( | 457 | 457 | r"^projects\/(?P<project>[\w-]+)\/locations\/(?P<location>[\w-]+)\/metadataStores\/(?P<store>[\w-]+)\/" | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/models.py +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -786,7 +786,7 @@ def _deploy( | 786 | 786 | will be executed in concurrent Future and any downstream object will | 787 | 787 | be immediately returned and synced when the Future has completed. | 788 | 788 | Raises: | 789 | | - ValueError if there is not current traffic split and traffic percentage | | 789 | + ValueError: If there is not current traffic split and traffic percentage | 790 | 790 | is not 0 or 100. | 791 | 791 | """ | 792 | 792 | _LOGGER.log_action_start_against_resource( | @@ -2366,9 +2366,9 @@ def export_model( | 2366 | 2366 | Details of the completed export with output destination paths to | 2367 | 2367 | the artifacts or container image. | 2368 | 2368 | Raises: | 2369 | | - ValueError if model does not support exporting. | | 2369 | + ValueError: If model does not support exporting. | 2370 | 2370 |
| 2371 | | - ValueError if invalid arguments or export formats are provided. | | 2371 | + ValueError: If invalid arguments or export formats are provided. | 2372 | 2372 | """ | 2373 | 2373 |
| 2374 | 2374 | # Model does not support exporting | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform/training_jobs.py +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4060,7 +4060,7 @@ def run( | 4060 | 4060 | produce a Vertex AI Model. | 4061 | 4061 |
| 4062 | 4062 | Raises: | 4063 | | - RuntimeError if Training job has already been run or is waiting to run. | | 4063 | + RuntimeError: If Training job has already been run or is waiting to run. | 4064 | 4064 | """ | 4065 | 4065 |
| 4066 | 4066 | if model_display_name: | @@ -4269,7 +4269,7 @@ def _run_with_experiments( | 4269 | 4269 | produce a Vertex AI Model. | 4270 | 4270 |
| 4271 | 4271 | Raises: | 4272 | | - RuntimeError if Training job has already been run or is waiting to run. | | 4272 | + RuntimeError: If Training job has already been run or is waiting to run. | 4273 | 4273 | """ | 4274 | 4274 |
| 4275 | 4275 | if additional_experiments: | |
|