Repository: dask/dask
Pull request #11098 (2024-05-05 09:46:05)

Apply ruff/flake8-implicit-str-concat rule ISC001
	ISC001 Implicitly concatenated string literals on one line

This rule is currently disabled because it conflicts with the ruff formatter:
	https://github.com/astral-sh/ruff/issues/8272

- [ ] Closes #xxxx
- [ ] Tests added / passed
- [x] Passes `pre-commit run --all-files`


GPUtester: Can one of the admins verify this patch?

Admins can comment `ok to test` to allow this one PR to run or `add to allowlist` to allow all future PRs from the same author to run.
github-actions[bot]: ## Unit Test Results
_See [test report](https://dask.github.io/dask/test_report.html) for an extended history of previous test failures. This is useful for diagnosing flaky tests._

     15 files  ±0       15 suites  ±0   3h 22m 56s :stopwatch: + 3m 22s
 13 121 tests ±0   11 730 :white_check_mark: ±0     931 :zzz: ±0  460 :x: ±0 
162 468 runs  ±0  141 923 :white_check_mark: +3  20 085 :zzz:  - 3  460 :x: ±0 

For more details on these failures, see [this check](https://github.com/dask/dask/runs/24600762847).

Results for commit 4f5aa901. ± Comparison against base commit 067c668a.

[test-results]:data:application/gzip;base64,H4sIAJxeN2YC/1XMyw7CIBCF4VdpWLvgOhRfxuAACbEXQ2HV+O7SaosuzzeTfyUhDn4h146pS0eWEnNbriSb4zxtmzMNleo173dR5di3pSBuyLSgDR/xWdGI9hdsHCpJaF8+pTlV2ySVaW8Dl9B/99mWzHBx4qfNKe3VYX/xXX7bOI9jzHUQGZS1hrJAwUnkvabKGUTtvaSgEUAyd2foyOsNoPVUkR0BAAA=


Patch:
diff --git a/dask/array/core.py b/dask/array/core.py
index 74c11f76d..f4420cfef 100644
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -42,7 +42,7 @@ from dask.array.dispatch import (  # noqa: F401
     einsum_lookup,
     tensordot_lookup,
 )
-from dask.array.numpy_compat import _Recurser
+from dask.array.numpy_compat import NUMPY_GE_200, _Recurser
 from dask.array.slicing import replace_ellipsis, setitem_array, slice_array
 from dask.base import (
     DaskMethodsMixin,
@@ -3472,7 +3472,7 @@ def from_array(
     """
     if isinstance(x, Array):
         raise ValueError(
-            "Array is already a dask array. Use 'asarray' or " "'rechunk' instead."
+            "Array is already a dask array. Use 'asarray' or 'rechunk' instead."
         )
     elif is_dask_collection(x):
         warnings.warn(
@@ -5035,7 +5035,10 @@ def broadcast_arrays(*args, subok=False):
     shape = broadcast_shapes(*(e.shape for e in args))
     chunks = broadcast_chunks(*(e.chunks for e in args))
 
-    result = [broadcast_to(e, shape=shape, chunks=chunks) for e in args]
+    if NUMPY_GE_200:
+        result = tuple(broadcast_to(e, shape=shape, chunks=chunks) for e in args)
+    else:
+        result = [broadcast_to(e, shape=shape, chunks=chunks) for e in args]
 
     return result
 
diff --git a/dask/array/overlap.py b/dask/array/overlap.py
index 9a94065c3..76e8680a3 100644
--- a/dask/array/overlap.py
+++ b/dask/array/overlap.py
@@ -354,7 +354,7 @@ def ensure_minimum_chunksize(size, chunks):
         output[-1] += new
     else:
         raise ValueError(
-            f"The overlapping depth {size} is larger than your " f"array {sum(chunks)}."
+            f"The overlapping depth {size} is larger than your array {sum(chunks)}."
         )
 
     return tuple(output)
diff --git a/dask/array/slicing.py b/dask/array/slicing.py
index 9246c9cf1..29da273f9 100644
--- a/dask/array/slicing.py
+++ b/dask/array/slicing.py
@@ -2158,7 +2158,7 @@ def setitem(x, v, indices):
         x[tuple(indices)] = v
     except ValueError as e:
         raise ValueError(
-            "shape mismatch: value array could " "not be broadcast to indexing result"
+            "shape mismatch: value array could not be broadcast to indexing result"
         ) from e
 
     return x
diff --git a/dask/cache.py b/dask/cache.py
index b07adb886..ee2f06179 100644
--- a/dask/cache.py
+++ b/dask/cache.py
@@ -35,7 +35,7 @@ class Cache(Callback):
             import cachey
         except ImportError as ex:
             raise ImportError(
-                'Cache requires cachey, "{ex}" problem ' "importing".format(ex=str(ex))
+                f'Cache requires cachey, "{str(ex)}" problem importing'
             ) from ex
         self._nbytes = cachey.nbytes
         if isinstance(cache, Number):
diff --git a/dask/dataframe/io/json.py b/dask/dataframe/io/json.py
index 2f3e2790b..79df964c6 100644
--- a/dask/dataframe/io/json.py
+++ b/dask/dataframe/io/json.py
@@ -73,9 +73,7 @@ def to_json(
     if lines is None:
         lines = orient == "records"
     if orient != "records" and lines:
-        raise ValueError(
-            "Line-delimited JSON is only available with" 'orient="records".'
-        )
+        raise ValueError('Line-delimited JSON is only available with orient="records".')
     kwargs["orient"] = orient
     kwargs["lines"] = lines and orient == "records"
     outfiles = open_files(
@@ -200,9 +198,7 @@ def read_json(
     if lines is None:
         lines = orient == "records"
     if orient != "records" and lines:
-        raise ValueError(
-            "Line-delimited JSON is only available with" 'orient="records".'
-        )
+        raise ValueError('Line-delimited JSON is only available with orient="records".')
     if blocksize and (orient != "records" or not lines):
         raise ValueError(
             "JSON file chunking only allowed for JSON-lines"


Test patch:
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
index 68aa57410..842090546 100644
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -1108,7 +1108,7 @@ def test_broadcast_arrays():
     a_r = np.broadcast_arrays(a_0, a_1)
     d_r = da.broadcast_arrays(d_a_0, d_a_1)
 
-    assert isinstance(d_r, list)
+    assert isinstance(d_r, (list, tuple))
     assert len(a_r) == len(d_r)
 
     for e_a_r, e_d_r in zip(a_r, d_r):
diff --git a/dask/bytes/tests/test_local.py b/dask/bytes/tests/test_local.py
index 85450f40c..009a5c084 100644
--- a/dask/bytes/tests/test_local.py
+++ b/dask/bytes/tests/test_local.py
@@ -38,9 +38,9 @@ files = {
 
 
 csv_files = {
-    ".test.fakedata.1.csv": (b"a,b\n" b"1,2\n"),
-    ".test.fakedata.2.csv": (b"a,b\n" b"3,4\n"),
-    "subdir/.test.fakedata.2.csv": (b"a,b\n" b"5,6\n"),
+    ".test.fakedata.1.csv": (b"a,b\n1,2\n"),
+    ".test.fakedata.2.csv": (b"a,b\n3,4\n"),
+    "subdir/.test.fakedata.2.csv": (b"a,b\n5,6\n"),
 }
 
 
diff --git a/dask/dataframe/io/tests/test_csv.py b/dask/dataframe/io/tests/test_csv.py
index d1e22427d..1cc22394b 100644
--- a/dask/dataframe/io/tests/test_csv.py
+++ b/dask/dataframe/io/tests/test_csv.py
@@ -102,13 +102,9 @@ Date,Open,High,Low,Close,Volume,Adj Close
 """.strip()
 
 csv_files = {
-    "2014-01-01.csv": (
-        b"name,amount,id\n" b"Alice,100,1\n" b"Bob,200,2\n" b"Charlie,300,3\n"
-    ),
+    "2014-01-01.csv": b"name,amount,id\nAlice,100,1\nBob,200,2\nCharlie,300,3\n",
     "2014-01-02.csv": b"name,amount,id\n",
-    "2014-01-03.csv": (
-        b"name,amount,id\n" b"Dennis,400,4\n" b"Edith,500,5\n" b"Frank,600,6\n"
-    ),
+    "2014-01-03.csv": b"name,amount,id\nDennis,400,4\nEdith,500,5\nFrank,600,6\n",
 }
 
 tsv_files = {k: v.replace(b",", b"\t") for (k, v) in csv_files.items()}
diff --git a/dask/dataframe/io/tests/test_sql.py b/dask/dataframe/io/tests/test_sql.py
index 9157372dc..705923870 100644
--- a/dask/dataframe/io/tests/test_sql.py
+++ b/dask/dataframe/io/tests/test_sql.py
@@ -64,7 +64,7 @@ def test_empty(db):
 
 
 @pytest.mark.filterwarnings(
-    "ignore:The default dtype for empty Series " "will be 'object' instead of 'float64'"
+    "ignore:The default dtype for empty Series will be 'object' instead of 'float64'"
 )
 @pytest.mark.parametrize("use_head", [True, False])
 def test_single_column(db, use_head):