From 65d33bcc0f50c8b7e2ee4c875d70fe3a3c866a94 Mon Sep 17 00:00:00 2001 From: UncleCode Date: Thu, 23 Jan 2025 22:36:58 +0800 Subject: [PATCH] style(docs): improve code formatting in features demo Clean up whitespace and improve readability in v0_4_3b2_features_demo.py: - Remove excessive blank lines between functions - Improve config formatting for better readability - Uncomment memory dispatcher demo in main function No breaking changes. --- docs/examples/v0_4_3b2_features_demo.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/docs/examples/v0_4_3b2_features_demo.py b/docs/examples/v0_4_3b2_features_demo.py index a3a7355b..7771c3f8 100644 --- a/docs/examples/v0_4_3b2_features_demo.py +++ b/docs/examples/v0_4_3b2_features_demo.py @@ -95,7 +95,6 @@ async def demo_memory_dispatcher(): except Exception as e: print(f"\nāŒ Error in memory dispatcher demo: {str(e)}") - async def demo_streaming_support(): """ 2. Streaming Support Demo @@ -127,7 +126,6 @@ async def demo_streaming_support(): if result.success: print(f"Content length: {len(result.markdown)}") - async def demo_content_scraping(): """ 3. Content Scraping Strategy Demo @@ -140,7 +138,10 @@ async def demo_content_scraping(): url = "https://example.com/article" # Configure with the new LXML strategy - config = CrawlerRunConfig(scraping_strategy=LXMLWebScrapingStrategy(), verbose=True) + config = CrawlerRunConfig( + scraping_strategy=LXMLWebScrapingStrategy(), + verbose=True + ) print("Scraping content with LXML strategy...") async with crawler: @@ -148,9 +149,6 @@ async def demo_content_scraping(): if result.success: print("Successfully scraped content using LXML strategy") - - - async def demo_llm_markdown(): """ 4. LLM-Powered Markdown Generation Demo @@ -201,7 +199,6 @@ async def demo_llm_markdown(): print(result.markdown_v2.fit_markdown[:500]) print("Successfully generated LLM-filtered markdown") - async def demo_robots_compliance(): """ 5. Robots.txt Compliance Demo @@ -225,8 +222,6 @@ async def demo_robots_compliance(): elif result.success: print(f"Successfully crawled: {result.url}") - - async def demo_json_schema_generation(): """ 7. LLM-Powered Schema Generation Demo @@ -280,7 +275,6 @@ async def demo_json_schema_generation(): print(json.dumps(result.extracted_content, indent=2) if result.extracted_content else None) print("Successfully used generated schema for crawling") - async def demo_proxy_rotation(): """ 8. Proxy Rotation Demo @@ -340,7 +334,7 @@ async def main(): # Efficiency & Speed Demos print("\nšŸš€ EFFICIENCY & SPEED DEMOS") - # await demo_memory_dispatcher() + await demo_memory_dispatcher() await demo_streaming_support() await demo_content_scraping()