(url: str, sections: list, provider: str, api_token: str, base_url=None)
| 950 | return merged_sections |
| 951 | |
| 952 | def process_sections(url: str, sections: list, provider: str, api_token: str, base_url=None) -> list: |
| 953 | extracted_content = [] |
| 954 | if provider.startswith("groq/"): |
| 955 | # Sequential processing with a delay |
| 956 | for section in sections: |
| 957 | extracted_content.extend(extract_blocks(url, section, provider, api_token, base_url=base_url)) |
| 958 | time.sleep(0.5) # 500 ms delay between each processing |
| 959 | else: |
| 960 | # Parallel processing using ThreadPoolExecutor |
| 961 | with ThreadPoolExecutor() as executor: |
| 962 | futures = [executor.submit(extract_blocks, url, section, provider, api_token, base_url=base_url) for section in sections] |
| 963 | for future in as_completed(futures): |
| 964 | extracted_content.extend(future.result()) |
| 965 | |
| 966 | return extracted_content |
| 967 | |
| 968 | def wrap_text(draw, text, font, max_width): |
| 969 | # Wrap the text to fit within the specified width |
nothing calls this directly
no test coverage detected
searching dependent graphs…