Skip to content

Commit

Permalink
Additional Self typing for scheduler
Browse files Browse the repository at this point in the history
  • Loading branch information
elacuesta committed Jan 20, 2024
1 parent 4229048 commit 9b44d2b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions scrapy/core/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
from abc import abstractmethod
from pathlib import Path
from typing import TYPE_CHECKING, Any, Optional, Type, TypeVar, cast
from typing import TYPE_CHECKING, Any, cast, Optional, Protocol

from twisted.internet.defer import Deferred

Expand Down Expand Up @@ -121,9 +121,6 @@ def next_request(self) -> Optional[Request]:
raise NotImplementedError()


SchedulerTV = TypeVar("SchedulerTV", bound="Scheduler")


class Scheduler(BaseScheduler):
"""
Default Scrapy scheduler. This implementation also handles duplication
Expand Down Expand Up @@ -196,7 +193,7 @@ def __init__(
self.crawler: Optional[Crawler] = crawler

@classmethod
def from_crawler(cls: Type[SchedulerTV], crawler: Crawler) -> SchedulerTV:
def from_crawler(cls, crawler: Crawler) -> Self:
"""
Factory method, initializes the scheduler with arguments taken from the crawl settings
"""
Expand Down

0 comments on commit 9b44d2b

Please sign in to comment.