From e641281d144cca09a451497209e748056cdd79bb Mon Sep 17 00:00:00 2001 From: Daniel Kutik Date: Tue, 13 Dec 2022 12:44:47 +0100 Subject: Use print with flush=True instead of stdout.flush Resolves multiple TODOs. Since we are requiring Python 3, we move to using print function with flush=True instead of using sys.stdout.flush(). Change-Id: I54db0344ec78ac81a8d6c6c7e43ee7d301f42f02 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354701 Tested-by: Daniel Kutik Reviewed-by: Mike Frysinger --- subcmds/upload.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'subcmds/upload.py') diff --git a/subcmds/upload.py b/subcmds/upload.py index ceab6463..5b17fb51 100644 --- a/subcmds/upload.py +++ b/subcmds/upload.py @@ -293,9 +293,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ for commit in commit_list: print(' %s' % commit) - print('to %s (y/N)? ' % remote.review, end='') - # TODO: When we require Python 3, use flush=True w/print above. - sys.stdout.flush() + print('to %s (y/N)? ' % remote.review, end='', flush=True) if opt.yes: print('<--yes>') answer = True @@ -437,9 +435,7 @@ Gerrit Code Review: https://www.gerritcodereview.com/ print('Uncommitted changes in %s (did you forget to amend?):' % branch.project.name) print('\n'.join(changes)) - print('Continue uploading? (y/N) ', end='') - # TODO: When we require Python 3, use flush=True w/print above. - sys.stdout.flush() + print('Continue uploading? (y/N) ', end='', flush=True) if opt.yes: print('<--yes>') a = 'yes' -- cgit v1.2.3-54-g00ecf