Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd685480

Browse files
Use digest instead of hexdigest when caching reduction attempts.
1 parent95341da commitd685480

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/lithium/strategies.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __init__(self, testcase: Testcase) -> None:
5353
self._any_success:bool=False
5454
self._last_success:Optional[bool]=None
5555
self._description:str="Reduction"
56-
self._tried:Set[str]=set()
56+
self._tried:Set[bytes]=set()
5757

5858
@property
5959
deflast_feedback(self)->bool:
@@ -65,7 +65,7 @@ def last_feedback(self) -> bool:
6565
assertself._last_successisnotNone,"No feedback received yet"
6666
returnself._last_success
6767

68-
defupdate_tried(self,tried:Iterable[str])->None:
68+
defupdate_tried(self,tried:Iterable[bytes])->None:
6969
"""Update the list of tried hashes. Testcases are hashed with SHA-512
7070
and digested to bytes (`hashlib.sha512(testcase).digest()`)
7171
@@ -74,7 +74,7 @@ def update_tried(self, tried: Iterable[str]) -> None:
7474
"""
7575
self._tried.update(frozenset(tried))
7676

77-
defget_tried(self)->FrozenSet[str]:
77+
defget_tried(self)->FrozenSet[bytes]:
7878
"""Return the set of tried testcase hashes. Testcases are hashed with SHA-512
7979
and digested to bytes (`hashlib.sha512(testcase).digest()`)
8080
@@ -117,7 +117,7 @@ def try_testcase(
117117
forpartintestcase.parts:
118118
tc_hasher.update(part)
119119
tc_hasher.update(testcase.after)
120-
tc_hash=tc_hasher.hexdigest()
120+
tc_hash=tc_hasher.digest()
121121
iftc_hashnotinself._tried:
122122
self._tried.add(tc_hash)
123123
self._last_success=None

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp