@@ -96,8 +96,8 @@ def order_lro_results(doc_id_order, combined):
96
96
def prepare_result (func ):
97
97
def choose_wrapper (* args , ** kwargs ):
98
98
def wrapper (
99
- response , obj , response_headers , ordering_function
100
- ): # pylint: disable=unused-argument
99
+ response , obj , _ , ordering_function
100
+ ):
101
101
if hasattr (obj , "results" ):
102
102
obj = obj .results # language API compat
103
103
@@ -280,7 +280,7 @@ def classify_document_result(
280
280
281
281
282
282
def healthcare_extract_page_data (
283
- doc_id_order , obj , response_headers , health_job_state
283
+ doc_id_order , obj , health_job_state
284
284
): # pylint: disable=unused-argument
285
285
return (
286
286
health_job_state .next_link ,
@@ -289,7 +289,7 @@ def healthcare_extract_page_data(
289
289
health_job_state .results
290
290
if hasattr (health_job_state , "results" )
291
291
else health_job_state .tasks .items [0 ].results ,
292
- response_headers ,
292
+ {} ,
293
293
lro = True
294
294
),
295
295
)
@@ -382,7 +382,7 @@ def get_ordered_errors(tasks_obj, task_name, doc_id_order):
382
382
raise ValueError ("Unexpected response from service - no errors for missing action results." )
383
383
384
384
385
- def _get_doc_results (task , doc_id_order , response_headers , returned_tasks_object ):
385
+ def _get_doc_results (task , doc_id_order , returned_tasks_object ):
386
386
returned_tasks = returned_tasks_object .tasks
387
387
current_task_type , task_name = task
388
388
deserialization_callback = _get_deserialization_callback_from_task_type (
@@ -401,18 +401,25 @@ def _get_doc_results(task, doc_id_order, response_headers, returned_tasks_object
401
401
if response_task_to_deserialize .results is None :
402
402
return get_ordered_errors (returned_tasks_object , task_name , doc_id_order )
403
403
return deserialization_callback (
404
- doc_id_order , response_task_to_deserialize .results , response_headers , lro = True
404
+ doc_id_order , response_task_to_deserialize .results , {} , lro = True
405
405
)
406
406
407
407
408
- def get_iter_items (doc_id_order , task_order , response_headers , analyze_job_state ):
408
+ def get_iter_items (doc_id_order , task_order , bespoke , analyze_job_state ):
409
409
iter_items = defaultdict (list ) # map doc id to action results
410
410
returned_tasks_object = analyze_job_state
411
+
412
+ if bespoke :
413
+ return _get_doc_results (
414
+ task_order [0 ],
415
+ doc_id_order ,
416
+ returned_tasks_object ,
417
+ )
418
+
411
419
for task in task_order :
412
420
results = _get_doc_results (
413
421
task ,
414
422
doc_id_order ,
415
- response_headers ,
416
423
returned_tasks_object ,
417
424
)
418
425
for result in results :
@@ -422,11 +429,11 @@ def get_iter_items(doc_id_order, task_order, response_headers, analyze_job_state
422
429
423
430
424
431
def analyze_extract_page_data (
425
- doc_id_order , task_order , response_headers , analyze_job_state
432
+ doc_id_order , task_order , bespoke , analyze_job_state
426
433
):
427
434
# return next link, list of
428
435
iter_items = get_iter_items (
429
- doc_id_order , task_order , response_headers , analyze_job_state
436
+ doc_id_order , task_order , bespoke , analyze_job_state
430
437
)
431
438
return analyze_job_state .next_link , iter_items
432
439
@@ -456,14 +463,14 @@ def lro_get_next_page(
456
463
457
464
458
465
def healthcare_paged_result (
459
- doc_id_order , health_status_callback , _ , obj , response_headers , show_stats = False
460
- ): # pylint: disable=unused-argument
466
+ doc_id_order , health_status_callback , _ , obj , show_stats = False
467
+ ):
461
468
return ItemPaged (
462
469
functools .partial (
463
470
lro_get_next_page , health_status_callback , obj , show_stats = show_stats
464
471
),
465
472
functools .partial (
466
- healthcare_extract_page_data , doc_id_order , obj , response_headers
473
+ healthcare_extract_page_data , doc_id_order , obj
467
474
),
468
475
)
469
476
@@ -474,14 +481,38 @@ def analyze_paged_result(
474
481
analyze_status_callback ,
475
482
_ ,
476
483
obj ,
477
- response_headers ,
478
484
show_stats = False ,
479
- ): # pylint: disable=unused-argument
485
+ bespoke = False
486
+ ):
480
487
return ItemPaged (
481
488
functools .partial (
482
489
lro_get_next_page , analyze_status_callback , obj , show_stats = show_stats
483
490
),
484
491
functools .partial (
485
- analyze_extract_page_data , doc_id_order , task_order , response_headers
492
+ analyze_extract_page_data , doc_id_order , task_order , bespoke
486
493
),
487
494
)
495
+
496
+
497
+ def _get_result_from_continuation_token (
498
+ client , continuation_token , poller_type , polling_method , callback , bespoke = False
499
+ ):
500
+ def result_callback (initial_response , pipeline_response ):
501
+ doc_id_order = initial_response .context .options ["doc_id_order" ]
502
+ show_stats = initial_response .context .options ["show_stats" ]
503
+ task_id_order = initial_response .context .options .get ("task_id_order" )
504
+ return callback (
505
+ pipeline_response ,
506
+ None ,
507
+ doc_id_order ,
508
+ task_id_order = task_id_order ,
509
+ show_stats = show_stats ,
510
+ bespoke = bespoke
511
+ )
512
+
513
+ return poller_type .from_continuation_token (
514
+ polling_method = polling_method ,
515
+ client = client ,
516
+ deserialization_callback = result_callback ,
517
+ continuation_token = continuation_token
518
+ )
0 commit comments