Switch sys.stdout > print function

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2019-11-30 23:36:04 +01:00
parent cf1b42cff9
commit 739fcde1ae
6 changed files with 23 additions and 23 deletions

View file

@ -65,10 +65,10 @@ class Auto(object):
print("")
raise SystemExit()
if self.choice in self.commands.keys():
sys.stdout.write(" \x1b[1A{0}{1}{2}\n\n".format(
print(" \x1b[1A{0}{1}{2}\n\n".format(
self.meta.color["CYAN"], self.commands[self.choice],
self.meta.color["ENDC"]))
sys.stdout.flush()
self.meta.color["ENDC"]), end="")
print(end="", flush=True)
self.execute()
def execute(self):

View file

@ -770,13 +770,13 @@ class Update(object):
for repo in enabled:
if check_for_local_repos(repo) is True:
continue
sys.stdout.write("{0}Check repository [{1}{2}{3}] ... "
print("{0}Check repository [{1}{2}{3}] ... "
"{4}".format(
self.meta.color["GREY"],
self.meta.color["CYAN"], repo,
self.meta.color["GREY"],
self.meta.color["ENDC"]))
sys.stdout.flush()
self.meta.color["ENDC"]), end="")
print(end="", flush=True)
if repo in default:
exec("{0}.{1}()".format(self._init, repo))
sys.stdout.write(self.done)

View file

@ -70,23 +70,23 @@ class Msg(object):
def checking(self):
"""Message checking
"""
sys.stdout.write("{0}Checking...{1} ".format(self.meta.color["GREY"],
self.meta.color["ENDC"]))
sys.stdout.flush()
print("{0}Checking...{1} ".format(self.meta.color["GREY"],
self.meta.color["ENDC"]), end="")
print(end="", flush=True)
def reading(self):
"""Message reading
"""
sys.stdout.write("{0}Reading package lists...{1} ".format(
self.meta.color["GREY"], self.meta.color["ENDC"]))
sys.stdout.flush()
print("{0}Reading package lists...{1} ".format(
self.meta.color["GREY"], self.meta.color["ENDC"]), end="")
print(end="", flush=True)
def resolving(self):
"""Message resolving
"""
sys.stdout.write("{0}Resolving dependencies...{1} ".format(
self.meta.color["GREY"], self.meta.color["ENDC"]))
sys.stdout.flush()
print("{0}Resolving dependencies...{1} ".format(
self.meta.color["GREY"], self.meta.color["ENDC"]), end="")
print(end="", flush=True)
def done(self):
"""Message done

View file

@ -177,10 +177,10 @@ class SBoNetwork(object):
print("")
raise SystemExit()
try:
sys.stdout.write("{0}\x1b[1A{1}{2}{3}\n".format(
print("{0}\x1b[1A{1}{2}{3}\n".format(
" " * len(message), self.cyan, commands[self.choice],
self.endc))
sys.stdout.flush()
self.endc), end="")
print(end="", flush=True)
except KeyError:
pass

View file

@ -111,8 +111,8 @@ class DependenciesStatus(object):
for d in dep:
print("+-- {0}".format(d))
print("|")
sys.stdout.write("\x1b[1A{0}\n".format(" "))
sys.stdout.flush()
print("\x1b[1A{0}\n".format(" "), end="")
print(end="", flush=True)
self.summary()
if self.image:
Graph(self.image).dependencies(self.dmap)

View file

@ -34,7 +34,7 @@ def status(sec):
if _meta_.prg_bar in ["on", "ON"]:
syms = ["|", "/", "-", "\\"]
for sym in syms:
sys.stdout.write("\b{0}{1}{2}".format(_meta_.color["GREY"], sym,
_meta_.color["ENDC"]))
sys.stdout.flush()
print("\b{0}{1}{2}".format(_meta_.color["GREY"], sym,
_meta_.color["ENDC"]), end="")
print(end="", flush=True)
time.sleep(float(sec))