diff options
author | Ming Li <14131823+minggli@users.noreply.github.com> | 2018-10-27 18:13:23 +0100 |
---|---|---|
committer | Bernát Gábor <gaborjbernat@gmail.com> | 2018-10-27 18:13:23 +0100 |
commit | c5e0fb72c6336f0d26b7e101d817e15c9913962e (patch) | |
tree | 299b543fc3f11590b2061b9c16298c8fde109b70 | |
parent | bc13441adc3349cda0e925f1a935076827df3d64 (diff) | |
download | virtualenv-c5e0fb72c6336f0d26b7e101d817e15c9913962e.tar.gz |
Refactor sys.stdout.write to print (#1231)
* refactor sys.stdout.write to print for readability
* print_function
* format string
* top print_function import
* format string and use sys flush
* remove end keyword for compatibility
* format again
-rwxr-xr-x | src/virtualenv.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/virtualenv.py b/src/virtualenv.py index 8c0f5e5..1fae20a 100755 --- a/src/virtualenv.py +++ b/src/virtualenv.py @@ -275,7 +275,7 @@ class Logger(object): if self.level_matches(level, consumer_level): if self.in_progress_hanging and consumer in (sys.stdout, sys.stderr): self.in_progress_hanging = False - sys.stdout.write("\n") + print("") sys.stdout.flush() if rendered is None: if args: @@ -293,7 +293,7 @@ class Logger(object): msg, self.in_progress ) if self.level_matches(self.NOTIFY, self._stdout_level()): - sys.stdout.write(msg) + print(msg) sys.stdout.flush() self.in_progress_hanging = True else: @@ -305,10 +305,10 @@ class Logger(object): if self.stdout_level_matches(self.NOTIFY): if not self.in_progress_hanging: # Some message has been printed out since start_progress - sys.stdout.write("..." + self.in_progress + msg + "\n") + print("...{}{}".format(self.in_progress, msg)) sys.stdout.flush() else: - sys.stdout.write(msg + "\n") + print(msg) sys.stdout.flush() self.in_progress = None self.in_progress_hanging = False @@ -317,7 +317,7 @@ class Logger(object): """If we are in a progress scope, and no log messages have been shown, write out another '.'""" if self.in_progress_hanging: - sys.stdout.write(".") + print(".") sys.stdout.flush() def stdout_level_matches(self, level): |