Skip to content

Commit 7192d0b

Browse files
committed
docstrings: Dict -> dict and List -> list
1 parent 1225fd0 commit 7192d0b

8 files changed

Lines changed: 31 additions & 31 deletions

File tree

datacrunch/InferenceClient/inference_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def status_json(self) -> dict[str, Any]:
483483
"""Get the current status of the async inference execution. Return the status json.
484484
485485
Returns:
486-
Dict[str, Any]: The status response containing the execution status and other metadata
486+
dict[str, Any]: The status response containing the execution status and other metadata
487487
"""
488488
url = (
489489
f'{self._inference_client.base_domain}/status/{self._inference_client.deployment_name}'
@@ -504,7 +504,7 @@ def result(self) -> dict[str, Any]:
504504
"""Get the results of the async inference execution.
505505
506506
Returns:
507-
Dict[str, Any]: The results of the inference execution
507+
dict[str, Any]: The results of the inference execution
508508
"""
509509
url = (
510510
f'{self._inference_client.base_domain}/result/{self._inference_client.deployment_name}'

datacrunch/containers/containers.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ def get_deployments(self) -> list[Deployment]:
745745
"""Retrieves all container deployments.
746746
747747
Returns:
748-
List[Deployment]: List of all deployments.
748+
list[Deployment]: List of all deployments.
749749
"""
750750
response = self.client.get(CONTAINER_DEPLOYMENTS_ENDPOINT)
751751
return [
@@ -860,7 +860,7 @@ def get_deployment_replicas(self, deployment_name: str) -> list[ReplicaInfo]:
860860
deployment_name: Name of the deployment.
861861
862862
Returns:
863-
List[ReplicaInfo]: List of replica information.
863+
list[ReplicaInfo]: List of replica information.
864864
"""
865865
response = self.client.get(f'{CONTAINER_DEPLOYMENTS_ENDPOINT}/{deployment_name}/replicas')
866866
return [ReplicaInfo.from_dict(replica) for replica in response.json()['list']]
@@ -896,7 +896,7 @@ def get_deployment_environment_variables(self, deployment_name: str) -> dict[str
896896
deployment_name: Name of the deployment.
897897
898898
Returns:
899-
Dict[str, List[EnvVar]]: Dictionary mapping container names to their environment variables.
899+
dict[str, list[EnvVar]]: Dictionary mapping container names to their environment variables.
900900
"""
901901
response = self.client.get(
902902
f'{CONTAINER_DEPLOYMENTS_ENDPOINT}/{deployment_name}/environment-variables'
@@ -919,7 +919,7 @@ def add_deployment_environment_variables(
919919
env_vars: List of environment variables to add.
920920
921921
Returns:
922-
Dict[str, List[EnvVar]]: Updated environment variables for all containers.
922+
dict[str, list[EnvVar]]: Updated environment variables for all containers.
923923
"""
924924
response = self.client.post(
925925
f'{CONTAINER_DEPLOYMENTS_ENDPOINT}/{deployment_name}/environment-variables',
@@ -946,7 +946,7 @@ def update_deployment_environment_variables(
946946
env_vars: List of updated environment variables.
947947
948948
Returns:
949-
Dict[str, List[EnvVar]]: Updated environment variables for all containers.
949+
dict[str, list[EnvVar]]: Updated environment variables for all containers.
950950
"""
951951
response = self.client.patch(
952952
f'{CONTAINER_DEPLOYMENTS_ENDPOINT}/{deployment_name}/environment-variables',
@@ -973,7 +973,7 @@ def delete_deployment_environment_variables(
973973
env_var_names: List of environment variable names to delete.
974974
975975
Returns:
976-
Dict[str, List[EnvVar]]: Updated environment variables for all containers.
976+
dict[str, list[EnvVar]]: Updated environment variables for all containers.
977977
"""
978978
response = self.client.delete(
979979
f'{CONTAINER_DEPLOYMENTS_ENDPOINT}/{deployment_name}/environment-variables',
@@ -996,7 +996,7 @@ def get_compute_resources(
996996
is_available: Optional boolean to filter by availability status
997997
998998
Returns:
999-
List[ComputeResource]: List of compute resources matching the filters.
999+
list[ComputeResource]: List of compute resources matching the filters.
10001000
If no filters provided, returns all resources.
10011001
"""
10021002
response = self.client.get(SERVERLESS_COMPUTE_RESOURCES_ENDPOINT)
@@ -1017,7 +1017,7 @@ def get_secrets(self) -> list[Secret]:
10171017
"""Retrieves all secrets.
10181018
10191019
Returns:
1020-
List[Secret]: List of all secrets.
1020+
list[Secret]: List of all secrets.
10211021
"""
10221022
response = self.client.get(SECRETS_ENDPOINT)
10231023
return [Secret.from_dict(secret) for secret in response.json()]
@@ -1046,7 +1046,7 @@ def get_registry_credentials(self) -> list[RegistryCredential]:
10461046
"""Retrieves all registry credentials.
10471047
10481048
Returns:
1049-
List[RegistryCredential]: List of all registry credentials.
1049+
list[RegistryCredential]: List of all registry credentials.
10501050
"""
10511051
response = self.client.get(CONTAINER_REGISTRY_CREDENTIALS_ENDPOINT)
10521052
return [RegistryCredential.from_dict(credential) for credential in response.json()]

datacrunch/images/images.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self, id: str, name: str, image_type: str, details: list[str]) -> N
1616
:param image_type: image type, e.g. 'ubuntu-20.04-cuda-11.0'
1717
:type image_type: str
1818
:param details: image details
19-
:type details: List[str]
19+
:type details: list[str]
2020
"""
2121
self._id = id
2222
self._name = name
@@ -55,7 +55,7 @@ def details(self) -> list[str]:
5555
"""Get the image details.
5656
5757
:return: image details
58-
:rtype: List[str]
58+
:rtype: list[str]
5959
"""
6060
return self._details
6161

@@ -78,7 +78,7 @@ def get(self) -> list[Image]:
7878
"""Get the available instance images.
7979
8080
:return: list of images objects
81-
:rtype: List[Image]
81+
:rtype: list[Image]
8282
"""
8383
images = self._http_client.get(IMAGES_ENDPOINT).json()
8484
image_objects = [

datacrunch/instance_types/instance_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def get(self) -> list[InstanceType]:
171171
"""Get all instance types.
172172
173173
:return: list of instance type objects
174-
:rtype: List[InstanceType]
174+
:rtype: list[InstanceType]
175175
"""
176176
instance_types = self._http_client.get(INSTANCE_TYPES_ENDPOINT).json()
177177
instance_type_objects = [

datacrunch/ssh_keys/ssh_keys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get(self) -> list[SSHKey]:
5656
"""Get all of the client's SSH keys.
5757
5858
:return: list of SSH keys objects
59-
:rtype: List[SSHKey]
59+
:rtype: list[SSHKey]
6060
"""
6161
keys = self._http_client.get(SSHKEYS_ENDPOINT).json()
6262
keys_object_list = [SSHKey(key['id'], key['name'], key['key']) for key in keys]
@@ -79,7 +79,7 @@ def delete(self, id_list: list[str]) -> None:
7979
"""Delete multiple SSH keys by id.
8080
8181
:param id_list: list of SSH keys ids
82-
:type id_list: List[str]
82+
:type id_list: list[str]
8383
"""
8484
payload = {'keys': id_list}
8585
self._http_client.delete(SSHKEYS_ENDPOINT, json=payload)

datacrunch/startup_scripts/startup_scripts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def get(self) -> list[StartupScript]:
5656
"""Get all of the client's startup scripts.
5757
5858
:return: list of startup script objects
59-
:rtype: List[StartupScript]
59+
:rtype: list[StartupScript]
6060
"""
6161
scripts = self._http_client.get(STARTUP_SCRIPTS_ENDPOINT).json()
6262
scripts_objects = [
@@ -80,7 +80,7 @@ def delete(self, id_list: list[str]) -> None:
8080
"""Delete multiple startup scripts by id.
8181
8282
:param id_list: list of startup scripts ids
83-
:type id_list: List[str]
83+
:type id_list: list[str]
8484
"""
8585
payload = {'scripts': id_list}
8686
self._http_client.delete(STARTUP_SCRIPTS_ENDPOINT, json=payload)

datacrunch/volume_types/volume_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get(self) -> list[VolumeType]:
5252
"""Get all volume types.
5353
5454
:return: list of volume type objects
55-
:rtype: List[VolumesType]
55+
:rtype: list[VolumesType]
5656
"""
5757
volume_types = self._http_client.get(VOLUME_TYPES_ENDPOINT).json()
5858
volume_type_objects = [

datacrunch/volumes/volumes.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(
4545
:param instance_id: the instance id the volume is attached to, None if detached
4646
:type instance_id: str
4747
:param ssh_key_ids: list of ssh keys ids
48-
:type ssh_key_ids: List[str]
48+
:type ssh_key_ids: list[str]
4949
:param deleted_at: the time the volume was deleted (UTC), defaults to None
5050
:type deleted_at: str, optional
5151
"""
@@ -157,7 +157,7 @@ def ssh_key_ids(self) -> list[str]:
157157
"""Get the SSH key IDs of the instance.
158158
159159
:return: SSH key IDs
160-
:rtype: List[str]
160+
:rtype: list[str]
161161
"""
162162
return self._ssh_key_ids
163163

@@ -215,7 +215,7 @@ def get(self, status: str = None) -> list[Volume]:
215215
:param status: optional, status of the volumes, defaults to None
216216
:type status: str, optional
217217
:return: list of volume details objects
218-
:rtype: List[Volume]
218+
:rtype: list[Volume]
219219
"""
220220
volumes_dict = self._http_client.get(VOLUMES_ENDPOINT, params={'status': status}).json()
221221
return list(map(Volume.create_from_dict, volumes_dict))
@@ -236,7 +236,7 @@ def get_in_trash(self) -> list[Volume]:
236236
"""Get all volumes that are in trash.
237237
238238
:return: list of volume details objects
239-
:rtype: List[Volume]
239+
:rtype: list[Volume]
240240
"""
241241
volumes_dicts = self._http_client.get(VOLUMES_ENDPOINT + '/trash').json()
242242

@@ -282,7 +282,7 @@ def attach(self, id_list: list[str] | str, instance_id: str) -> None:
282282
Note: the instance needs to be shut-down (offline)
283283
284284
:param id_list: list of volume ids, or a volume id
285-
:type id_list: Union[List[str], str]
285+
:type id_list: Union[list[str], str]
286286
:param instance_id: instance id the volume(s) will be attached to
287287
:type instance_id: str
288288
"""
@@ -301,7 +301,7 @@ def detach(self, id_list: list[str] | str) -> None:
301301
Note: the instances need to be shut-down (offline)
302302
303303
:param id_list: list of volume ids, or a volume id
304-
:type id_list: Union[List[str], str]
304+
:type id_list: Union[list[str], str]
305305
"""
306306
payload = {
307307
'id': id_list,
@@ -315,13 +315,13 @@ def clone(self, id: str, name: str = None, type: str = None) -> Volume:
315315
"""Clone a volume or multiple volumes.
316316
317317
:param id: volume id or list of volume ids
318-
:type id: str or List[str]
318+
:type id: str or list[str]
319319
:param name: new volume name
320320
:type name: str
321321
:param type: volume type
322322
:type type: str, optional
323323
:return: the new volume object, or a list of volume objects if cloned mutliple volumes
324-
:rtype: Volume or List[Volume]
324+
:rtype: Volume or list[Volume]
325325
"""
326326
payload = {'id': id, 'action': VolumeActions.CLONE, 'name': name, 'type': type}
327327

@@ -342,7 +342,7 @@ def rename(self, id_list: list[str] | str, name: str) -> None:
342342
"""Rename multiple volumes or single volume.
343343
344344
:param id_list: list of volume ids, or a volume id
345-
:type id_list: Union[List[str], str]
345+
:type id_list: Union[list[str], str]
346346
:param name: new name
347347
:type name: str
348348
"""
@@ -355,7 +355,7 @@ def increase_size(self, id_list: list[str] | str, size: int) -> None:
355355
"""Increase size of multiple volumes or single volume.
356356
357357
:param id_list: list of volume ids, or a volume id
358-
:type id_list: Union[List[str], str]
358+
:type id_list: Union[list[str], str]
359359
:param size: new size in GB
360360
:type size: int
361361
"""
@@ -374,7 +374,7 @@ def delete(self, id_list: list[str] | str, is_permanent: bool = False) -> None:
374374
Note: if attached to any instances, they need to be shut-down (offline)
375375
376376
:param id_list: list of volume ids, or a volume id
377-
:type id_list: Union[List[str], str]
377+
:type id_list: Union[list[str], str]
378378
"""
379379
payload = {
380380
'id': id_list,

0 commit comments

Comments
 (0)