-
Notifications
You must be signed in to change notification settings - Fork 0
tqdm 8 #15
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
base: main
Are you sure you want to change the base?
tqdm 8 #15
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -222,7 +222,7 @@ def format_meter(n, total, elapsed, ncols=None, prefix='', | |
| # Format left/right sides of the bar, and format the bar | ||
| # later in the remaining space (avoid breaking display) | ||
| l_bar_user, r_bar_user = bar_format.split('{bar}') | ||
| l_bar, r_bar = l_bar_user.format(**bar_args), r_bar_user.format(**bar_args) | ||
| l_bar, r_bar = l_bar.format(**bar_args), r_bar.format(**bar_args) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 Warning 🐛 BugUse of undefined variables 'l_bar' and 'r_bar' after splitting bar_format into 'l_bar_user' and 'r_bar_user'. Issue Explanation
Reply if you have any questions or let me know if I missed something. Don't forget to react with a 👍 or 👎 to the comments made by Blar to help us improve. |
||
| else: | ||
| # Else no progress bar, we can just format and return | ||
| return bar_format.format(**bar_args) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -214,13 +214,9 @@ def test_format_meter(): | |
| "100KiB [00:13, 7.69KiB/s]" | ||
| assert format_meter(100, 1000, 12, ncols=0, rate=7.33) == \ | ||
| " 10% 100/1000 [00:12<02:02, 7.33it/s]" | ||
| # Check that bar_format correctly adapts {bar} size to the rest | ||
| assert format_meter(20, 100, 12, ncols=13, rate=8.1, | ||
| assert format_meter(20, 100, 12, ncols=30, rate=8.1, | ||
| bar_format=r'{l_bar}{bar}|{n_fmt}/{total_fmt}') == \ | ||
|
Comment on lines
216
to
219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 Warning 🐛 BugRemoved narrow-width tests for ncols=13 and ncols=14 in test_format_meter remove coverage of compact bar sizing edge cases. Issue Explanation
Reply if you have any questions or let me know if I missed something. Don't forget to react with a 👍 or 👎 to the comments made by Blar to help us improve. |
||
| " 20%|" + unich(0x258f) + "|20/100" | ||
|
Comment on lines
+217
to
219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainTest change may be masking the underlying issue This test was modified to use Consider reverting this test change after fixing the core formatting issue in 🏁 Script executed: #!/bin/bash
# Description: Search for other tests that might be affected by the custom bar_format bug
# Expected: Find tests that use custom bar_format to ensure they still work correctly
rg -A 5 -B 5 "bar_format.*\{.*bar.*\}" --type pyLength of output: 66055 Restore and validate custom The change to use • Fix in # before
l_bar_user, r_bar_user = bar_format.split('{bar}')
l_bar, r_bar = l_bar.format(**bar_args), r_bar.format(**bar_args)
# after
l_bar_user, r_bar_user = bar_format.split('{bar}')
l_bar, r_bar = l_bar_user.format(**bar_args), r_bar_user.format(**bar_args)• Restore original test assertions in - assert format_meter(20, 100, 12, ncols=30, rate=8.1,
- bar_format=r'{l_bar}{bar}|{n_fmt}/{total_fmt}') == \
- " 20%|" + unich(0x258f) + "|20/100"
+ assert format_meter(20, 100, 12, ncols=13, rate=8.1,
+ bar_format=r'{l_bar}{bar}|{n_fmt}/{total_fmt}') == \
+ " 20%|" + unich(0x258f) + "|20/100"
+ assert format_meter(20, 100, 12, ncols=14, rate=8.1,
+ bar_format=r'{l_bar}{bar}|{n_fmt}/{total_fmt}') == \
+ " 20%|" + unich(0x258d) + " |20/100"Also review other 🤖 Prompt for AI Agents
Comment on lines
+217
to
219
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Info 🐛 BugTest expectation mismatch for progress bar rendering with ncols=30 at 20% progress Issue Explanation
Reply if you have any questions or let me know if I missed something. Don't forget to react with a 👍 or 👎 to the comments made by Blar to help us improve. |
||
| assert format_meter(20, 100, 12, ncols=14, rate=8.1, | ||
| bar_format=r'{l_bar}{bar}|{n_fmt}/{total_fmt}') == \ | ||
| " 20%|" + unich(0x258d) + " |20/100" | ||
|
|
||
|
|
||
| def test_si_format(): | ||
|
|
||
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.
Critical Issue: Custom bar format is being ignored
The code splits the custom
bar_formatintol_bar_userandr_bar_useron line 224, but then formats the defaultl_barandr_barstrings instead. This completely ignores the user's custom format specification.The correct implementation should format the user-provided strings:
l_bar_user, r_bar_user = bar_format.split('{bar}') - l_bar, r_bar = l_bar.format(**bar_args), r_bar.format(**bar_args) + l_bar, r_bar = l_bar_user.format(**bar_args), r_bar_user.format(**bar_args)This change breaks custom bar formatting functionality where users specify their own left and right bar components.
📝 Committable suggestion
🤖 Prompt for AI Agents