File tree Expand file tree Collapse file tree 3 files changed +17
-10
lines changed
Expand file tree Collapse file tree 3 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,9 @@ def get_response(
127127 if "error" in result :
128128 error = result ["error" ]
129129 message = error ["message" ]
130+ logger .warning (f"{ message = } " )
131+ if "retry" in message :
132+ return get_response (payload )
130133 raise Exception (message )
131134 return result
132135
Original file line number Diff line number Diff line change @@ -391,14 +391,15 @@ def get_window_segmentation(
391391 if DEBUG :
392392 original_image .show ()
393393
394- similar_segmentation , similar_segmentation_diff = find_similar_image_segmentation (
395- original_image ,
396- )
397- if similar_segmentation :
398- # TODO XXX: create copy of similar_segmentation, but overwrite with segments of
399- # regions of new image where segments of similar_segmentation overlap non-zero
400- # regions of similar_segmentation_diff
401- return similar_segmentation
394+ if not exceptions :
395+ similar_segmentation , similar_segmentation_diff = (
396+ find_similar_image_segmentation (original_image )
397+ )
398+ if similar_segmentation :
399+ # TODO XXX: create copy of similar_segmentation, but overwrite with segments
400+ # of regions of new image where segments of similar_segmentation overlap
401+ # non-zero regions of similar_segmentation_diff
402+ return similar_segmentation
402403
403404 segmentation_adapter = adapters .get_default_segmentation_adapter ()
404405 segmented_image = segmentation_adapter .fetch_segmented_image (original_image )
Original file line number Diff line number Diff line change @@ -591,7 +591,10 @@ def parse_code_snippet(snippet: str) -> dict:
591591 """
592592 code_block = extract_code_block (snippet )
593593 # remove backtick lines
594- code_content = "\n " .join (code_block .splitlines ()[1 :- 1 ])
594+ if "```" in code_block :
595+ code_content = "\n " .join (code_block .splitlines ()[1 :- 1 ])
596+ else :
597+ code_content = code_block
595598 # convert literals from Javascript to Python
596599 to_by_from = {
597600 "true" : "True" ,
@@ -637,7 +640,7 @@ def extract_code_block(text: str) -> str:
637640 raise ValueError ("Uneven number of backtick lines" )
638641
639642 if len (backtick_idxs ) < 2 :
640- return "" # No enclosing backticks found, return empty string
643+ return text
641644
642645 # Extract only the lines between the first and last backtick line,
643646 # including the backticks
You can’t perform that action at this time.
0 commit comments