Skip to content

Commit 21c85d9

Browse files
committed
Replace 'row' with 'line' in whole code
1 parent af97d22 commit 21c85d9

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

gitinspector/blame.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
NUM_THREADS = multiprocessing.cpu_count()
3232

3333
class BlameEntry(object):
34-
rows = 0
34+
lines = 0
3535
skew = 0 # Used when calculating average code age.
3636
comments = 0
3737

@@ -82,7 +82,7 @@ def __handle_blamechunk_content__(self, content):
8282
self.blames[(author, self.filename)] = BlameEntry()
8383

8484
self.blames[(author, self.filename)].comments += comments
85-
self.blames[(author, self.filename)].rows += 1
85+
self.blames[(author, self.filename)].lines += 1
8686

8787
if (self.blamechunk_time - self.changes.first_commit_date).days > 0:
8888
self.blames[(author, self.filename)].skew += ((self.changes.last_commit_date - self.blamechunk_time).days /
@@ -92,18 +92,18 @@ def __handle_blamechunk_content__(self, content):
9292

9393
def run(self):
9494
git_blame_r = subprocess.Popen(self.blame_command, bufsize=1, stdout=subprocess.PIPE).stdout
95-
rows = git_blame_r.readlines()
95+
lines = git_blame_r.readlines()
9696
git_blame_r.close()
9797

9898
self.__clear_blamechunk_info__()
9999

100100
#pylint: disable=W0201
101-
for j in range(0, len(rows)):
102-
row = rows[j].decode("utf-8", "replace").strip()
103-
keyval = row.split(" ", 2)
101+
for j in range(0, len(lines)):
102+
line = lines[j].decode("utf-8", "replace").strip()
103+
keyval = line.split(" ", 2)
104104

105105
if self.blamechunk_is_last:
106-
self.__handle_blamechunk_content__(row)
106+
self.__handle_blamechunk_content__(line)
107107
self.__clear_blamechunk_info__()
108108
elif keyval[0] == "boundary":
109109
self.blamechunk_is_prior = True
@@ -132,18 +132,18 @@ def __init__(self, repo, hard, useweeks, changes):
132132
if repo != None:
133133
progress_text = "[%s] " % repo.name + progress_text
134134

135-
for i, row in enumerate(lines):
136-
row = row.strip().decode("unicode_escape", "ignore")
137-
row = row.encode("latin-1", "replace")
138-
row = row.decode("utf-8", "replace").strip("\"").strip("'").strip()
135+
for i, line in enumerate(lines):
136+
line = line.strip().decode("unicode_escape", "ignore")
137+
line = line.encode("latin-1", "replace")
138+
line = line.decode("utf-8", "replace").strip("\"").strip("'").strip()
139139

140-
if FileDiff.get_extension(row) in extensions.get_located() and FileDiff.is_valid_extension(row) and not \
141-
filtering.set_filtered(FileDiff.get_filename(row)):
140+
if FileDiff.get_extension(line) in extensions.get_located() and FileDiff.is_valid_extension(line) and not \
141+
filtering.set_filtered(FileDiff.get_filename(line)):
142142
blame_command = filter(None, ["git", "blame", "--line-porcelain", "-w"] + \
143143
(["-C", "-C", "-M"] if hard else []) +
144-
[interval.get_since(), interval.get_ref(), "--", row])
145-
thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row),
146-
self.blames, row.strip())
144+
[interval.get_since(), interval.get_ref(), "--", line])
145+
thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(line),
146+
self.blames, line.strip())
147147
thread.daemon = True
148148
thread.start()
149149

@@ -192,7 +192,7 @@ def get_summed_blames(self):
192192
if summed_blames.get(i[0][0], None) == None:
193193
summed_blames[i[0][0]] = BlameEntry()
194194

195-
summed_blames[i[0][0]].rows += i[1].rows
195+
summed_blames[i[0][0]].lines += i[1].lines
196196
summed_blames[i[0][0]].skew += i[1].skew
197197
summed_blames[i[0][0]].comments += i[1].comments
198198

