Skip to content

Commit 87e97ed

Browse files
committed
[patch] remove redundant Raises sections from docstrings
1 parent 851cdb9 commit 87e97ed

1 file changed

Lines changed: 2 additions & 38 deletions

File tree

src/mas/devops/ocp.py

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ def getClusterVersion(dynClient: DynamicClient) -> str:
8686
8787
Returns:
8888
str: The cluster version string (e.g., "4.12.0"), or None if not found
89-
90-
Raises:
91-
NotFoundError: If the ClusterVersion resource cannot be retrieved
9289
"""
9390
clusterVersionAPI = dynClient.resources.get(api_version="config.openshift.io/v1", kind="ClusterVersion")
9491

@@ -132,8 +129,6 @@ def getNamespace(dynClient: DynamicClient, namespace: str) -> dict:
132129
Returns:
133130
dict: The namespace resource as a dictionary, or an empty dict if not found
134131
135-
Raises:
136-
NotFoundError: If the namespace does not exist
137132
"""
138133
namespaceAPI = dynClient.resources.get(api_version="v1", kind="Namespace")
139134

@@ -143,7 +138,6 @@ def getNamespace(dynClient: DynamicClient, namespace: str) -> dict:
143138
return ns
144139
except NotFoundError:
145140
logger.debug(f"Namespace {namespace} does not exist")
146-
147141
return {}
148142

149143

@@ -161,9 +155,6 @@ def createNamespace(dynClient: DynamicClient, namespace: str, kyvernoLabel: str
161155
162156
Returns:
163157
bool: Always returns True
164-
165-
Raises:
166-
NotFoundError: If the namespace resource cannot be accessed
167158
"""
168159
namespaceAPI = dynClient.resources.get(api_version="v1", kind="Namespace")
169160
try:
@@ -205,9 +196,6 @@ def deleteNamespace(dynClient: DynamicClient, namespace: str) -> bool:
205196
206197
Returns:
207198
bool: Always returns True
208-
209-
Raises:
210-
NotFoundError: If the namespace does not exist (caught and logged)
211199
"""
212200
namespaceAPI = dynClient.resources.get(api_version="v1", kind="Namespace")
213201
try:
@@ -230,9 +218,6 @@ def waitForCRD(dynClient: DynamicClient, crdName: str) -> bool:
230218
231219
Returns:
232220
bool: True if the CRD becomes established, False if timeout is reached
233-
234-
Raises:
235-
NotFoundError: If the CRD is not found (caught and retried)
236221
"""
237222
crdAPI = dynClient.resources.get(api_version="apiextensions.k8s.io/v1", kind="CustomResourceDefinition")
238223
maxRetries = 100
@@ -275,9 +260,6 @@ def waitForDeployment(dynClient: DynamicClient, namespace: str, deploymentName:
275260
276261
Returns:
277262
bool: True if the deployment becomes ready, False if timeout is reached
278-
279-
Raises:
280-
NotFoundError: If the deployment is not found (caught and retried)
281263
"""
282264
deploymentAPI = dynClient.resources.get(api_version="apps/v1", kind="Deployment")
283265
maxRetries = 100
@@ -310,9 +292,6 @@ def getConsoleURL(dynClient: DynamicClient) -> str:
310292
311293
Returns:
312294
str: The HTTPS URL of the OpenShift console (e.g., "https://console-openshift-console.apps.cluster.example.com")
313-
314-
Raises:
315-
NotFoundError: If the console route is not found
316295
"""
317296
routesAPI = dynClient.resources.get(api_version="route.openshift.io/v1", kind="Route")
318297
consoleRoute = routesAPI.get(name="console", namespace="openshift-console")
@@ -328,9 +307,6 @@ def getNodes(dynClient: DynamicClient) -> dict:
328307
329308
Returns:
330309
list: List of node resources as dictionaries
331-
332-
Raises:
333-
NotFoundError: If nodes cannot be retrieved
334310
"""
335311
nodesAPI = dynClient.resources.get(api_version="v1", kind="Node")
336312
nodes = nodesAPI.get().to_dict()['items']
@@ -347,9 +323,6 @@ def getStorageClass(dynClient: DynamicClient, name: str) -> dict | None:
347323
348324
Returns:
349325
StorageClass: The StorageClass resource, or None if not found
350-
351-
Raises:
352-
NotFoundError: If the StorageClass does not exist (caught and returns None)
353326
"""
354327
try:
355328
storageClassAPI = dynClient.resources.get(api_version="storage.k8s.io/v1", kind="StorageClass")
@@ -368,9 +341,6 @@ def getStorageClasses(dynClient: DynamicClient) -> list:
368341
369342
Returns:
370343
list: List of StorageClass resources
371-
372-
Raises:
373-
NotFoundError: If StorageClasses cannot be retrieved
374344
"""
375345
storageClassAPI = dynClient.resources.get(api_version="storage.k8s.io/v1", kind="StorageClass")
376346
storageClasses = storageClassAPI.get().items
@@ -385,17 +355,14 @@ def getClusterIssuers(dynClient: DynamicClient) -> list:
385355
dynClient (DynamicClient): OpenShift Dynamic Client
386356
387357
Returns:
388-
list: List of ClusterIssuers resources
389-
390-
Raises:
391-
NotFoundError: If ClusterIssuers cannot be retrieved
358+
list: List of ClusterIssuers resources or an empty list if no cluster issuers
392359
"""
393360
clusterIssuerAPI = dynClient.resources.get(api_version="cert-manager.io/v1", kind="ClusterIssuer")
394361
clusterIssuers = clusterIssuerAPI.get().items
395362
return clusterIssuers
396363

397364

398-
def getClusterIssuer(dynClient: DynamicClient, name: str) -> ResourceInstance:
365+
def getClusterIssuer(dynClient: DynamicClient, name: str) -> ResourceInstance | None:
399366
"""
400367
Get a specific ClusterIssuer by name.
401368
@@ -405,9 +372,6 @@ def getClusterIssuer(dynClient: DynamicClient, name: str) -> ResourceInstance:
405372
406373
Returns:
407374
ClusterIssuer: The ClusterIssuer resource, or None if not found
408-
409-
Raises:
410-
NotFoundError: If the ClusterIssuer does not exist (caught and returns None)
411375
"""
412376
try:
413377
clusterIssuerAPI = dynClient.resources.get(api_version="cert-manager.io/v1", kind="ClusterIssuer")

0 commit comments

Comments
 (0)