Truncate self.items to a specified value and state how many items are hidden.
"""
if (len(self.items) > limit):
- more = str(len(self.items) - limit)
+ more = len(self.items) - limit
+ if more == 1:
+ return 0
self.items = self.items[:limit]
- self.items.append("+ {0} more".format(more))
+ self.items.append("+ {0} more".format(str(more)))
def orderbyfreq(self):
"""
def draw_plain(self):
output = tabulate(self._gen_list(), self.headers, tablefmt="fancy_grid" if self.borders else "plain", colalign=tuple(self._align_cols))
- return output
+ return output + "\n"*2
class Table0(object):
return ["`" + x + "`" for x in l]
-def plural(noun, quantity):
+def plural(noun, quantity, print_quantity=True):
"""
Return "1 noun" or "n nouns"
"""
- if (quantity == 1):
- return(str(quantity) + " " + noun)
+ if print_quantity:
+ if (quantity == 1):
+ return(str(quantity) + " " + noun)
+ else:
+ return(str(quantity) + " " + noun + "s")
else:
- return(str(quantity) + " " + noun + "s")
+ if (quantity == 1):
+ return noun
+ else:
+ return noun + "s"
def parsesize(num, suffix='B'):