Refactor imports for PEP 8 compliance and clarity

- Organized imports in browser_manager.py by category (stdlib, 3rd-party, local)
- Organized imports in browser_profiler.py by category
- Cleaned up test file imports for consistency
- All imports alphabetized within their categories

Co-authored-by: Ahmed-Tawfik94 <106467151+Ahmed-Tawfik94@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-06 08:18:48 +00:00
parent 7037021496
commit 2507720cc7
3 changed files with 35 additions and 22 deletions

View File

@@ -1,21 +1,26 @@
# Standard library imports
import asyncio
import time
from typing import List, Optional
import hashlib
import os
import sys
import shlex
import shutil
import tempfile
import psutil
import signal
import subprocess
import shlex
from playwright.async_api import BrowserContext
import hashlib
from .js_snippet import load_js_script
from .config import DOWNLOAD_PAGE_TIMEOUT
from .async_configs import BrowserConfig, CrawlerRunConfig
from .utils import get_chromium_path
import sys
import tempfile
import time
import warnings
from typing import List, Optional
# Third-party imports
import psutil
from playwright.async_api import BrowserContext
# Local imports
from .async_configs import BrowserConfig, CrawlerRunConfig
from .config import DOWNLOAD_PAGE_TIMEOUT
from .js_snippet import load_js_script
from .utils import get_chromium_path
BROWSER_DISABLE_OPTIONS = [

View File

@@ -5,22 +5,26 @@ This module provides a dedicated class for managing browser profiles
that can be used for identity-based crawling with Crawl4AI.
"""
import os
# Standard library imports
import asyncio
import signal
import sys
import datetime
import uuid
import shutil
import json
import os
import shutil
import signal
import subprocess
import sys
import time
from typing import List, Dict, Optional, Any
import uuid
from typing import Any, Dict, List, Optional
# Third-party imports
from rich.console import Console
# Local imports
from .async_configs import BrowserConfig
from .browser_manager import ManagedBrowser
from .async_logger import AsyncLogger, AsyncLoggerBase, LogColor
from .browser_manager import ManagedBrowser
from .utils import get_home_folder

View File

@@ -8,15 +8,19 @@ in managed browsers (CDP mode) work correctly, particularly:
3. Multiple concurrent arun_many calls work correctly
"""
# Standard library imports
import asyncio
import pytest
import sys
import os
import sys
# Third-party imports
import pytest
# Add the project root to Python path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
from crawl4ai import AsyncWebCrawler, BrowserConfig, CrawlerRunConfig, CacheMode
# Local imports
from crawl4ai import AsyncWebCrawler, BrowserConfig, CacheMode, CrawlerRunConfig
@pytest.mark.asyncio