-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Chaoqun Liang
committed
Feb 15, 2024
1 parent
e781d79
commit 63c5859
Showing
8 changed files
with
400,088 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,30 @@ | ||
def replace_first_line_in_groups_with_huge(small_modified_path, huge_path, final_output_path): | ||
Check failure on line 1 in jobs/backend_rw_axi_rw_axis/huge.py GitHub Actions / lint-license
|
||
# Open and read the lines from huge.txt | ||
with open(huge_path, 'r') as huge_file: | ||
huge_lines = huge_file.readlines() | ||
|
||
# Open and read the lines from the previously modified small_modified.txt | ||
with open(small_modified_path, 'r') as modified_file: | ||
modified_lines = modified_file.readlines() | ||
|
||
# Define the group size | ||
group_size = 10 | ||
|
||
# Iterate over the modified small file's lines to replace the first line of each group | ||
for i in range(0, len(modified_lines), group_size): | ||
if i // group_size < len(huge_lines): # Check if there's a corresponding line in huge.txt | ||
modified_lines[i] = huge_lines[i // group_size] | ||
|
||
# Write the final modified lines to a new output file | ||
with open(final_output_path, 'w') as output_file: | ||
output_file.writelines(modified_lines) | ||
|
||
# Define the file paths | ||
small_modified_path = '/scratch/chaol/idma_fixed/iDMA/jobs/backend_rw_axi_rw_axis/small.txt' # Adjust with the actual path | ||
huge_path = '/scratch/chaol/idma_fixed/iDMA/jobs/backend_r_obi_w_axi/huge.txt' # Adjust with the actual path | ||
final_output_path = '/scratch/chaol/idma_fixed/iDMA/jobs/backend_rw_axi_rw_axis/huge.txt' # Define your output path | ||
|
||
# Call the function to perform the replacement | ||
replace_first_line_in_groups_with_huge(small_modified_path, huge_path, final_output_path) | ||
|
||
print("Replacement complete. The output is saved in:", final_output_path) |
Oops, something went wrong.