Skip to content

Commit 08d0201

Browse files
authored
fix: Resolve ApiVIEW comments about , optional and :paramtype: (#31679)
* fix: Remove `, optional` from :type: fields This seems to have been breaking ApiVIEW's type parser, and prevented type hints from appearing in the review tool. Sphinx may annotate this automatically. * fix: Replace `:type:` with `:paramtype:` for `:keyword:` args
1 parent ece166a commit 08d0201

149 files changed

Lines changed: 1296 additions & 1296 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_artifact_utilities.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get_datastore_info(
7979
:keyword credential: Local credential to use for authentication. If not provided, will try to get
8080
credentials from the datastore, which requires authorization to perform action
8181
'Microsoft.MachineLearningServices/workspaces/datastores/listSecrets/action' over target datastore.
82-
:type credential: str
82+
:paramtype credential: str
8383
:return: The dictionary with datastore info
8484
:rtype: Dict[Literal["storage_type", "storage_account", "account_url", "container_name"], str]
8585
"""
@@ -217,17 +217,17 @@ def upload_artifact(
217217
:param datastore_name: The datastore name
218218
:type datastore_name: Optional[str]
219219
:param asset_hash: The asset hash
220-
:type asset_hash: Optional[str], optional
220+
:type asset_hash: Optional[str]
221221
:param show_progress: Whether to show progress on the console. Defaults to True.
222-
:type show_progress: bool, optional
222+
:type show_progress: bool
223223
:param asset_name: The asset name
224-
:type asset_name: Optional[str], optional
224+
:type asset_name: Optional[str]
225225
:param asset_version: The asset version
226-
:type asset_version: Optional[str], optional
226+
:type asset_version: Optional[str]
227227
:param ignore_file: The IgnoreFile determining which, if any, files to ignore when uploading
228-
:type ignore_file: IgnoreFile, optional
228+
:type ignore_file: IgnoreFile
229229
:param sas_uri: The sas uri to use for uploading
230-
:type sas_uri: Optional[str], optional
230+
:type sas_uri: Optional[str]
231231
:return: The artifact storage info
232232
:rtype: ArtifactStorageInfo
233233
"""
@@ -280,7 +280,7 @@ def download_artifact(
280280
:param datastore_name: name of datastore
281281
:type datastore_name: Optional[str]
282282
:param datastore_info: the return value of invoking get_datastore_info
283-
:type datastore_info: Optional[Dict], optional
283+
:type datastore_info: Optional[Dict]
284284
:return: Path that files were written to
285285
:rtype: str
286286
"""
@@ -465,13 +465,13 @@ def _check_and_upload_path(
465465
:param artifact_type: The artifact type
466466
:type artifact_type: str
467467
:param datastore_name: the name of the datastore to upload to
468-
:type datastore_name: Optional[str], optional
468+
:type datastore_name: Optional[str]
469469
:param sas_uri: the sas uri to use for uploading
470-
:type sas_uri: Optional[str], optional
470+
:type sas_uri: Optional[str]
471471
:param show_progress: Whether to show progress on the console. Defaults to True.
472-
:type show_progress: bool, optional
472+
:type show_progress: bool
473473
:param blob_uri: The storage account uri
474-
:type blob_uri: Optional[str], optional
474+
:type blob_uri: Optional[str]
475475
:return: A 2-tuple of the uploaded artifact, and the indicator file.
476476
:rtype: Tuple[T, Optional[str]]
477477
"""

sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_blob_storage_helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def upload(
8181
:param version: The asset version
8282
:type version: str
8383
:param ignore_file: The IgnoreFile that specifies which files, if any, to ignore when uploading files
84-
:type ignore_file: IgnoreFile, optional
84+
:type ignore_file: IgnoreFile
8585
:param asset_hash: The asset hash
86-
:type asset_hash: Optional[str], optional
86+
:type asset_hash: Optional[str]
8787
:param show_progress: Whether to show progress on the console. Defaults to True.
88-
:type show_progress: bool, optional
88+
:type show_progress: bool
8989
:return: A dictionary containing info of the uploaded artifact
9090
:rtype: Dict[Literal["remote path", "name", "version", "indicator file"], str]
9191
"""

sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_fileshare_storage_helper.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def upload(
8080
:param version: The asset version
8181
:type version: str
8282
:param ignore_file: The IgnoreFile that specifies which files, if any, to ignore when uploading files
83-
:type ignore_file: IgnoreFile, optional
83+
:type ignore_file: IgnoreFile
8484
:param asset_hash: The asset hash
85-
:type asset_hash: Optional[str], optional
85+
:type asset_hash: Optional[str]
8686
:param show_progress: Whether to show progress on the console. Defaults to True.
87-
:type show_progress: bool, optional
87+
:type show_progress: bool
8888
:return: A dictionary containing info of the uploaded artifact
8989
:rtype: Dict[Literal["remote path", "name", "version"], str]
9090
"""
@@ -148,17 +148,17 @@ def upload_file(
148148
:param dest: The destination in the fileshare to upload to
149149
:type dest: str
150150
:param show_progress: Whether to show progress on the console. Defaults to False.
151-
:type show_progress: bool, optional
151+
:type show_progress: bool
152152
:param msg: Message to display on progress bar. Defaults to None.
153-
:type msg: Optional[str], optional
153+
:type msg: Optional[str]
154154
:param in_directory: Whether this function is being called by :attr:`FileStorageClient.upload_dir`. Defaults
155155
to False.
156-
:type in_directory: bool, optional
156+
:type in_directory: bool
157157
:param subdirectory_client: The subdirectory client.
158-
:type subdirectory_client: Optional[ShareDirectoryClient], optional
158+
:type subdirectory_client: Optional[ShareDirectoryClient]
159159
:param callback: A callback that receives the raw requests returned by the service during the upload process.
160160
Only used if `in_directory` and `show_progress` are True.
161-
:type callback: Optional[Callable[[Dict], None]], optional
161+
:type callback: Optional[Callable[[Dict], None]]
162162
"""
163163
validate_content = os.stat(source).st_size > 0 # don't do checksum for empty files
164164

@@ -294,11 +294,11 @@ def download(
294294
"""Downloads all contents inside a specified fileshare directory.
295295
296296
:param starts_with: The prefix used to filter files to download
297-
:type starts_with: str, optional
297+
:type starts_with: str
298298
:param destination: The destination to download to. Default to user's home directory.
299-
:type destination: str, optional
299+
:type destination: str
300300
:param max_concurrency: The maximum number of concurrent downloads. Defaults to 4.
301-
:type max_concurrency: int, optional
301+
:type max_concurrency: int
302302
"""
303303
recursive_download(
304304
client=self.directory_client,
@@ -394,7 +394,7 @@ def recursive_download(
394394
:param max_concurrency: The maximum number of concurrent downloads
395395
:type max_concurrency: int
396396
:param starts_with: The prefix used to filter files to download. Defaults to ""
397-
:type starts_with: str, optional
397+
:type starts_with: str
398398
"""
399399
try:
400400
items = list(client.list_directories_and_files(name_starts_with=starts_with))

sdk/ml/azure-ai-ml/azure/ai/ml/_artifacts/_gen2_storage_helper.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ def upload(
7171
:param version: The asset version
7272
:type version: str
7373
:param ignore_file: The IgnoreFile that specifies which files, if any, to ignore when uploading files
74-
:type ignore_file: IgnoreFile, optional
74+
:type ignore_file: IgnoreFile
7575
:param asset_hash: The asset hash
76-
:type asset_hash: Optional[str], optional
76+
:type asset_hash: Optional[str]
7777
:param show_progress: Whether to show progress on the console. Defaults to True.
78-
:type show_progress: bool, optional
78+
:type show_progress: bool
7979
:return: A dictionary containing info of the uploaded artifact
8080
:rtype: Dict[Literal["remote path", "name", "version", "indicator file"], str]
8181
"""

sdk/ml/azure-ai-ml/azure/ai/ml/_azure_environments.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ def _get_base_url_from_metadata(cloud_name: Optional[str] = None, is_local_mfe:
123123
"""Retrieve the base url for a cloud from the metadata in SDK.
124124
125125
:param cloud_name: cloud name
126-
:type cloud_name: Optional[str], optional
126+
:type cloud_name: Optional[str]
127127
:param is_local_mfe: Whether is local Management Front End. Defaults to False.
128-
:type is_local_mfe: bool, optional
128+
:type is_local_mfe: bool
129129
:return: base url for a cloud
130130
:rtype: str
131131
"""
@@ -142,7 +142,7 @@ def _get_aml_resource_id_from_metadata(cloud_name: Optional[str] = None) -> str:
142142
"""Retrieve the aml_resource_id for a cloud from the metadata in SDK.
143143
144144
:param cloud_name: cloud name
145-
:type cloud_name: str, optional
145+
:type cloud_name: str
146146
:return: aml_resource_id for a cloud
147147
:rtype: str
148148
"""
@@ -155,7 +155,7 @@ def _get_active_directory_url_from_metadata(cloud_name: Optional[str] = None) ->
155155
"""Retrieve the active_directory_url for a cloud from the metadata in SDK.
156156
157157
:param cloud_name: cloud name
158-
:type cloud_name: str, optional
158+
:type cloud_name: str
159159
:return: active_directory for a cloud
160160
:rtype: str
161161
"""
@@ -168,7 +168,7 @@ def _get_storage_endpoint_from_metadata(cloud_name: Optional[str] = None) -> str
168168
"""Retrieve the storage_endpoint for a cloud from the metadata in SDK.
169169
170170
:param cloud_name: cloud name
171-
:type cloud_name: str, optional
171+
:type cloud_name: str
172172
:return: storage_endpoint for a cloud
173173
:rtype: str
174174
"""
@@ -181,7 +181,7 @@ def _get_azure_portal_id_from_metadata(cloud_name: Optional[str] = None) -> str:
181181
"""Retrieve the azure_portal_id for a cloud from the metadata in SDK.
182182
183183
:param cloud_name: cloud name
184-
:type cloud_name: str, optional
184+
:type cloud_name: str
185185
:return: azure_portal_id for a cloud
186186
:rtype: str
187187
"""
@@ -194,7 +194,7 @@ def _get_cloud_information_from_metadata(cloud_name: Optional[str] = None, **kwa
194194
"""Retrieve the cloud information from the metadata in SDK.
195195
196196
:param cloud_name: cloud name
197-
:type cloud_name: str, optional
197+
:type cloud_name: str
198198
:return: A dictionary of additional configuration parameters required for passing in cloud information.
199199
:rtype: Dict
200200
"""
@@ -213,7 +213,7 @@ def _get_registry_discovery_endpoint_from_metadata(cloud_name: Optional[str] = N
213213
"""Retrieve the registry_discovery_endpoint for a cloud from the metadata in SDK.
214214
215215
:param cloud_name: cloud name
216-
:type cloud_name: str, optional
216+
:type cloud_name: str
217217
:return: registry_discovery_endpoint for a cloud
218218
:rtype: str
219219
"""

sdk/ml/azure-ai-ml/azure/ai/ml/_exception_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ def format_create_validation_error(
240240
:param yaml_operation: Whether the exception was caused by yaml validation.
241241
:type yaml_operation: bool
242242
:param cli: Whether is invoked from Azure CLI AzureML Extension. Defaults to False
243-
:type cli: bool, optional
243+
:type cli: bool
244244
:param raw_error: The raw exception message
245-
:type raw_error: Optional[str], optional
245+
:type raw_error: Optional[str]
246246
:return: Formatted error message
247247
:rtype: str
248248
"""

sdk/ml/azure-ai-ml/azure/ai/ml/_local_endpoints/dockerfile_resolver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _construct(self, install_debugpy: bool = False) -> None:
8282
Constructs the Dockerfile instructions based on properties.
8383
8484
:param install_debugpy: Whether to install debugpy. Defaults to False.
85-
:type install_debugpy: bool, optional
85+
:type install_debugpy: bool
8686
"""
8787
self._instructions = []
8888
if self._docker_base_image:

sdk/ml/azure-ai-ml/azure/ai/ml/_ml_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ class MLClient:
113113
:type registry_name: Optional[str]
114114
:keyword show_progress: Specifies whether or not to display progress bars for long-running operations (e.g.
115115
customers may consider setting this to False if not using this SDK in an interactive setup). Defaults to True.
116-
:type show_progress: Optional[bool]
116+
:paramtype show_progress: Optional[bool]
117117
:keyword enable_telemetry: Specifies whether or not to enable telemetry. Will be overridden to False if not in a
118118
Jupyter Notebook. Defaults to True if in a Jupyter Notebook.
119-
:type enable_telemetry: Optional[bool]
119+
:paramtype enable_telemetry: Optional[bool]
120120
:keyword cloud: The cloud name to use. Defaults to "AzureCloud".
121-
:type cloud: Optional[str]
121+
:paramtype cloud: Optional[str]
122122
:raises ValueError: Raised if credential is None.
123123
:raises ~azure.ai.ml.ValidationException: Raised if both workspace_name and registry_name are provided.
124124
@@ -547,12 +547,12 @@ def from_config(
547547
:type credential: ~azure.core.credentials.TokenCredential
548548
:keyword path: The path to the configuration file or starting directory to search for the configuration file
549549
within. Defaults to None, indicating the current directory will be used.
550-
:type path: Optional[Union[os.PathLike, str]]
550+
:paramtype path: Optional[Union[os.PathLike, str]]
551551
:keyword file_name: The configuration file name to search for when path is a directory path. Defaults to
552552
"config.json".
553-
:type file_name: Optional[str]
553+
:paramtype file_name: Optional[str]
554554
:keyword cloud: The cloud name to use. Defaults to "AzureCloud".
555-
:type cloud: Optional[str]
555+
:paramtype cloud: Optional[str]
556556
:raises ~azure.ai.ml.exceptions.ValidationException: Raised if "config.json", or file_name if overridden,
557557
cannot be found in directory. Details will be provided in the error message.
558558
:returns: The client for an existing Azure ML Workspace.

sdk/ml/azure-ai-ml/azure/ai/ml/_schema/core/fields.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def _deserialize(self, value, attr, data, **kwargs):
648648
def ComputeField(**kwargs) -> Field:
649649
"""
650650
:keyword required: if set to True, it is not possible to pass None
651-
:type required: bool
651+
:paramtype required: bool
652652
:return: The compute field
653653
:rtype: Field
654654
"""
@@ -667,7 +667,7 @@ def ComputeField(**kwargs) -> Field:
667667
def CodeField(**kwargs) -> Field:
668668
"""
669669
:keyword required: if set to True, it is not possible to pass None
670-
:type required: bool
670+
:paramtype required: bool
671671
:return: The code field
672672
:rtype: Field
673673
"""

sdk/ml/azure-ai-ml/azure/ai/ml/_telemetry/_customtraceback.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ def format_exc(limit: Optional[int] = None, chain: bool = True) -> str:
143143
"""Like print_exc() but return a string.
144144
145145
:param limit: None to include all frames or the number of frames to include.
146-
:type limit: Optional[int], optional
146+
:type limit: Optional[int]
147147
:param chain: Whether to format __cause__ and __context__. Defaults to True
148-
:type chain: bool, optional
148+
:type chain: bool
149149
:return: The formatted exception string
150150
:rtype: str
151151
"""
@@ -170,9 +170,9 @@ def format_exception( # pylint: disable=unused-argument
170170
:param tb: The exception traceback
171171
:type tb: types.TracebackType
172172
:param limit: None to include all frames or the number of frames to include.
173-
:type limit: Optional[int], optional
173+
:type limit: Optional[int]
174174
:param chain: Whether to format __cause__ and __context__. Defaults to True
175-
:type chain: bool, optional
175+
:type chain: bool
176176
:return: A list of strings, each ending in a newline and some containing internal newlines.
177177
When these lines are concatenated and printed, exactly the same text is printed as does print_exception().
178178
:rtype: List[str]

0 commit comments

Comments
 (0)