Skip to content

Commit a02d49e

Browse files
committed
prefer f-strings over string.format
1 parent 9c491bb commit a02d49e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

adaptive/learner/integrator_learner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ def approximating_intervals(self):
390390

391391
def tell(self, point, value):
392392
if point not in self.x_mapping:
393-
raise ValueError("Point {} doesn't belong to any interval".format(point))
393+
raise ValueError(f"Point {point} doesn't belong to any interval")
394394
self.done_points[point] = value
395395
self.pending_points.discard(point)
396396

adaptive/runner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -751,4 +751,4 @@ def _get_ncores(ex):
751751
ex.bootup() # wait until all workers are up and running
752752
return ex._pool.size # not public API!
753753
else:
754-
raise TypeError("Cannot get number of cores for {}".format(ex.__class__))
754+
raise TypeError(f"Cannot get number of cores for {ex.__class__}")

adaptive/tests/test_learners.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def generate_random_parametrization(f):
7575
_, *params = inspect.signature(f).parameters.items()
7676
if any(not callable(v.annotation) for (p, v) in params):
7777
raise TypeError(
78-
"All parameters to {} must be annotated with functions.".format(f.__name__)
78+
f"All parameters to {f.__name__} must be annotated with functions."
7979
)
8080
realization = {p: v.annotation() for (p, v) in params}
8181
return ft.partial(f, **realization)

0 commit comments

Comments
 (0)