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("") print("")
raise SystemExit() raise SystemExit()
if self.choice in self.commands.keys(): 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["CYAN"], self.commands[self.choice],
self.meta.color["ENDC"])) self.meta.color["ENDC"]), end="")
sys.stdout.flush() print(end="", flush=True)
self.execute() self.execute()
def execute(self): def execute(self):

View file

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

View file

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

View file

@ -177,10 +177,10 @@ class SBoNetwork(object):
print("") print("")
raise SystemExit() raise SystemExit()
try: 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], " " * len(message), self.cyan, commands[self.choice],
self.endc)) self.endc), end="")
sys.stdout.flush() print(end="", flush=True)
except KeyError: except KeyError:
pass pass

View file

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

View file

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