Skip to content
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

Merged
merged 3 commits into from
Jun 12, 2020
Merged

Conversation

joyceyuu
Copy link
Contributor

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

@joyceyuu joyceyuu requested a review from wilko77 June 11, 2020 01:37
@codecov
Copy link

codecov bot commented Jun 11, 2020

Codecov Report

Merging #75 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master      #75   +/-   ##
=======================================
  Coverage   98.00%   98.01%           
=======================================
  Files          14       14           
  Lines         502      504    +2     
=======================================
+ Hits          492      494    +2     
  Misses         10       10           

@@ -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)
Copy link
Collaborator

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

@@ -97,7 +97,7 @@ def build_reversed_index(self, data: Sequence[Sequence], verbose: bool = False):
reversed_index = {} # type: Dict[Any, List[Any]]
Copy link
Collaborator

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?

Copy link
Contributor Author

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]]

@joyceyuu joyceyuu requested a review from wilko77 June 11, 2020 04:38
@joyceyuu joyceyuu merged commit 684e942 into master Jun 12, 2020
@joyceyuu joyceyuu deleted the convert-blockkey-to-string branch June 12, 2020 04:33
@wilko77 wilko77 mentioned this pull request Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert block key into string
2 participants