Skip to content

Commit

Permalink
Delete lazyformat helper
Browse files Browse the repository at this point in the history
With the __repr__ of strategies now cached and other improvements to lazy evaluation we no longer need to make this lazy for correctness, and any performance cost is way down in the noise.
  • Loading branch information
Zac-HD committed Jan 11, 2019
1 parent b794074 commit aff3a20
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 51 deletions.
42 changes: 0 additions & 42 deletions hypothesis-python/src/hypothesis/internal/lazyformat.py

This file was deleted.

6 changes: 1 addition & 5 deletions hypothesis-python/src/hypothesis/searchstrategy/recursive.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from contextlib import contextmanager

from hypothesis.errors import InvalidArgument
from hypothesis.internal.lazyformat import lazyformat
from hypothesis.internal.reflection import get_pretty_function_description
from hypothesis.searchstrategy.strategies import OneOfStrategy, SearchStrategy

Expand Down Expand Up @@ -101,9 +100,6 @@ def do_draw(self, data):
except LimitReached:
if count == 0:
data.note_event(
lazyformat(
"Draw for %r exceeded max_leaves and had to be retried",
self,
)
"Draw for %r exceeded max_leaves and had to be retried" % self
)
count += 1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
combine_labels,
)
from hypothesis.internal.coverage import check_function
from hypothesis.internal.lazyformat import lazyformat
from hypothesis.internal.reflection import get_pretty_function_description
from hypothesis.internal.validation import check_type
from hypothesis.utils.conventions import UniqueIdentifier
Expand Down Expand Up @@ -625,9 +624,7 @@ def do_draw(self, data):
return value
else:
if i == 0:
data.note_event(
lazyformat("Retried draw from %r to satisfy filter", self)
)
data.note_event("Retried draw from %r to satisfy filter" % self)
# This is to guard against the case where we consume no data.
# As long as we consume data, we'll eventually pass or raise.
# But if we don't this could be an infinite loop.
Expand Down

0 comments on commit aff3a20

Please sign in to comment.