mirror of https://github.com/scrapy/scrapy.git
Add flake8-pyi rules to ruff.
This commit is contained in:
parent
93644f2c30
commit
c2832ed131
|
|
@ -244,6 +244,8 @@ extend-select = [
|
|||
"PGH",
|
||||
# flake8-pie
|
||||
"PIE",
|
||||
# flake8-pyi
|
||||
"PYI",
|
||||
# flake8-quotes
|
||||
"Q",
|
||||
# flake8-return
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ enable this middleware and enable the ROBOTSTXT_OBEY setting.
|
|||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
from typing import TYPE_CHECKING, TypeVar
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from twisted.internet.defer import Deferred, maybeDeferred
|
||||
|
||||
|
|
@ -31,8 +31,6 @@ if TYPE_CHECKING:
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
class RobotsTxtMiddleware:
|
||||
DOWNLOAD_PRIORITY: int = 1000
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ For actual link extractors implementation see scrapy.linkextractors, or
|
|||
its documentation in: docs/topics/link-extractors.rst
|
||||
"""
|
||||
|
||||
from typing import Any
|
||||
|
||||
|
||||
class Link:
|
||||
"""Link objects represent an extracted link by the LinkExtractor.
|
||||
|
|
@ -39,7 +37,7 @@ class Link:
|
|||
self.fragment: str = fragment
|
||||
self.nofollow: bool = nofollow
|
||||
|
||||
def __eq__(self, other: Any) -> bool:
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if not isinstance(other, Link):
|
||||
raise NotImplementedError
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -5,16 +5,7 @@ import logging
|
|||
import warnings
|
||||
from abc import ABC, abstractmethod
|
||||
from collections import defaultdict
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Literal,
|
||||
NoReturn,
|
||||
TypedDict,
|
||||
TypeVar,
|
||||
Union,
|
||||
cast,
|
||||
)
|
||||
from typing import TYPE_CHECKING, Any, Literal, NoReturn, TypedDict, Union, cast
|
||||
|
||||
from twisted import version as twisted_version
|
||||
from twisted.internet.defer import Deferred, DeferredList
|
||||
|
|
@ -41,8 +32,6 @@ if TYPE_CHECKING:
|
|||
from scrapy.http import Response
|
||||
from scrapy.utils.request import RequestFingerprinter
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
class FileInfo(TypedDict):
|
||||
url: str
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ def get_meta_refresh(
|
|||
return _metaref_cache[response]
|
||||
|
||||
|
||||
def response_status_message(status: bytes | float | int | str) -> str:
|
||||
def response_status_message(status: bytes | float | str) -> str:
|
||||
"""Return status code plus status text descriptive message"""
|
||||
status_int = int(status)
|
||||
message = http.RESPONSES.get(status_int, "Unknown Status")
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import collections
|
||||
import shutil
|
||||
import tempfile
|
||||
import unittest
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
from twisted.internet import defer
|
||||
from twisted.trial.unittest import TestCase
|
||||
|
|
@ -18,8 +18,13 @@ from scrapy.utils.misc import load_object
|
|||
from scrapy.utils.test import get_crawler
|
||||
from tests.mockserver import MockServer
|
||||
|
||||
MockEngine = collections.namedtuple("MockEngine", ["downloader"])
|
||||
MockSlot = collections.namedtuple("MockSlot", ["active"])
|
||||
|
||||
class MockEngine(NamedTuple):
|
||||
downloader: MockDownloader
|
||||
|
||||
|
||||
class MockSlot(NamedTuple):
|
||||
active: list[Any]
|
||||
|
||||
|
||||
class MockDownloader:
|
||||
|
|
|
|||
Loading…
Reference in New Issue