Repository: dask/dask (branch: milesgranger/10801-more-deprecations)
Commit date: 2024-01-22T11:17:55Z

Workflow file: .github/workflows/pre-commit.yml (Linting)
name: Linting

on:
  push:
    branches: main
  pull_request:
    branches: main

jobs:
  checks:
    name: pre-commit hooks
    runs-on: ubuntu-latest
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080
    steps:
      - uses: actions/checkout@v4.1.1
      - uses: actions/setup-python@v5
        with:
          python-version: '3.9'
      - uses: pre-commit/action@v3.0.0

env:
  PIP_INDEX_URL: http://localhost:8629/2024-01-22
  UV_INDEX_URL: http://localhost:8629/2024-01-22


Failed build logs:
step_name: pre-commit hooks/4_Run pre-commitaction@v3.0.0.txt
log: ##[group]Run pre-commit/action@v3.0.0
with:
  extra_args: --all-files
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
##[group]Run python -m pip install pre-commit
[36;1mpython -m pip install pre-commit[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
Collecting pre-commit
  Downloading pre_commit-3.6.0-py2.py3-none-any.whl.metadata (1.3 kB)
Collecting cfgv>=2.0.0 (from pre-commit)
  Downloading cfgv-3.4.0-py2.py3-none-any.whl.metadata (8.5 kB)
Collecting identify>=1.0.0 (from pre-commit)
  Downloading identify-2.5.33-py2.py3-none-any.whl.metadata (4.4 kB)
Collecting nodeenv>=0.11.1 (from pre-commit)
  Downloading nodeenv-1.8.0-py2.py3-none-any.whl.metadata (21 kB)
Collecting pyyaml>=5.1 (from pre-commit)
  Downloading PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting virtualenv>=20.10.0 (from pre-commit)
  Downloading virtualenv-20.25.0-py3-none-any.whl.metadata (4.5 kB)
Requirement already satisfied: setuptools in /opt/hostedtoolcache/Python/3.9.18/x64/lib/python3.9/site-packages (from nodeenv>=0.11.1->pre-commit) (58.1.0)
Collecting distlib<1,>=0.3.7 (from virtualenv>=20.10.0->pre-commit)
  Downloading distlib-0.3.8-py2.py3-none-any.whl.metadata (5.1 kB)
Collecting filelock<4,>=3.12.2 (from virtualenv>=20.10.0->pre-commit)
  Downloading filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting platformdirs<5,>=3.9.1 (from virtualenv>=20.10.0->pre-commit)
  Downloading platformdirs-4.1.0-py3-none-any.whl.metadata (11 kB)
Downloading pre_commit-3.6.0-py2.py3-none-any.whl (204 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 204.0/204.0 kB 19.7 MB/s eta 0:00:00
Downloading cfgv-3.4.0-py2.py3-none-any.whl (7.2 kB)
Downloading identify-2.5.33-py2.py3-none-any.whl (98 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 98.9/98.9 kB 27.0 MB/s eta 0:00:00
Downloading nodeenv-1.8.0-py2.py3-none-any.whl (22 kB)
Downloading PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (738 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 738.9/738.9 kB 80.2 MB/s eta 0:00:00
Downloading virtualenv-20.25.0-py3-none-any.whl (3.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.8/3.8 MB 114.1 MB/s eta 0:00:00
Downloading distlib-0.3.8-py2.py3-none-any.whl (468 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 468.9/468.9 kB 78.9 MB/s eta 0:00:00
Downloading filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading platformdirs-4.1.0-py3-none-any.whl (17 kB)
Installing collected packages: distlib, pyyaml, platformdirs, nodeenv, identify, filelock, cfgv, virtualenv, pre-commit
Successfully installed cfgv-3.4.0 distlib-0.3.8 filelock-3.13.1 identify-2.5.33 nodeenv-1.8.0 platformdirs-4.1.0 pre-commit-3.6.0 pyyaml-6.0.1 virtualenv-20.25.0

[notice] A new release of pip is available: 23.0.1 -> 23.3.2
[notice] To update, run: pip install --upgrade pip
##[group]Run python -m pip freeze --local
[36;1mpython -m pip freeze --local[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
cfgv==3.4.0
distlib==0.3.8
filelock==3.13.1
identify==2.5.33
nodeenv==1.8.0
platformdirs==4.1.0
pre-commit==3.6.0
PyYAML==6.0.1
virtualenv==20.25.0
##[group]Run actions/cache@v3
with:
  path: ~/.cache/pre-commit
  key: pre-commit-3|/opt/hostedtoolcache/Python/3.9.18/x64|2f6023be5c7e4f75d9ed9a00c3fcb4c3fa7d8493a70885078264f9accc27f632
  enableCrossOsArchive: false
  fail-on-cache-miss: false
  lookup-only: false
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
Received 0 of 69094681 (0.0%), 0.0 MBs/sec
Cache Size: ~66 MB (69094681 B)
[command]/usr/bin/tar -xf /home/runner/work/_temp/2e80fd5c-4883-4bdb-be22-ed0a545b7db7/cache.tzst -P -C /home/runner/work/dask/dask --use-compress-program unzstd
Received 69094681 of 69094681 (100.0%), 32.9 MBs/sec
Cache restored successfully
Cache restored from key: pre-commit-3|/opt/hostedtoolcache/Python/3.9.18/x64|2f6023be5c7e4f75d9ed9a00c3fcb4c3fa7d8493a70885078264f9accc27f632
##[group]Run pre-commit run --show-diff-on-failure --color=always --all-files
[36;1mpre-commit run --show-diff-on-failure --color=always --all-files[0m
shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
fix end of files.........................................................[42mPassed[m
debug statements (python)................................................[42mPassed[m
absolufy-imports.........................................................[42mPassed[m
isort....................................................................[42mPassed[m
pyupgrade................................................................[42mPassed[m
black....................................................................[41mFailed[m
[2m- hook id: black[m
[2m- files were modified by this hook[m

[1mreformatted dask/utils.py[0m

[1mAll done! ✨ 🍰 ✨[0m
[34m[1m1 file [0m[1mreformatted[0m, [34m257 files [0mleft unchanged.

flake8...................................................................[42mPassed[m
codespell................................................................[42mPassed[m
mypy.....................................................................[41mFailed[m
[2m- hook id: mypy[m
[2m- exit code: 1[m

dask/utils.py:231: error: Unsupported operand types for + ("str" and "None")  [operator]
dask/utils.py:231: note: Right operand is of type "Optional[str]"
dask/utils.py:257: error: Unsupported operand types for + ("str" and "None")  [operator]
dask/utils.py:257: note: Right operand is of type "Optional[str]"
Found 2 errors in 1 file (checked 258 source files)

pre-commit hook(s) made changes.
If you are seeing this message in CI, reproduce locally with: `pre-commit run --all-files`.
To run `pre-commit` as part of git workflow, use `pre-commit install`.
All changes made by hooks:
[1mdiff --git a/dask/utils.py b/dask/utils.py[m
[1mindex 80ea6e8..26f1176 100644[m
[1m--- a/dask/utils.py[m
[1m+++ b/dask/utils.py[m
[36m@@ -148,7 +148,7 @@[m [mdef _deprecated_kwarg([m
     new_arg_name: str | None = None,[m
     mapping: Mapping[Any, Any] | Callable[[Any], Any] | None = None,[m
     stacklevel: int = 2,[m
[31m-    comment: str | None = None[m
[32m+[m[32m    comment: str | None = None,[m
 ) -> Callable[[F], F]:[m
     """[m
     Decorator to deprecate a keyword argument of a function.[m
##[error]Process completed with exit code 1.


Changed files:
dask/utils.py

Fix diff:
diff --git a/dask/utils.py b/dask/utils.py
index 80ea6e8d6..0da2953c8 100644
--- a/dask/utils.py
+++ b/dask/utils.py
@@ -148,7 +148,7 @@ def _deprecated_kwarg(
     new_arg_name: str | None = None,
     mapping: Mapping[Any, Any] | Callable[[Any], Any] | None = None,
     stacklevel: int = 2,
-    comment: str | None = None
+    comment: str | None = None,
 ) -> Callable[[F], F]:
     """
     Decorator to deprecate a keyword argument of a function.
@@ -219,7 +219,7 @@ def _deprecated_kwarg(
             "mapping from old to new argument values must be dict or callable!"
         )
 
-    comment = f"\n{comment}" or ""
+    comment_ = f"\n{comment}" or ""
 
     def _deprecated_kwarg(func: F) -> F:
         @wraps(func)
@@ -232,7 +232,7 @@ def _deprecated_kwarg(
                         f"the {repr(old_arg_name)} keyword is deprecated and "
                         "will be removed in a future version. Please take "
                         f"steps to stop the use of {repr(old_arg_name)}"
-                    ) + comment
+                    ) + comment_
                     warnings.warn(msg, FutureWarning, stacklevel=stacklevel)
                     kwargs[old_arg_name] = old_arg_value
                     return func(*args, **kwargs)
@@ -254,7 +254,7 @@ def _deprecated_kwarg(
                         f"use {repr(new_arg_name)} instead."
                     )
 
-                warnings.warn(msg + comment, FutureWarning, stacklevel=stacklevel)
+                warnings.warn(msg + comment_, FutureWarning, stacklevel=stacklevel)
                 if kwargs.get(new_arg_name) is not None:
                     msg = (
                         f"Can only specify {repr(old_arg_name)} "