1212from gradient import Gradient , IndexingJobError , IndexingJobTimeoutError
1313
1414
15- def main ():
15+ def main () -> None :
1616 # Initialize the Gradient client
1717 client = Gradient ()
1818
@@ -56,7 +56,7 @@ def main():
5656 print (f"\n ❌ Unexpected error: { e } " )
5757
5858
59- def example_with_custom_polling ():
59+ def example_with_custom_polling () -> None :
6060 """Example with custom polling interval and timeout"""
6161 print ("\n \n Example 2: Custom polling interval and timeout" )
6262 print ("-" * 50 )
@@ -102,7 +102,7 @@ def example_with_custom_polling():
102102 print (f"\n ❌ Job failed: { e } " )
103103
104104
105- def example_manual_polling ():
105+ def example_manual_polling () -> None :
106106 """Example of the old manual polling approach (for comparison)"""
107107 print ("\n \n Example 3: Manual polling (old approach)" )
108108 print ("-" * 50 )
@@ -125,10 +125,10 @@ def example_manual_polling():
125125 import time
126126
127127 while True :
128- indexing_job = client .knowledge_bases .indexing_jobs .retrieve (job_uuid )
128+ indexing_job_status = client .knowledge_bases .indexing_jobs .retrieve (job_uuid )
129129
130- if indexing_job .job and indexing_job .job .phase :
131- phase = indexing_job .job .phase
130+ if indexing_job_status .job and indexing_job_status .job .phase :
131+ phase = indexing_job_status .job .phase
132132 print (f"Current phase: { phase } " )
133133
134134 if phase in ["BATCH_JOB_PHASE_UNKNOWN" , "BATCH_JOB_PHASE_PENDING" , "BATCH_JOB_PHASE_RUNNING" ]:
@@ -142,7 +142,7 @@ def example_manual_polling():
142142 break
143143
144144
145- async def example_async ():
145+ async def example_async () -> None :
146146 """Example using async/await"""
147147 print ("\n \n Example 4: Async usage" )
148148 print ("-" * 50 )
0 commit comments