mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-12-22 13:42:14 +01:00
Global cleanup fixing some pylint violations.
This commit is contained in:
parent
c0cb2d2801
commit
38df413ebf
9 changed files with 24 additions and 22 deletions
|
@ -3,7 +3,7 @@ include-ids=yes
|
||||||
comment=yes
|
comment=yes
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
disable=C0111,R0801,W0232,W0603,W0622,W0702
|
disable=C0111,R0801,W0232,W0603,W0622,W0702,W0141
|
||||||
|
|
||||||
|
|
||||||
[DESIGN]
|
[DESIGN]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2012-2014 Ejwa Software. All rights reserved.
|
# Copyright © 2012-2015 Ejwa Software. All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of gitinspector.
|
# This file is part of gitinspector.
|
||||||
#
|
#
|
||||||
|
@ -40,7 +40,7 @@ def get_basedir_git():
|
||||||
if sp.returncode != 0:
|
if sp.returncode != 0:
|
||||||
sys.exit(_("Error processing git repository at \"%s\"." % os.getcwd()))
|
sys.exit(_("Error processing git repository at \"%s\"." % os.getcwd()))
|
||||||
isbare = (isbare[0].decode("utf-8", "replace").strip() == "true")
|
isbare = (isbare[0].decode("utf-8", "replace").strip() == "true")
|
||||||
absolute_path = ""
|
absolute_path = None
|
||||||
|
|
||||||
if isbare:
|
if isbare:
|
||||||
absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], bufsize=1, stdout=subprocess.PIPE).stdout
|
absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], bufsize=1, stdout=subprocess.PIPE).stdout
|
||||||
|
|
|
@ -23,7 +23,6 @@ from localization import N_
|
||||||
from outputable import Outputable
|
from outputable import Outputable
|
||||||
from changes import FileDiff
|
from changes import FileDiff
|
||||||
import comment
|
import comment
|
||||||
import changes
|
|
||||||
import datetime
|
import datetime
|
||||||
import filtering
|
import filtering
|
||||||
import format
|
import format
|
||||||
|
@ -107,6 +106,7 @@ class BlameThread(threading.Thread):
|
||||||
|
|
||||||
self.__clear_blamechunk_info__()
|
self.__clear_blamechunk_info__()
|
||||||
|
|
||||||
|
#pylint: disable=W0201
|
||||||
for j in range(0, len(rows)):
|
for j in range(0, len(rows)):
|
||||||
row = rows[j].decode("utf-8", "replace").strip()
|
row = rows[j].decode("utf-8", "replace").strip()
|
||||||
keyval = row.split(" ", 2)
|
keyval = row.split(" ", 2)
|
||||||
|
@ -210,13 +210,13 @@ BLAME_INFO_TEXT = N_("Below are the number of rows from each author that have su
|
||||||
"intact in the current revision")
|
"intact in the current revision")
|
||||||
|
|
||||||
class BlameOutput(Outputable):
|
class BlameOutput(Outputable):
|
||||||
def __init__(self, hard, useweeks):
|
def __init__(self, changes, hard, useweeks):
|
||||||
if format.is_interactive_format():
|
if format.is_interactive_format():
|
||||||
print("")
|
print("")
|
||||||
|
|
||||||
|
self.changes = changes
|
||||||
self.hard = hard
|
self.hard = hard
|
||||||
self.useweeks = useweeks
|
self.useweeks = useweeks
|
||||||
self.changes = changes.get(hard)
|
|
||||||
get(self.hard, self.useweeks, self.changes)
|
get(self.hard, self.useweeks, self.changes)
|
||||||
Outputable.__init__(self)
|
Outputable.__init__(self)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from localization import N_
|
from localization import N_
|
||||||
from outputable import Outputable
|
from outputable import Outputable
|
||||||
import codecs
|
|
||||||
import datetime
|
import datetime
|
||||||
import extensions
|
import extensions
|
||||||
import filtering
|
import filtering
|
||||||
|
@ -31,7 +30,6 @@ import interval
|
||||||
import json
|
import json
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import terminal
|
import terminal
|
||||||
import textwrap
|
import textwrap
|
||||||
|
@ -127,8 +125,9 @@ class ChangesThread(threading.Thread):
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
git_log_r = subprocess.Popen(filter(None, ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE", "--stat=100000,8192", "--no-merges", "-w",
|
git_log_r = subprocess.Popen(filter(None, ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE",
|
||||||
interval.get_since(), interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) +
|
"--stat=100000,8192", "--no-merges", "-w", interval.get_since(),
|
||||||
|
interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) +
|
||||||
[self.first_hash + self.second_hash]), bufsize=1, stdout=subprocess.PIPE).stdout
|
[self.first_hash + self.second_hash]), bufsize=1, stdout=subprocess.PIPE).stdout
|
||||||
lines = git_log_r.readlines()
|
lines = git_log_r.readlines()
|
||||||
git_log_r.close()
|
git_log_r.close()
|
||||||
|
@ -225,7 +224,8 @@ class Changes:
|
||||||
def get_commits(self):
|
def get_commits(self):
|
||||||
return self.commits
|
return self.commits
|
||||||
|
|
||||||
def modify_authorinfo(self, authors, key, commit):
|
@staticmethod
|
||||||
|
def modify_authorinfo(authors, key, commit):
|
||||||
if authors.get(key, None) == None:
|
if authors.get(key, None) == None:
|
||||||
authors[key] = AuthorInfo()
|
authors[key] = AuthorInfo()
|
||||||
|
|
||||||
|
@ -239,14 +239,14 @@ class Changes:
|
||||||
def get_authorinfo_list(self):
|
def get_authorinfo_list(self):
|
||||||
if not self.authors:
|
if not self.authors:
|
||||||
for i in self.commits:
|
for i in self.commits:
|
||||||
self.modify_authorinfo(self.authors, i.author, i)
|
Changes.modify_authorinfo(self.authors, i.author, i)
|
||||||
|
|
||||||
return self.authors
|
return self.authors
|
||||||
|
|
||||||
def get_authordateinfo_list(self):
|
def get_authordateinfo_list(self):
|
||||||
if not self.authors_dateinfo:
|
if not self.authors_dateinfo:
|
||||||
for i in self.commits:
|
for i in self.commits:
|
||||||
self.modify_authorinfo(self.authors_dateinfo, (i.date, i.author), i)
|
Changes.modify_authorinfo(self.authors_dateinfo, (i.date, i.author), i)
|
||||||
|
|
||||||
return self.authors_dateinfo
|
return self.authors_dateinfo
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,8 @@ import subprocess
|
||||||
import terminal
|
import terminal
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
__filters__ = {"file": [set(), set()], "author": [set(), set()], "email": [set(), set()], "revision": [set(), set()], "message" : [set(), None]}
|
__filters__ = {"file": [set(), set()], "author": [set(), set()], "email": [set(), set()], "revision": [set(), set()],
|
||||||
|
"message" : [set(), None]}
|
||||||
|
|
||||||
class InvalidRegExpError(ValueError):
|
class InvalidRegExpError(ValueError):
|
||||||
def __init__(self, msg):
|
def __init__(self, msg):
|
||||||
|
|
|
@ -67,7 +67,8 @@ def output_header():
|
||||||
if __selected_format__ == "html" or __selected_format__ == "htmlembedded":
|
if __selected_format__ == "html" or __selected_format__ == "htmlembedded":
|
||||||
base = basedir.get_basedir()
|
base = basedir.get_basedir()
|
||||||
html_header = __output_html_template__(base + "/html/html.header")
|
html_header = __output_html_template__(base + "/html/html.header")
|
||||||
tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js", "/html/jquery.tablesorter.min.js.zip").encode("latin-1", "replace")
|
tablesorter_js = __get_zip_file_content__("jquery.tablesorter.min.js",
|
||||||
|
"/html/jquery.tablesorter.min.js.zip").encode("latin-1", "replace")
|
||||||
tablesorter_js = tablesorter_js.decode("utf-8", "ignore")
|
tablesorter_js = tablesorter_js.decode("utf-8", "ignore")
|
||||||
flot_js = __get_zip_file_content__("jquery.flot.js")
|
flot_js = __get_zip_file_content__("jquery.flot.js")
|
||||||
pie_js = __get_zip_file_content__("jquery.flot.pie.js")
|
pie_js = __get_zip_file_content__("jquery.flot.pie.js")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2012-2014 Ejwa Software. All rights reserved.
|
# Copyright © 2012-2015 Ejwa Software. All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of gitinspector.
|
# This file is part of gitinspector.
|
||||||
#
|
#
|
||||||
|
@ -73,7 +73,7 @@ class Runner:
|
||||||
outputable.output(changes.ChangesOutput(self.hard))
|
outputable.output(changes.ChangesOutput(self.hard))
|
||||||
|
|
||||||
if changes.get(self.hard).get_commits():
|
if changes.get(self.hard).get_commits():
|
||||||
outputable.output(blame.BlameOutput(self.hard, self.useweeks))
|
outputable.output(blame.BlameOutput(changes.get(self.hard), self.hard, self.useweeks))
|
||||||
|
|
||||||
if self.timeline:
|
if self.timeline:
|
||||||
outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks))
|
outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2012-2013 Ejwa Software. All rights reserved.
|
# Copyright © 2012-2015 Ejwa Software. All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of gitinspector.
|
# This file is part of gitinspector.
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
#
|
#
|
||||||
# Copyright © 2012-2014 Ejwa Software. All rights reserved.
|
# Copyright © 2012-2015 Ejwa Software. All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of gitinspector.
|
# This file is part of gitinspector.
|
||||||
#
|
#
|
||||||
|
@ -134,9 +134,9 @@ def get_excess_column_count(string):
|
||||||
width_mapping = {'F': 2, 'H': 1, 'W': 2, 'Na': 1, 'N': 1, 'A': 1}
|
width_mapping = {'F': 2, 'H': 1, 'W': 2, 'Na': 1, 'N': 1, 'A': 1}
|
||||||
result = 0
|
result = 0
|
||||||
|
|
||||||
for c in string:
|
for i in string:
|
||||||
w = unicodedata.east_asian_width(c)
|
width = unicodedata.east_asian_width(i)
|
||||||
result += width_mapping[w]
|
result += width_mapping[width]
|
||||||
|
|
||||||
return result - len(string)
|
return result - len(string)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue