Global cleanup fixing some pylint violations.

This commit is contained in:
Adam Waldenberg 2015-10-05 06:17:10 +02:00
parent c0cb2d2801
commit 38df413ebf
9 changed files with 24 additions and 22 deletions

View File

@ -3,7 +3,7 @@ include-ids=yes
comment=yes
[MESSAGES CONTROL]
disable=C0111,R0801,W0232,W0603,W0622,W0702
disable=C0111,R0801,W0232,W0603,W0622,W0702,W0141
[DESIGN]

View File

@ -1,6 +1,6 @@
# 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.
#
@ -40,7 +40,7 @@ def get_basedir_git():
if sp.returncode != 0:
sys.exit(_("Error processing git repository at \"%s\"." % os.getcwd()))
isbare = (isbare[0].decode("utf-8", "replace").strip() == "true")
absolute_path = ""
absolute_path = None
if isbare:
absolute_path = subprocess.Popen(["git", "rev-parse", "--git-dir"], bufsize=1, stdout=subprocess.PIPE).stdout

View File

@ -23,7 +23,6 @@ from localization import N_
from outputable import Outputable
from changes import FileDiff
import comment
import changes
import datetime
import filtering
import format
@ -107,6 +106,7 @@ class BlameThread(threading.Thread):
self.__clear_blamechunk_info__()
#pylint: disable=W0201
for j in range(0, len(rows)):
row = rows[j].decode("utf-8", "replace").strip()
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")
class BlameOutput(Outputable):
def __init__(self, hard, useweeks):
def __init__(self, changes, hard, useweeks):
if format.is_interactive_format():
print("")
self.changes = changes
self.hard = hard
self.useweeks = useweeks
self.changes = changes.get(hard)
get(self.hard, self.useweeks, self.changes)
Outputable.__init__(self)

View File

@ -21,7 +21,6 @@ from __future__ import print_function
from __future__ import unicode_literals
from localization import N_
from outputable import Outputable
import codecs
import datetime
import extensions
import filtering
@ -31,7 +30,6 @@ import interval
import json
import multiprocessing
import os
import re
import subprocess
import terminal
import textwrap
@ -127,8 +125,9 @@ class ChangesThread(threading.Thread):
thread.start()
def run(self):
git_log_r = subprocess.Popen(filter(None, ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE", "--stat=100000,8192", "--no-merges", "-w",
interval.get_since(), interval.get_until(), "--date=short"] + (["-C", "-C", "-M"] if self.hard else []) +
git_log_r = subprocess.Popen(filter(None, ["git", "log", "--reverse", "--pretty=%cd|%H|%aN|%aE",
"--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
lines = git_log_r.readlines()
git_log_r.close()
@ -225,7 +224,8 @@ class Changes:
def get_commits(self):
return self.commits
def modify_authorinfo(self, authors, key, commit):
@staticmethod
def modify_authorinfo(authors, key, commit):
if authors.get(key, None) == None:
authors[key] = AuthorInfo()
@ -239,14 +239,14 @@ class Changes:
def get_authorinfo_list(self):
if not self.authors:
for i in self.commits:
self.modify_authorinfo(self.authors, i.author, i)
Changes.modify_authorinfo(self.authors, i.author, i)
return self.authors
def get_authordateinfo_list(self):
if not self.authors_dateinfo:
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

View File

@ -26,7 +26,8 @@ import subprocess
import terminal
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):
def __init__(self, msg):

View File

@ -67,7 +67,8 @@ def output_header():
if __selected_format__ == "html" or __selected_format__ == "htmlembedded":
base = basedir.get_basedir()
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")
flot_js = __get_zip_file_content__("jquery.flot.js")
pie_js = __get_zip_file_content__("jquery.flot.pie.js")

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# 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.
#
@ -73,7 +73,7 @@ class Runner:
outputable.output(changes.ChangesOutput(self.hard))
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:
outputable.output(timeline.Timeline(changes.get(self.hard), self.useweeks))

View File

@ -1,6 +1,6 @@
# 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.
#

View File

@ -1,6 +1,6 @@
# 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.
#
@ -134,9 +134,9 @@ def get_excess_column_count(string):
width_mapping = {'F': 2, 'H': 1, 'W': 2, 'Na': 1, 'N': 1, 'A': 1}
result = 0
for c in string:
w = unicodedata.east_asian_width(c)
result += width_mapping[w]
for i in string:
width = unicodedata.east_asian_width(i)
result += width_mapping[width]
return result - len(string)