Skip to content

Commit 857f63d

Browse files
authored
fix(aiplatform): Fix doc formatting (#359)
1 parent ef4f6f8 commit 857f63d

13 files changed

+165
-163
lines changed

google/cloud/aiplatform/base.py

+27-17
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ def log_create_complete(
9494
resource (proto.Message):
9595
AI Platform Resourc proto.Message
9696
variable_name (str): Name of variable to use for code snippet
97-
9897
"""
9998
self._logger.info(f"{cls.__name__} created. Resource name: {resource.name}")
10099
self._logger.info(f"To use this {cls.__name__} in another session:")
@@ -181,7 +180,8 @@ def _raise_future_exception(self):
181180
raise self._exception
182181

183182
def _complete_future(self, future: futures.Future):
184-
"""Checks for exception of future and removes the pointer if it's still latest.
183+
"""Checks for exception of future and removes the pointer if it's still
184+
latest.
185185
186186
Args:
187187
future (futures.Future): Required. A future to complete.
@@ -215,13 +215,14 @@ def wait(self):
215215

216216
@property
217217
def _latest_future(self) -> Optional[futures.Future]:
218-
"""Get the latest future if it exists"""
218+
"""Get the latest future if it exists."""
219219
with self.__latest_future_lock:
220220
return self.__latest_future
221221

222222
@_latest_future.setter
223223
def _latest_future(self, future: Optional[futures.Future]):
224-
"""Optionally set the latest future and add a complete_future callback."""
224+
"""Optionally set the latest future and add a complete_future
225+
callback."""
225226
with self.__latest_future_lock:
226227
self.__latest_future = future
227228
if future:
@@ -260,7 +261,8 @@ def wait_for_dependencies_and_invoke(
260261
kwargs: Dict[str, Any],
261262
internal_callbacks: Iterable[Callable[[Any], Any]],
262263
) -> Any:
263-
"""Wrapper method to wait on any dependencies before submitting method.
264+
"""Wrapper method to wait on any dependencies before submitting
265+
method.
264266
265267
Args:
266268
deps (Sequence[futures.Future]):
@@ -272,7 +274,6 @@ def wait_for_dependencies_and_invoke(
272274
Required. The keyword arguments to call the method with.
273275
internal_callbacks: (Callable[[Any], Any]):
274276
Callbacks that take the result of method.
275-
276277
"""
277278

278279
for future in set(deps):
@@ -342,12 +343,14 @@ def wait_for_dependencies_and_invoke(
342343
@classmethod
343344
@abc.abstractmethod
344345
def _empty_constructor(cls) -> "FutureManager":
345-
"""Should construct object with all non FutureManager attributes as None"""
346+
"""Should construct object with all non FutureManager attributes as
347+
None."""
346348
pass
347349

348350
@abc.abstractmethod
349351
def _sync_object_with_future_result(self, result: "FutureManager"):
350-
"""Should sync the object from _empty_constructor with result of future."""
352+
"""Should sync the object from _empty_constructor with result of
353+
future."""
351354

352355
def __repr__(self) -> str:
353356
if self._exception:
@@ -375,7 +378,8 @@ class AiPlatformResourceNoun(metaclass=abc.ABCMeta):
375378
@classmethod
376379
@abc.abstractmethod
377380
def client_class(cls) -> Type[utils.AiPlatformServiceClientWithOverride]:
378-
"""Client class required to interact with resource with optional overrides."""
381+
"""Client class required to interact with resource with optional
382+
overrides."""
379383
pass
380384

381385
@property
@@ -388,7 +392,8 @@ def _is_client_prediction_client(cls) -> bool:
388392
@property
389393
@abc.abstractmethod
390394
def _getter_method(cls) -> str:
391-
"""Name of getter method of client class for retrieving the resource."""
395+
"""Name of getter method of client class for retrieving the
396+
resource."""
392397
pass
393398

394399
@property
@@ -400,7 +405,7 @@ def _delete_method(cls) -> str:
400405
@property
401406
@abc.abstractmethod
402407
def _resource_noun(cls) -> str:
403-
"""Resource noun"""
408+
"""Resource noun."""
404409
pass
405410

406411
def __init__(
@@ -547,7 +552,8 @@ def optional_sync(
547552
return_input_arg: Optional[str] = None,
548553
bind_future_to_self: bool = True,
549554
):
550-
"""Decorator for AiPlatformResourceNounWithFutureManager with optional sync support.
555+
"""Decorator for AiPlatformResourceNounWithFutureManager with optional sync
556+
support.
551557
552558
Methods with this decorator should include a "sync" argument that defaults to
553559
True. If called with sync=False this decorator will launch the method as a
@@ -681,7 +687,8 @@ def wrapper(*args, **kwargs):
681687

682688

683689
class AiPlatformResourceNounWithFutureManager(AiPlatformResourceNoun, FutureManager):
684-
"""Allows optional asynchronous calls to this AI Platform Resource Nouns."""
690+
"""Allows optional asynchronous calls to this AI Platform Resource
691+
Nouns."""
685692

686693
def __init__(
687694
self,
@@ -816,7 +823,8 @@ def _list(
816823
credentials: Optional[auth_credentials.Credentials] = None,
817824
) -> List[AiPlatformResourceNoun]:
818825
"""Private method to list all instances of this AI Platform Resource,
819-
takes a `cls_filter` arg to filter to a particular SDK resource subclass.
826+
takes a `cls_filter` arg to filter to a particular SDK resource
827+
subclass.
820828
821829
Args:
822830
cls_filter (Callable[[proto.Message], bool]):
@@ -884,8 +892,9 @@ def _list_with_local_order(
884892
credentials: Optional[auth_credentials.Credentials] = None,
885893
) -> List[AiPlatformResourceNoun]:
886894
"""Private method to list all instances of this AI Platform Resource,
887-
takes a `cls_filter` arg to filter to a particular SDK resource subclass.
888-
Provides client-side sorting when a list API doesn't support `order_by`.
895+
takes a `cls_filter` arg to filter to a particular SDK resource
896+
subclass. Provides client-side sorting when a list API doesn't support
897+
`order_by`.
889898
890899
Args:
891900
cls_filter (Callable[[proto.Message], bool]):
@@ -986,7 +995,8 @@ def list(
986995

987996
@optional_sync()
988997
def delete(self, sync: bool = True) -> None:
989-
"""Deletes this AI Platform resource. WARNING: This deletion is permament.
998+
"""Deletes this AI Platform resource. WARNING: This deletion is
999+
permament.
9901000
9911001
Args:
9921002
sync (bool):

google/cloud/aiplatform/datasets/_datasources.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727

2828
class Datasource(abc.ABC):
29-
"""An abstract class that sets dataset_metadata"""
29+
"""An abstract class that sets dataset_metadata."""
3030

3131
@property
3232
@abc.abstractmethod
@@ -36,7 +36,7 @@ def dataset_metadata(self):
3636

3737

3838
class DatasourceImportable(abc.ABC):
39-
"""An abstract class that sets import_data_config"""
39+
"""An abstract class that sets import_data_config."""
4040

4141
@property
4242
@abc.abstractmethod
@@ -46,14 +46,14 @@ def import_data_config(self):
4646

4747

4848
class TabularDatasource(Datasource):
49-
"""Datasource for creating a tabular dataset for AI Platform"""
49+
"""Datasource for creating a tabular dataset for AI Platform."""
5050

5151
def __init__(
5252
self,
5353
gcs_source: Optional[Union[str, Sequence[str]]] = None,
5454
bq_source: Optional[str] = None,
5555
):
56-
"""Creates a tabular datasource
56+
"""Creates a tabular datasource.
5757
5858
Args:
5959
gcs_source (Union[str, Sequence[str]]):
@@ -99,23 +99,24 @@ def dataset_metadata(self) -> Optional[Dict]:
9999

100100

101101
class NonTabularDatasource(Datasource):
102-
"""Datasource for creating an empty non-tabular dataset for AI Platform"""
102+
"""Datasource for creating an empty non-tabular dataset for AI Platform."""
103103

104104
@property
105105
def dataset_metadata(self) -> Optional[Dict]:
106106
return None
107107

108108

109109
class NonTabularDatasourceImportable(NonTabularDatasource, DatasourceImportable):
110-
"""Datasource for creating a non-tabular dataset for AI Platform and importing data to the dataset"""
110+
"""Datasource for creating a non-tabular dataset for AI Platform and
111+
importing data to the dataset."""
111112

112113
def __init__(
113114
self,
114115
gcs_source: Union[str, Sequence[str]],
115116
import_schema_uri: str,
116117
data_item_labels: Optional[Dict] = None,
117118
):
118-
"""Creates a non-tabular datasource
119+
"""Creates a non-tabular datasource.
119120
120121
Args:
121122
gcs_source (Union[str, Sequence[str]]):

google/cloud/aiplatform/datasets/dataset.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737

3838
class _Dataset(base.AiPlatformResourceNounWithFutureManager):
39-
"""Managed dataset resource for AI Platform"""
39+
"""Managed dataset resource for AI Platform."""
4040

4141
client_class = utils.DatasetClientWithOverride
4242
_is_client_prediction_client = False
@@ -70,7 +70,6 @@ def __init__(
7070
credentials (auth_credentials.Credentials):
7171
Custom credentials to use to upload this model. Overrides
7272
credentials set in aiplatform.init.
73-
7473
"""
7574

7675
super().__init__(
@@ -195,7 +194,6 @@ def create(
195194
Returns:
196195
dataset (Dataset):
197196
Instantiated representation of the managed dataset resource.
198-
199197
"""
200198

201199
utils.validate_display_name(display_name)

google/cloud/aiplatform/datasets/image_dataset.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class ImageDataset(datasets._Dataset):
30-
"""Managed image dataset resource for AI Platform"""
30+
"""Managed image dataset resource for AI Platform."""
3131

3232
_supported_metadata_schema_uris: Optional[Tuple[str]] = (
3333
schema.dataset.metadata.image,
@@ -47,8 +47,8 @@ def create(
4747
encryption_spec_key_name: Optional[str] = None,
4848
sync: bool = True,
4949
) -> "ImageDataset":
50-
"""Creates a new image dataset and optionally imports data into dataset when
51-
source and import_schema_uri are passed.
50+
"""Creates a new image dataset and optionally imports data into dataset
51+
when source and import_schema_uri are passed.
5252
5353
Args:
5454
display_name (str):
@@ -114,7 +114,6 @@ def create(
114114
Returns:
115115
image_dataset (ImageDataset):
116116
Instantiated representation of the managed image dataset resource.
117-
118117
"""
119118

120119
utils.validate_display_name(display_name)

google/cloud/aiplatform/datasets/tabular_dataset.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class TabularDataset(datasets._Dataset):
30-
"""Managed tabular dataset resource for AI Platform"""
30+
"""Managed tabular dataset resource for AI Platform."""
3131

3232
_supported_metadata_schema_uris: Optional[Tuple[str]] = (
3333
schema.dataset.metadata.tabular,
@@ -95,7 +95,6 @@ def create(
9595
Returns:
9696
tabular_dataset (TabularDataset):
9797
Instantiated representation of the managed tabular dataset resource.
98-
9998
"""
10099

101100
utils.validate_display_name(display_name)

google/cloud/aiplatform/datasets/text_dataset.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class TextDataset(datasets._Dataset):
30-
"""Managed text dataset resource for AI Platform"""
30+
"""Managed text dataset resource for AI Platform."""
3131

3232
_supported_metadata_schema_uris: Optional[Tuple[str]] = (
3333
schema.dataset.metadata.text,
@@ -47,8 +47,8 @@ def create(
4747
encryption_spec_key_name: Optional[str] = None,
4848
sync: bool = True,
4949
) -> "TextDataset":
50-
"""Creates a new text dataset and optionally imports data into dataset when
51-
source and import_schema_uri are passed.
50+
"""Creates a new text dataset and optionally imports data into dataset
51+
when source and import_schema_uri are passed.
5252
5353
Example Usage:
5454
ds = aiplatform.TextDataset.create(
@@ -121,7 +121,6 @@ def create(
121121
Returns:
122122
text_dataset (TextDataset):
123123
Instantiated representation of the managed text dataset resource.
124-
125124
"""
126125

127126
utils.validate_display_name(display_name)

google/cloud/aiplatform/datasets/video_dataset.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class VideoDataset(datasets._Dataset):
30-
"""Managed video dataset resource for AI Platform"""
30+
"""Managed video dataset resource for AI Platform."""
3131

3232
_supported_metadata_schema_uris: Optional[Tuple[str]] = (
3333
schema.dataset.metadata.video,
@@ -47,8 +47,8 @@ def create(
4747
encryption_spec_key_name: Optional[str] = None,
4848
sync: bool = True,
4949
) -> "VideoDataset":
50-
"""Creates a new video dataset and optionally imports data into dataset when
51-
source and import_schema_uri are passed.
50+
"""Creates a new video dataset and optionally imports data into dataset
51+
when source and import_schema_uri are passed.
5252
5353
Args:
5454
display_name (str):
@@ -114,7 +114,6 @@ def create(
114114
Returns:
115115
video_dataset (VideoDataset):
116116
Instantiated representation of the managed video dataset resource.
117-
118117
"""
119118

120119
utils.validate_display_name(display_name)

google/cloud/aiplatform/initializer.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ def get_encryption_spec(
107107
gca_encryption_spec_v1beta1.EncryptionSpec,
108108
]
109109
]:
110-
"""Creates a gca_encryption_spec.EncryptionSpec instance from the given key name.
111-
If the provided key name is None, it uses the default key name if provided.
110+
"""Creates a gca_encryption_spec.EncryptionSpec instance from the given
111+
key name. If the provided key name is None, it uses the default key
112+
name if provided.
112113
113114
Args:
114115
encryption_spec_key_name (Optional[str]): The default encryption key name to use when creating resources.
@@ -241,7 +242,8 @@ def create_client(
241242
location_override: Optional[str] = None,
242243
prediction_client: bool = False,
243244
) -> utils.AiPlatformServiceClientWithOverride:
244-
"""Instantiates a given AiPlatformServiceClient with optional overrides.
245+
"""Instantiates a given AiPlatformServiceClient with optional
246+
overrides.
245247
246248
Args:
247249
client_class (utils.AiPlatformServiceClientWithOverride):

0 commit comments

Comments
 (0)