def __init__(self, changes, hard, useweeks): if format.is_interactive_format(): print("") self.changes = changes self.hard = hard self.useweeks = useweeks blame.get(self.hard, self.useweeks, self.changes) Outputable.__init__(self)
def output_html(self): resp_xml = "<div><div class=\"box\" id=\"responsibilities\">" resp_xml += "<p>" + _(RESPONSIBILITIES_INFO_TEXT) + ".</p>" for i in sorted(set(i[0] for i in blame.get(self.hard, self.useweeks, self.changes).blames)): responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, self.useweeks, i)), reverse=True) if responsibilities: resp_xml += "<div>" if format.get_selected() == "html": author_email = self.changes.get_latest_email_by_author(i) resp_xml += "<h3><img src=\"{0}\"/>{1} {2}</h3>".format(gravatar.get_url(author_email, size=32), i, _(MOSTLY_RESPONSIBLE_FOR_TEXT)) else: resp_xml += "<h3>{0} {1}</h3>".format(i, _(MOSTLY_RESPONSIBLE_FOR_TEXT)) for j, entry in enumerate(responsibilities): resp_xml += "<div" + (" class=\"odd\">" if j % 2 == 1 else ">") + entry[1] + \ " (" + str(entry[0]) + " eloc)</div>" if j >= 9: break resp_xml += "</div>" resp_xml += "</div></div>" print(resp_xml)
def output_xml(self): message_xml = "\t\t<message>" + _(RESPONSIBILITIES_INFO_TEXT) + "</message>\n" resp_xml = "" for i in sorted(set(i[0] for i in blame.get(self.hard, self.useweeks, self.changes).blames)): responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, self.useweeks, i)), reverse=True) if responsibilities: author_email = self.changes.get_latest_email_by_author(i) resp_xml += "\t\t\t<author>\n" resp_xml += "\t\t\t\t<name>" + i + "</name>\n" resp_xml += "\t\t\t\t<gravatar>" + gravatar.get_url(author_email) + "</gravatar>\n" resp_xml += "\t\t\t\t<files>\n" for j, entry in enumerate(responsibilities): resp_xml += "\t\t\t\t\t<file>\n" resp_xml += "\t\t\t\t\t\t<name>" + entry[1] + "</name>\n" resp_xml += "\t\t\t\t\t\t<rows>" + str(entry[0]) + "</rows>\n" resp_xml += "\t\t\t\t\t</file>\n" if j >= 9: break resp_xml += "\t\t\t\t</files>\n" resp_xml += "\t\t\t</author>\n" print("\t<responsibilities>\n" + message_xml + "\t\t<authors>\n" + resp_xml + "\t\t</authors>\n\t</responsibilities>")
def output_html(self): resp_xml = "<div><div class=\"box\" id=\"responsibilities\">" resp_xml += "<p>" + _(RESPONSIBILITIES_INFO_TEXT) + ".</p>" for i in sorted(set(i[0] for i in blame.get(self.hard).blames)): responsibilities = sorted( ((i[1], i[0]) for i in Responsibilities.get(self.hard, i)), reverse=True) if responsibilities: resp_xml += "<div>" if format.get_selected() == "html": author_email = self.changes.get_author_email(i) resp_xml += "<h3><img src=\"{0}\"/>{1} {2}</h3>".format( gravatar.get_url(author_email, size=32), i, _(MOSTLY_RESPONSIBLE_FOR_TEXT)) else: resp_xml += "<h3>{0} {1}</h3>".format( i, _(MOSTLY_RESPONSIBLE_FOR_TEXT)) for j, entry in enumerate(responsibilities): resp_xml += "<div" + (" class=\"odd\">" if j % 2 == 1 else ">") + entry[1] + \ " (" + str(entry[0]) + " eloc)</div>" if j >= 9: break resp_xml += "</div>" resp_xml += "</div></div>" print(resp_xml)
def get(hard, author_name): author_blames = {} for i in blame.get(hard, changes.get(hard)).blames.items(): if (author_name == i[0][0]): total_rows = i[1].rows - i[1].comments if total_rows > 0: author_blames[i[0][1]] = total_rows return sorted(author_blames.items())
def get(hard, useweeks, author_name): author_blames = {} for i in blame.get(hard, useweeks, changes.get(hard)).blames.items(): if (author_name == i[0][0]): total_rows = i[1].rows - i[1].comments if total_rows > 0: author_blames[i[0][1]] = total_rows return sorted(author_blames.items())
def output_text(self): print("\n" + textwrap.fill(_(RESPONSIBILITIES_INFO_TEXT) + ":", width=terminal.get_size()[0])) for i in sorted(set(i[0] for i in blame.get(self.hard, self.useweeks, self.changes).blames)): responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, self.useweeks, i)), reverse=True) if responsibilities: print("\n" + i, _(MOSTLY_RESPONSIBLE_FOR_TEXT) + ":") for j, entry in enumerate(responsibilities): (width, _unused) = terminal.get_size() width -= 7 print(str(entry[0]).rjust(6), end=" ") print("...%s" % entry[1][-width+3:] if len(entry[1]) > width else entry[1]) if j >= 9: break
def output_html(self): resp_xml = "<div><div class=\"box\">" resp_xml += "<p>" + __responsibilities_info_text__ + ".</p>" for i in sorted(set(i[0] for i in blame.get(self.hard).blames)): responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, i)), reverse=True) if responsibilities: resp_xml += "<h3>" + i + "is mostly responsible for</h3>" for j, entry in enumerate(responsibilities): resp_xml += "<p>" + entry[1] + " (" + str(entry[0]) + " eloc)</p>" if j >= 9: break resp_xml += "</div></div>" print(resp_xml)
def output_text(self): print("\n" + textwrap.fill(__responsibilities_info_text__ + ":", width=terminal.get_size()[0])) for i in sorted(set(i[0] for i in blame.get(self.hard).blames)): responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, i)), reverse=True) if responsibilities: print("\n" + i, "is mostly responsible for:") for j, entry in enumerate(responsibilities): (width, _) = terminal.get_size() width -= 7 print(str(entry[0]).rjust(6), end=" ") print("...%s" % entry[1][-width+3:] if len(entry[1]) > width else entry[1]) if j >= 9: break
def output_xml(self): message_xml = "\t\t<message>" + __responsibilities_info_text__ + "</message>\n" resp_xml = "" for i in sorted(set(i[0] for i in blame.get(self.hard).blames)): responsibilities = sorted(((i[1], i[0]) for i in Responsibilities.get(self.hard, i)), reverse=True) if responsibilities: resp_xml += "\t\t\t<author>\n" resp_xml += "\t\t\t\t<name>" + i + "</name>\n" resp_xml += "\t\t\t\t<files>\n" for j, entry in enumerate(responsibilities): resp_xml += "\t\t\t\t\t<file>\n" resp_xml += "\t\t\t\t\t\t<name>" + entry[1] + "</name>\n" resp_xml += "\t\t\t\t\t\t<rows>" + str(entry[0]) + "</rows>\n" resp_xml += "\t\t\t\t\t</file>\n" if j >= 9: break resp_xml += "\t\t\t\t</files>\n" resp_xml += "\t\t\t</author>\n" print("\t<responsibilities>\n" + message_xml + "\t\t<authors>\n" + resp_xml + "\t\t</authors>\n\t</responsibilities>")