Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Progress bar not clearing line in Console mode

オープン
#106 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
cli

調査の方向性

fastprogress/fastprogress.py の issue でリンクされている on_update メソッドから始め、変化する進捗コメントを使って、提示されたコンソールモードの例を再現します。後から表示される短いコメントが前の行を残りの文字なしで完全に上書きすること、また長いコメントも正しく更新されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

In console mode, when adding a progress comment, the previous line is not completely cleared thus causing the leftover ending to remain. for example:

from fastprogress import progress_bar
from pathlib import Path
import time

files = list(Path('/etc').glob('*'))
pb = progress_bar(files)

for fn in pb:
    pb.comment = f'{fn.stem}'
    time.sleep(0.1)

console output:

|█████████████----| 77.69% [188/242 00:18<00:05 login]es]]e]te].conf]

I managed to root-cause the issue and solved it by updating on_update and padding with empty spaces to max_len

modify:

if len(to_write) > self.max_len: self.max_len=len(to_write)

to

if len(to_write) > self.max_len: self.max_len=len(to_write)
else: to_write += ' ' * (self.max_len - len(to_write))

is this the proper way to fix it?

主要言語
Jupyter Notebook
スター
1.1k
フォーク
103
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

AnswerDotAI/fastprogress のほかの issue

AnswerDotAI/fastprogress の issue をすべて見る

似ている issue

CLI の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。