-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[TRTLLM-5633] - Merge current waive list with the TOT waive list #5198
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import argparse | ||
import sys | ||
|
||
# Generate the merged waive list: | ||
# 1. Parse the current MR waive list, and get the removed lines from the diff | ||
# 2. Parse the TOT waive list | ||
# 3. Merge the current MR waive list and TOT waive list, and remove the removed lines from the step 1 | ||
|
||
|
||
def get_remove_lines_from_diff(diff): | ||
lines = diff.split('\n') | ||
remove_lines = [ | ||
line[1:] + '\n' for line in lines | ||
if len(line) > 1 and line.startswith('-') | ||
] | ||
return remove_lines | ||
|
||
|
||
def parse_waive_txt(waive_txt): | ||
with open(waive_txt, 'r') as f: | ||
lines = f.readlines() | ||
waive_list = [line for line in lines if line.strip()] | ||
return waive_list | ||
|
||
|
||
def write_waive_list(waive_list, output_file): | ||
with open(output_file, 'w') as f: | ||
for line in waive_list: | ||
f.write(line) | ||
|
||
|
||
def merge_waive_list(cur_list, main_list, remove_lines, output_file): | ||
merged = list(dict.fromkeys(cur_list + main_list)) | ||
for line in reversed(remove_lines): | ||
for i in range(len(merged) - 1, -1, -1): | ||
if merged[i] == line: | ||
merged.pop(i) | ||
break | ||
write_waive_list(merged, output_file) | ||
|
||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--cur-waive-list', | ||
required=True, | ||
help='Current waive list') | ||
parser.add_argument('--latest-waive-list', | ||
required=True, | ||
help='Latest waive list') | ||
parser.add_argument('--diff', required=True, help='Diff of the waive list') | ||
parser.add_argument('--output-file', required=True, help='Output file') | ||
args = parser.parse_args(sys.argv[1:]) | ||
cur_list = parse_waive_txt(args.cur_waive_list) | ||
main_list = parse_waive_txt(args.latest_waive_list) | ||
remove_lines = get_remove_lines_from_diff(args.diff) | ||
merge_waive_list(cur_list, main_list, remove_lines, args.output_file) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.