Repository: scrapy/scrapy (branch: component-getters)
Commit date: 2023-12-19T10:41:55Z

Workflow file: .github/workflows/checks.yml (Checks)
name: Checks
on: [push, pull_request]

concurrency:
  group: ${{github.workflow}}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  checks:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    strategy:
      fail-fast: false
      matrix:
        include:
        - python-version: "3.12"
          env:
            TOXENV: pylint
        - python-version: 3.8
          env:
            TOXENV: typing
        - python-version: "3.11"  # Keep in sync with .readthedocs.yml
          env:
            TOXENV: docs
        - python-version: "3.12"
          env:
            TOXENV: twinecheck

    steps:
    - uses: actions/checkout@v4

    - name: Set up Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}

    - name: Run check
      env: ${{ matrix.env }}
      run: |
        pip install -U tox
        tox

  pre-commit:
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    steps:
    - uses: actions/checkout@v4
    - uses: pre-commit/action@v3.0.0

env:
  PIP_INDEX_URL: http://localhost:8629/2023-12-19
  UV_INDEX_URL: http://localhost:8629/2023-12-19


Failed build logs:
step_name: checks (3.12, pylint)/4_Run check.txt
log: ##[group]Run pip install -U tox
[36;1mpip install -U tox[0m
[36;1mtox[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.12.1/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.1/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.1/x64/lib
  TOXENV: pylint
##[endgroup]
Collecting tox
  Downloading tox-4.11.4-py3-none-any.whl.metadata (5.0 kB)
Collecting cachetools>=5.3.1 (from tox)
  Downloading cachetools-5.3.2-py3-none-any.whl.metadata (5.2 kB)
Collecting chardet>=5.2 (from tox)
  Downloading chardet-5.2.0-py3-none-any.whl.metadata (3.4 kB)
Collecting colorama>=0.4.6 (from tox)
  Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Collecting filelock>=3.12.3 (from tox)
  Downloading filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting packaging>=23.1 (from tox)
  Downloading packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
Collecting platformdirs>=3.10 (from tox)
  Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)
Collecting pluggy>=1.3 (from tox)
  Downloading pluggy-1.3.0-py3-none-any.whl.metadata (4.3 kB)
Collecting pyproject-api>=1.6.1 (from tox)
  Downloading pyproject_api-1.6.1-py3-none-any.whl.metadata (2.8 kB)
Collecting virtualenv>=20.24.3 (from tox)
  Downloading virtualenv-20.25.0-py3-none-any.whl.metadata (4.5 kB)
Collecting distlib<1,>=0.3.7 (from virtualenv>=20.24.3->tox)
  Downloading distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB)
Downloading tox-4.11.4-py3-none-any.whl (153 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 154.0/154.0 kB 16.6 MB/s eta 0:00:00
Downloading cachetools-5.3.2-py3-none-any.whl (9.3 kB)
Downloading chardet-5.2.0-py3-none-any.whl (199 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 199.4/199.4 kB 48.7 MB/s eta 0:00:00
Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading packaging-23.2-py3-none-any.whl (53 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 53.0/53.0 kB 16.1 MB/s eta 0:00:00
Downloading platformdirs-4.1.0-py3-none-any.whl (17 kB)
Downloading pluggy-1.3.0-py3-none-any.whl (18 kB)
Downloading pyproject_api-1.6.1-py3-none-any.whl (12 kB)
Downloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 104.2 MB/s eta 0:00:00
Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 kB 81.3 MB/s eta 0:00:00
Installing collected packages: distlib, pluggy, platformdirs, packaging, filelock, colorama, chardet, cachetools, virtualenv, pyproject-api, tox
Successfully installed cachetools-5.3.2 chardet-5.2.0 colorama-0.4.6 distlib-0.3.8 filelock-3.13.1 packaging-23.2 platformdirs-4.1.0 pluggy-1.3.0 pyproject-api-1.6.1 tox-4.11.4 virtualenv-20.25.0

[notice] A new release of pip is available: 23.3.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
pylint: install_deps> python -I -m pip install -ctests/upper-constraints.txt boto3 google-cloud-storage 'markupsafe<2.1.0' 'mitmproxy<8,>=4.0.4; python_version < "3.9" and implementation_name != "pypy"' Pillow pylint==3.0.1 robotexclusionrulesparser 'Twisted[http2]' -r tests/requirements.txt
.pkg: install_requires> python -I -m pip install 'setuptools>=40.8.0' wheel
.pkg: _optional_hooks> python /opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_wheel> python /opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: install_requires_for_build_wheel> python -I -m pip install wheel
.pkg: freeze> python -m pip freeze --all
.pkg: pip==23.3.1,setuptools==69.0.2,wheel==0.42.0
.pkg: prepare_metadata_for_build_wheel> python /opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_sdist> python /opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
pylint: install_package_deps> python -I -m pip install -ctests/upper-constraints.txt 'PyDispatcher>=2.0.5; platform_python_implementation == "CPython"' 'PyPyDispatcher>=2.1.0; platform_python_implementation == "PyPy"' 'Twisted>=18.9.0' 'cryptography>=36.0.0' 'cssselect>=0.9.1' 'itemadapter>=0.1.0' 'itemloaders>=1.0.1' 'lxml>=4.4.1' packaging 'parsel>=1.5.0' 'protego>=0.1.15' 'pyOpenSSL>=21.0.0' 'queuelib>=1.4.2' 'service-identity>=18.1.0' setuptools tldextract 'w3lib>=1.17.0' 'zope.interface>=5.1.0'
pylint: install_package> python -I -m pip install -ctests/upper-constraints.txt --force-reinstall --no-deps /home/runner/work/scrapy/scrapy/.tox/.tmp/package/1/Scrapy-2.11.0.tar.gz
pylint: freeze> python -m pip freeze --all
pylint: astroid==3.0.2,asttokens==2.4.1,attrs==23.1.0,Automat==22.10.0,blessed==1.20.0,boto3==1.34.3,botocore==1.34.3,bpython==0.24,Brotli==1.1.0,cachetools==5.3.2,certifi==2023.11.17,cffi==1.16.0,charset-normalizer==3.3.2,constantly==23.10.4,coverage==7.3.3,cryptography==41.0.7,cssselect==1.2.0,curtsies==0.4.2,cwcwidth==0.1.9,decorator==5.1.1,dill==0.3.7,execnet==2.0.2,executing==2.0.1,filelock==3.13.1,google-api-core==2.15.0,google-auth==2.25.2,google-cloud-core==2.4.1,google-cloud-storage==2.14.0,google-crc32c==1.5.0,google-resumable-media==2.7.0,googleapis-common-protos==1.62.0,greenlet==3.0.2,h2==4.1.0,hpack==4.0.0,hyperframe==6.0.1,hyperlink==21.0.0,idna==3.6,incremental==22.10.0,iniconfig==2.0.0,ipython==8.18.1,isort==5.13.2,itemadapter==0.8.0,itemloaders==1.1.0,jedi==0.19.1,jmespath==1.0.1,lxml==4.9.3,MarkupSafe==2.0.1,matplotlib-inline==0.1.6,mccabe==0.7.0,packaging==23.2,parsel==1.8.1,parso==0.8.3,pexpect==4.9.0,Pillow==10.1.0,pip==23.3.2,platformdirs==4.1.0,pluggy==1.3.0,priority==1.3.0,prompt-toolkit==3.0.43,Protego==0.3.0,protobuf==4.25.1,ptyprocess==0.7.0,pure-eval==0.2.2,pyasn1==0.5.1,pyasn1-modules==0.3.0,pycparser==2.21,PyDispatcher==2.0.7,pyftpdlib==1.5.9,Pygments==2.17.2,pylint==3.0.1,pyOpenSSL==23.3.0,pytest==7.4.3,pytest-cov==4.0.0,pytest-xdist==3.5.0,python-dateutil==2.8.2,pyxdg==0.28,queuelib==1.6.2,requests==2.31.0,requests-file==1.5.1,robotexclusionrulesparser==1.7.1,rsa==4.9,s3transfer==0.9.0,Scrapy @ file:///home/runner/work/scrapy/scrapy/.tox/.tmp/package/1/Scrapy-2.11.0.tar.gz#sha256=6f43aa5d37ec10736bd947dbba89df54ebc97175083ab360a721b3360f0d895b,service-identity==23.1.0,setuptools==69.0.2,six==1.16.0,stack-data==0.6.3,sybil==6.0.2,testfixtures==7.2.2,tldextract==5.1.1,tomlkit==0.12.3,traitlets==5.14.0,Twisted==23.10.0,typing_extensions==4.9.0,urllib3==2.0.7,uvloop==0.19.0,w3lib==2.1.2,wcwidth==0.2.12,zope.interface==6.1,zstandard==0.22.0
pylint: commands[0]> pylint conftest.py docs extras scrapy setup.py tests
<unknown>:230: SyntaxWarning: invalid escape sequence '\d'
************* Module scrapy.crawler
scrapy/crawler.py:182:4: W0211: Static method with 'cls' as first argument (bad-staticmethod-argument)
scrapy/crawler.py:184:15: C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)

------------------------------------
Your code has been rated at 10.00/10

pylint: exit 20 (56.60 seconds) /home/runner/work/scrapy/scrapy> pylint conftest.py docs extras scrapy setup.py tests pid=2086
.pkg: _exit> python /opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  pylint: FAIL code 20 (100.72=setup[44.12]+cmd[56.60] seconds)
  evaluation failed :( (100.86 seconds)
##[error]Process completed with exit code 20.


Changed files:
scrapy/crawler.py

Fix diff:
diff --git a/scrapy/crawler.py b/scrapy/crawler.py
index 76f4048e4..333b39f33 100644
--- a/scrapy/crawler.py
+++ b/scrapy/crawler.py
@@ -179,9 +179,12 @@ class Crawler:
             yield maybeDeferred(self.engine.stop)
 
     @staticmethod
-    def _get_component(cls, components):
+    def _get_component(component_class, components):
         for component in components:
-            if type(component) is cls:
+            if (
+                type(component)  # pylint: disable=unidiomatic-typecheck
+                is component_class
+            ):
                 return component
         return None