Skip to content

Commit 363f518

Browse files
authored
Merge pull request #140 from nschloe/args
args -> *args
2 parents e1f50da + 8c72df8 commit 363f518

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

justfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
version := `python3 -c "from src.perfplot.__about__ import __version__; print(__version__)"`
2+
13
default:
24
@echo "\"just publish\"?"
35

46
publish:
57
@if [ "$(git rev-parse --abbrev-ref HEAD)" != "main" ]; then exit 1; fi
6-
gh release create
8+
gh release create "v{{version}}"
79
flit publish
810

911
clean:

src/perfplot/__about__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.10.0"

src/perfplot/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1+
from .__about__ import __version__
12
from ._main import bench, live, plot, save, show
23

3-
__version__ = "0.9.15"
4-
54
__all__ = ["bench", "plot", "show", "save", "live", "__version__"]

src/perfplot/_main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ def __next__(self):
218218
data = None
219219
if callable(self.setup):
220220
data = self.setup(n)
221+
if not isinstance(data, tuple):
222+
data = (data,)
221223

222224
reference = None
223225
timings = []
@@ -230,6 +232,8 @@ def __next__(self):
230232

231233
if isinstance(self.setup, list):
232234
data = self.setup[k](n)
235+
if not isinstance(data, tuple):
236+
data = (data,)
233237

234238
# First let the function run once. The value is used for the equality_check
235239
# and the time for gauging how many more repetitions are to be done. If the
@@ -239,7 +243,7 @@ def __next__(self):
239243
# up first. The actual times are only reached after a few hundred
240244
# nanoseconds of computation. Most of the time it's okay though.
241245
t0_ns = time.perf_counter_ns()
242-
val = kernel(data)
246+
val = kernel(*data)
243247
t1_ns = time.perf_counter_ns()
244248
t_ns = t1_ns - t0_ns
245249

@@ -298,7 +302,7 @@ def _b(data, kernel: Callable, repeat: int):
298302
while min_timing_ns <= required_timing_ns:
299303
tm = np.array(
300304
timeit.repeat(
301-
stmt=lambda: kernel(data),
305+
stmt=lambda: kernel(*data),
302306
repeat=repeat,
303307
number=number,
304308
timer=time.perf_counter_ns,

0 commit comments

Comments
 (0)