Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewZMSU committed Nov 28, 2024
1 parent 61e82f9 commit fbbb374
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
14 changes: 5 additions & 9 deletions scrapypuppeteer/browser_managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import uuid
from abc import ABC, abstractmethod
from collections.abc import Coroutine
from typing import Union, Dict
from typing import Dict, Union

from scrapy import Request
from scrapy.utils.defer import deferred_from_coro
Expand All @@ -21,18 +21,15 @@ def __init__(self, browser):

@classmethod
@abstractmethod
async def async_init(cls):
...
async def async_init(cls): ...

@staticmethod
@abstractmethod
async def _create_context(browser):
...
async def _create_context(browser): ...

@staticmethod
@abstractmethod
async def _create_page(context):
...
async def _create_page(context): ...

async def check_context_and_page(self, context_id, page_id):
if not context_id or not page_id:
Expand Down Expand Up @@ -71,8 +68,7 @@ class BrowserManager(ABC):
@abstractmethod
def _download_request(
self, request: Request, spider
) -> Union[Coroutine, Request]:
...
) -> Union[Coroutine, Request]: ...

@abstractmethod
async def _start_browser_manager(self) -> None: ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from scrapypuppeteer.browser_managers.playwright_browser_manager import (
PlaywrightBrowserManager,
)
from scrapypuppeteer.browser_managers.pyppeteer_browser_manager import PyppeteerBrowserManager

from scrapypuppeteer.browser_managers.pyppeteer_browser_manager import (
PyppeteerBrowserManager,
)
from scrapypuppeteer.browser_managers.service_browser_manager import (
ServiceBrowserManager,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
from scrapy.http import TextResponse

from scrapypuppeteer import PuppeteerRequest
from scrapypuppeteer.browser_managers import BrowserManager
from scrapypuppeteer.browser_managers import BrowserManager, ContextManager
from scrapypuppeteer.request import ActionRequest, CloseContextRequest
from scrapypuppeteer.browser_managers import ContextManager


class PlaywrightContextManager(ContextManager):
Expand Down
4 changes: 2 additions & 2 deletions scrapypuppeteer/browser_managers/pyppeteer_browser_manager.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import asyncio
import base64
from json import dumps
from typing import Dict, Callable, Awaitable, Any, Union
from typing import Any, Awaitable, Callable, Dict, Union

from pyppeteer import launch
from scrapy.http import TextResponse

from scrapypuppeteer.browser_managers import BrowserManager, ContextManager
from scrapypuppeteer.request import CloseContextRequest, PuppeteerRequest, ActionRequest
from scrapypuppeteer.request import ActionRequest, CloseContextRequest, PuppeteerRequest


class PyppeteerContextManager(ContextManager):
Expand Down

0 comments on commit fbbb374

Please sign in to comment.