gitinspector/html/html.header

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
<script type="application/javascript">{jquery_flot_resize}</script>
1111
<script type="application/javascript">
1212
$(document).ready(function() {{
13-
var row = 0;
13+
var line = 0;
1414
var MINOR_AUTHOR_PERCENTAGE = 1.00;
1515
var isReversed = false;
1616

1717
var colorRows = function() {{
1818
$(this).removeClass("odd");
1919

20-
if (row++ % 2 == 1) {{
20+
if (line++ % 2 == 1) {{
2121
$(this).addClass("odd");
2222
}}
2323

2424
if(this == $(this).parent().find("tr:visible").get(-1)) {{
25-
row = 0;
25+
line = 0;
2626
}}
2727
}}
2828

gitinspector/output/blameoutput.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ def output_html(self):
5050
total_blames = 0
5151

5252
for i in blames:
53-
total_blames += i[1].rows
53+
total_blames += i[1].lines
5454

5555
for i, entry in enumerate(blames):
56-
work_percentage = str("{0:.2f}".format(100.0 * entry[1].rows / total_blames))
56+
work_percentage = str("{0:.2f}".format(100.0 * entry[1].lines / total_blames))
5757
blame_xml += "<tr " + ("class=\"odd\">" if i % 2 == 1 else ">")
5858

5959
if format.get_selected() == "html":
@@ -62,10 +62,10 @@ def output_html(self):
6262
else:
6363
blame_xml += "<td>" + entry[0] + "</td>"
6464

65-
blame_xml += "<td>" + str(entry[1].rows) + "</td>"
66-
blame_xml += "<td>" + ("{0:.1f}".format(Blame.get_stability(entry[0], entry[1].rows, self.changes)) + "</td>")
67-
blame_xml += "<td>" + "{0:.1f}".format(float(entry[1].skew) / entry[1].rows) + "</td>"
68-
blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].rows) + "</td>"
65+
blame_xml += "<td>" + str(entry[1].lines) + "</td>"
66+
blame_xml += "<td>" + ("{0:.1f}".format(Blame.get_stability(entry[0], entry[1].lines, self.changes)) + "</td>")
67+
blame_xml += "<td>" + "{0:.1f}".format(float(entry[1].skew) / entry[1].lines) + "</td>"
68+
blame_xml += "<td>" + "{0:.2f}".format(100.0 * entry[1].comments / entry[1].lines) + "</td>"
6969
blame_xml += "<td style=\"display: none\">" + work_percentage + "</td>"
7070
blame_xml += "</tr>"
7171
chart_data += "{{label: {0}, data: {1}}}".format(json.dumps(entry[0]), work_percentage)
@@ -104,12 +104,12 @@ def output_json(self):
104104
name_json = "\t\t\t\t\"name\": \"" + i[0] + "\",\n"
105105
email_json = "\t\t\t\t\"email\": \"" + author_email + "\",\n"
106106
gravatar_json = "\t\t\t\t\"gravatar\": \"" + gravatar.get_url(author_email) + "\",\n"
107-
rows_json = "\t\t\t\t\"lines\": " + str(i[1].rows) + ",\n"
108-
stability_json = ("\t\t\t\t\"stability\": " + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows,
107+
rows_json = "\t\t\t\t\"lines\": " + str(i[1].lines) + ",\n"
108+
stability_json = ("\t\t\t\t\"stability\": " + "{0:.1f}".format(Blame.get_stability(i[0], i[1].lines,
109109
self.changes)) + ",\n")
110-
age_json = ("\t\t\t\t\"age\": " + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + ",\n")
110+
age_json = ("\t\t\t\t\"age\": " + "{0:.1f}".format(float(i[1].skew) / i[1].lines) + ",\n")
111111
percentage_in_comments_json = ("\t\t\t\t\"percentage_in_comments\": " +
112-
"{0:.2f}".format(100.0 * i[1].comments / i[1].rows) + "\n")
112+
"{0:.2f}".format(100.0 * i[1].comments / i[1].lines) + "\n")
113113
blame_json += ("{\n" + name_json + email_json + gravatar_json + rows_json + stability_json + age_json +
114114
percentage_in_comments_json + "\t\t\t},")
115115
else:
@@ -127,10 +127,10 @@ def output_text(self):
127127

128128
for i in sorted(self.blame.get_summed_blames().items()):
129129
print(terminal.ljust(i[0], 20)[0:20 - terminal.get_excess_column_count(i[0])], end=" ")
130-
print(str(i[1].rows).rjust(10), end=" ")
131-
print("{0:.1f}".format(Blame.get_stability(i[0], i[1].rows, self.changes)).rjust(14), end=" ")
132-
print("{0:.1f}".format(float(i[1].skew) / i[1].rows).rjust(12), end=" ")
133-
print("{0:.2f}".format(100.0 * i[1].comments / i[1].rows).rjust(19))
130+
print(str(i[1].lines).rjust(10), end=" ")
131+
print("{0:.1f}".format(Blame.get_stability(i[0], i[1].lines, self.changes)).rjust(14), end=" ")
132+
print("{0:.1f}".format(float(i[1].skew) / i[1].lines).rjust(12), end=" ")
133+
print("{0:.2f}".format(100.0 * i[1].comments / i[1].lines).rjust(19))
134134

135135
def output_xml(self):
136136
message_xml = "\t\t<message>" + _(BLAME_INFO_TEXT) + "</message>\n"
@@ -142,11 +142,11 @@ def output_xml(self):
142142
name_xml = "\t\t\t\t<name>" + i[0] + "</name>\n"
143143
email_xml = "\t\t\t\t<email>" + author_email + "</email>\n"
144144
gravatar_xml = "\t\t\t\t<gravatar>" + gravatar.get_url(author_email) + "</gravatar>\n"
145-
rows_xml = "\t\t\t\t<lines>" + str(i[1].rows) + "</lines>\n"
146-
stability_xml = ("\t\t\t\t<stability>" + "{0:.1f}".format(Blame.get_stability(i[0], i[1].rows,
145+
rows_xml = "\t\t\t\t<lines>" + str(i[1].lines) + "</lines>\n"
146+
stability_xml = ("\t\t\t\t<stability>" + "{0:.1f}".format(Blame.get_stability(i[0], i[1].lines,
147147
self.changes)) + "</stability>\n")
148-
age_xml = ("\t\t\t\t<age>" + "{0:.1f}".format(float(i[1].skew) / i[1].rows) + "</age>\n")
149-
percentage_in_comments_xml = ("\t\t\t\t<percentage-in-comments>" + "{0:.2f}".format(100.0 * i[1].comments / i[1].rows) +
148+
age_xml = ("\t\t\t\t<age>" + "{0:.1f}".format(float(i[1].skew) / i[1].lines) + "</age>\n")
149+
percentage_in_comments_xml = ("\t\t\t\t<percentage-in-comments>" + "{0:.2f}".format(100.0 * i[1].comments / i[1].lines) +
150150
"</percentage-in-comments>\n")
151151
blame_xml += ("\t\t\t<author>\n" + name_xml + email_xml + gravatar_xml + rows_xml + stability_xml +
152152
age_xml + percentage_in_comments_xml + "\t\t\t</author>\n")

gitinspector/responsibilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def get(blame, author_name):
3030

3131
for i in blame.blames.items():
3232
if author_name == i[0][0]:
33-
total_rows = i[1].rows - i[1].comments
33+
total_rows = i[1].lines - i[1].comments
3434
if total_rows > 0:
3535
author_blames[i[0][1]] = total_rows
3636

0 commit comments

Comments
 (0)