"""Function used to print all the current emerge stuff"""
print("\t" + green_start + self.name + '-' + self.version +
- color_stop + "\n\t current time: " + self.time(self.emerge_time) +
+ color_stop + "\n\t current time: " + time(self.emerge_time) +
"\n\t average time: "),
if len(self.versions) > 1:
- print(self.time(self.average_time())),
+ print(time(self.average_time())),
else:
print("unknown"),
print("\n\t time to finish: "),
if finish_time > 0:
- print(self.time(finish_time))
+ print(time(finish_time))
else:
print("any time now")
print('-'*90 + "\n" +
green_start + self.name + p[0] + color_stop + " >>> " +
- self.time(p[1]) + " >>> " +
- self.date(p[2]))
+ time(p[1]) + " >>> " + date(p[2]))
print('-'*90 + "\n" + "Package " + green_start +
self.name + color_stop + " emerged " +
print("\t" + green_start + self.name + '-' + self.version + color_stop),
if len(self.versions) > 1:
- print("\n\taverage time: " + self.time(self.average_time()))
+ print("\n\taverage time: " + time(self.average_time()))
else:
print("\n\t no previous emerges")
average = self.average_time()
total = self.total_time()
- print("Max time: \t" + self.time(maxi) +
- "\nMin time: \t" + self.time(mini) +
- "\nAverage time: \t" + self.time(average) +
- "\nIn total spent " + self.time(total) +
+ print("Max time: \t" + time(maxi) +
+ "\nMin time: \t" + time(mini) +
+ "\nAverage time: \t" + time(average) +
+ "\nIn total spent " + time(total) +
" emerging " + green_start + self.name + color_stop)
- def time(self, time):
- """Converts time in seconds to human readable form"""
- days = time/(3600*24)
- hours = (days - int(days))*24
- minutes = (hours - int(hours))*60
- seconds = (minutes - int(minutes))*60
+def time(time):
+ """Converts time in seconds to human readable form"""
+ days = time/(3600*24)
+ hours = (days - int(days))*24
+ minutes = (hours - int(hours))*60
+ seconds = (minutes - int(minutes))*60
- days = int(days)
- hours = int(hours)
- minutes = int(minutes)
- seconds = int(round(seconds))
+ days = int(days)
+ hours = int(hours)
+ minutes = int(minutes)
+ seconds = int(round(seconds))
- pdays = str()
- phours = str()
- pminutes = str()
- pseconds = str()
+ pdays = str()
+ phours = str()
+ pminutes = str()
+ pseconds = str()
- if days > 0:
+ if days > 0:
+ pdays = (green_start + str(days) +
+ color_stop + " day ")
+ if days != 1:
pdays = (green_start + str(days) +
- color_stop + " day ")
- if days != 1:
- pdays = (green_start + str(days) +
color_stop + " days ")
- if hours > 0:
+ if hours > 0:
+ phours = (green_start + str(hours) +
+ color_stop + " hour ")
+ if hours != 1:
phours = (green_start + str(hours) +
- color_stop + " hour ")
- if hours != 1:
- phours = (green_start + str(hours) +
color_stop + " hours ")
- if minutes > 0:
+ if minutes > 0:
+ pminutes = (green_start + str(minutes) +
+ color_stop + " minute ")
+ if minutes != 1:
pminutes = (green_start + str(minutes) +
- color_stop + " minute ")
- if minutes != 1:
- pminutes = (green_start + str(minutes) +
- color_stop + " minutes ")
+ color_stop + " minutes ")
+ pseconds = (green_start + str(seconds) +
+ color_stop + " second ")
+ if seconds != 1:
pseconds = (green_start + str(seconds) +
- color_stop + " second ")
- if seconds != 1:
- pseconds = (green_start + str(seconds) +
- color_stop + " seconds ")
+ color_stop + " seconds ")
- return (pdays + phours + pminutes + pseconds)
+ return (pdays + phours + pminutes + pseconds)
- def date(self, emerge_date):
- """Returns a date string from a standard POSIX time"""
- date = datetime.datetime.fromtimestamp(emerge_date)
+def date(emerge_date):
+ """Returns a date string from a standard POSIX time"""
+ date = datetime.datetime.fromtimestamp(emerge_date)
- date = "{:%d.%m.%Y %H:%M:%S}".format(date)
+ date = "{:%d.%m.%Y %H:%M:%S}".format(date)
- return date
+ return date