Skip to content

Commit ba4708f

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 995eae7 commit ba4708f

29 files changed

+736
-227
lines changed

benchmarks/benchmark_gcxs.py

+24-10
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
class MatrixMultiplySuite:
77
def setup(self):
88
rng = np.random.default_rng(0)
9-
self.x = sparse.random((100, 100), density=0.01, format="gcxs", random_state=rng)
10-
self.y = sparse.random((100, 100), density=0.01, format="gcxs", random_state=rng)
9+
self.x = sparse.random(
10+
(100, 100), density=0.01, format="gcxs", random_state=rng
11+
)
12+
self.y = sparse.random(
13+
(100, 100), density=0.01, format="gcxs", random_state=rng
14+
)
1115

1216
self.x @ self.y # Numba compilation
1317

@@ -18,8 +22,12 @@ def time_matmul(self):
1822
class ElemwiseSuite:
1923
def setup(self):
2024
rng = np.random.default_rng(0)
21-
self.x = sparse.random((100, 100, 100), density=0.01, format="gcxs", random_state=rng)
22-
self.y = sparse.random((100, 100, 100), density=0.01, format="gcxs", random_state=rng)
25+
self.x = sparse.random(
26+
(100, 100, 100), density=0.01, format="gcxs", random_state=rng
27+
)
28+
self.y = sparse.random(
29+
(100, 100, 100), density=0.01, format="gcxs", random_state=rng
30+
)
2331

2432
self.x + self.y # Numba compilation
2533

@@ -33,8 +41,12 @@ def time_mul(self):
3341
class ElemwiseBroadcastingSuite:
3442
def setup(self):
3543
rng = np.random.default_rng(0)
36-
self.x = sparse.random((100, 1, 100), density=0.01, format="gcxs", random_state=rng)
37-
self.y = sparse.random((100, 100), density=0.01, format="gcxs", random_state=rng)
44+
self.x = sparse.random(
45+
(100, 1, 100), density=0.01, format="gcxs", random_state=rng
46+
)
47+
self.y = sparse.random(
48+
(100, 100), density=0.01, format="gcxs", random_state=rng
49+
)
3850

3951
def time_add(self):
4052
self.x + self.y
@@ -47,7 +59,9 @@ class IndexingSuite:
4759
def setup(self):
4860
rng = np.random.default_rng(0)
4961
self.index = rng.integers(0, 100, 50)
50-
self.x = sparse.random((100, 100, 100), density=0.01, format="gcxs", random_state=rng)
62+
self.x = sparse.random(
63+
(100, 100, 100), density=0.01, format="gcxs", random_state=rng
64+
)
5165

5266
# Numba compilation
5367
self.x[5]
@@ -76,9 +90,9 @@ class DenseMultiplySuite:
7690
def setup(self, compressed_axis, n_vecs):
7791
rng = np.random.default_rng(1337)
7892
n = 10000
79-
x = sparse.random((n, n), density=0.001, format="gcxs", random_state=rng).change_compressed_axes(
80-
(compressed_axis,)
81-
)
93+
x = sparse.random(
94+
(n, n), density=0.001, format="gcxs", random_state=rng
95+
).change_compressed_axes((compressed_axis,))
8296
self.x = x
8397
self.t = rng.random((n, n_vecs))
8498
self.u = rng.random((n_vecs, n))

benchmarks/benchmark_tensordot.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ def setup(self):
3333
self.s2 = sparse.random((100, 100, 100, 100), density=0.01, random_state=rng)
3434

3535
def time_dense(self):
36-
sparse.tensordot(self.s1, self.s2, axes=([0, 1], [0, 2]), return_type=np.ndarray)
36+
sparse.tensordot(
37+
self.s1, self.s2, axes=([0, 1], [0, 2]), return_type=np.ndarray
38+
)
3739

3840
def time_sparse(self):
3941
sparse.tensordot(self.s1, self.s2, axes=([0, 1], [0, 2]))

docs/conf.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@
4848
# Add any paths that contain templates here, relative to this directory.
4949
templates_path = ["_templates"]
5050

51-
mathjax_path = "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
51+
mathjax_path = (
52+
"https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
53+
)
5254

5355
# The suffix(es) of source filenames.
5456
# You can specify multiple suffix as a list of string:
@@ -151,7 +153,9 @@
151153
# Grouping the document tree into LaTeX files. List of tuples
152154
# (source start file, target name, title,
153155
# author, documentclass [howto, manual, or own class]).
154-
latex_documents = [(root_doc, "sparse.tex", "sparse Documentation", "Sparse Developers", "manual")]
156+
latex_documents = [
157+
(root_doc, "sparse.tex", "sparse Documentation", "Sparse Developers", "manual")
158+
]
155159

156160
# -- Options for manual page output ---------------------------------------
157161

docs/gen_logo.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def fill(rs):
6363
root,
6464
"rect",
6565
style=f"{colors['orange']};{fill(rs)};",
66-
transform=transform(1, b, 0, 1, (i + 5) * s + offset_x, (i * b + j) * s + offset_y),
66+
transform=transform(
67+
1, b, 0, 1, (i + 5) * s + offset_x, (i * b + j) * s + offset_y
68+
),
6769
**kwargs,
6870
)
6971

@@ -103,7 +105,9 @@ def fill(rs):
103105
root,
104106
"rect",
105107
style=f"{colors['blue']};{fill(rs)};",
106-
transform=transform(1, b, 0, 1, i * s + offset_x, (i * b + j + y2) * s + offset_y),
108+
transform=transform(
109+
1, b, 0, 1, i * s + offset_x, (i * b + j + y2) * s + offset_y
110+
),
107111
**kwargs,
108112
)
109113

@@ -119,7 +123,9 @@ def fill(rs):
119123
root,
120124
"rect",
121125
style=f"{colors['grey']};{fill(rs)};",
122-
transform=transform(1, -b, 0, 1, (i + 5) * s + offset_x, ((10 - i) * b + j + 5) * s + offset_y),
126+
transform=transform(
127+
1, -b, 0, 1, (i + 5) * s + offset_x, ((10 - i) * b + j + 5) * s + offset_y
128+
),
123129
**kwargs,
124130
)
125131

sparse/finch_backend/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
try:
1111
import finch # noqa: F401
1212
except ModuleNotFoundError:
13-
raise ImportError("Finch not installed. Run `pip install sparse[finch]` to enable Finch backend") from None
13+
raise ImportError(
14+
"Finch not installed. Run `pip install sparse[finch]` to enable Finch backend"
15+
) from None
1416

1517
from finch import Tensor, astype, permute_dims # noqa: E402
1618

0 commit comments

Comments
 (0)