-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert block key to string for P-sig #75
Conversation
Codecov Report
@@ Coverage Diff @@
## master #75 +/- ##
=======================================
Coverage 98.00% 98.01%
=======================================
Files 14 14
Lines 502 504 +2
=======================================
+ Hits 492 494 +2
Misses 10 10 |
blocklib/blocks_generator.py
Outdated
@@ -89,6 +89,7 @@ def generate_blocks_psig(reversed_indices: Sequence[Dict], block_states: Sequenc | |||
for reversed_index, state in zip(reversed_indices, block_states): | |||
cbf = set() # type: Set[int] | |||
for bf_set in reversed_index: | |||
bf_set = eval(bf_set) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eval
can lead to arbitrary code execution and should be avoided. Better use https://docs.python.org/3/library/ast.html#ast.literal_eval
blocklib/pprlpsig.py
Outdated
@@ -97,7 +97,7 @@ def build_reversed_index(self, data: Sequence[Sequence], verbose: bool = False): | |||
reversed_index = {} # type: Dict[Any, List[Any]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the key now always a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, will update it to type: Dict[str, List[Any]]
In this pull request, I converted the block key type from set to string for P-sig blocking. Now the block key for both P-sig and lambda fold are consistent.
Close #74