From 4f3e0d30739dce42ca886ed5626757ccca7a9037 Mon Sep 17 00:00:00 2001 From: Marc Harper Date: Tue, 20 Oct 2015 09:48:32 -0700 Subject: [PATCH] Restore relative imports of changes and filtering --- gitinspector/blame.py | 6 +++--- gitinspector/metrics.py | 6 +++--- gitinspector/output/filteringoutput.py | 30 +++++++++++++------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/gitinspector/blame.py b/gitinspector/blame.py index edba926..a0c1212 100644 --- a/gitinspector/blame.py +++ b/gitinspector/blame.py @@ -26,7 +26,7 @@ import subprocess import sys import threading -from . import changes +from .changes import FileDiff from . import comment from . import filtering from . import format @@ -140,11 +140,11 @@ class Blame(object): row = row.encode("latin-1", "replace") row = row.decode("utf-8", "replace").strip("\"").strip("'").strip() - if changes.FileDiff.is_valid_extension(row) and not filtering.set_filtered(changes.FileDiff.get_filename(row)): + if FileDiff.is_valid_extension(row) and not filtering.set_filtered(FileDiff.get_filename(row)): blame_command = filter(None, ["git", "blame", "--line-porcelain", "-w"] + \ (["-C", "-C", "-M"] if hard else []) + [interval.get_since(), interval.get_ref(), "--", row]) - thread = BlameThread(useweeks, changes, blame_command, changes.FileDiff.get_extension(row), self.blames, row.strip()) + thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row), self.blames, row.strip()) thread.daemon = True thread.start() diff --git a/gitinspector/metrics.py b/gitinspector/metrics.py index 9a9bda1..915b249 100644 --- a/gitinspector/metrics.py +++ b/gitinspector/metrics.py @@ -22,7 +22,7 @@ from __future__ import unicode_literals import re import subprocess -from . import changes +from .changes import FileDiff from . import comment from . import filtering from . import interval @@ -56,11 +56,11 @@ class MetricsLogic(object): i = i.encode("latin-1", "replace") i = i.decode("utf-8", "replace").strip("\"").strip("'").strip() - if changes.FileDiff.is_valid_extension(i) and not filtering.set_filtered(changes.FileDiff.get_filename(i)): + if FileDiff.is_valid_extension(i) and not filtering.set_filtered(FileDiff.get_filename(i)): file_r = subprocess.Popen(["git", "show", interval.get_ref() + ":{0}".format(i.strip())], bufsize=1, stdout=subprocess.PIPE).stdout.readlines() - extension = changes.FileDiff.get_extension(i) + extension = FileDiff.get_extension(i) lines = MetricsLogic.get_eloc(file_r, extension) cycc = MetricsLogic.get_cyclomatic_complexity(file_r, extension) diff --git a/gitinspector/output/filteringoutput.py b/gitinspector/output/filteringoutput.py index 9a9bcd7..ab194b8 100644 --- a/gitinspector/output/filteringoutput.py +++ b/gitinspector/output/filteringoutput.py @@ -21,7 +21,7 @@ from __future__ import print_function from __future__ import unicode_literals import textwrap -from .. import filtering +from ..filtering import __filters__, has_filtered from ..localization import N_ from .. import terminal from .outputable import Outputable @@ -48,12 +48,12 @@ class FilteringOutput(Outputable): return filtering_xml def output_html(self): - if filtering.has_filtered(): + if has_filtered(): filtering_xml = "
" - FilteringOutput.__output_html_section__(_(FILTERING_INFO_TEXT), filtering.__filters__["file"][1]) - FilteringOutput.__output_html_section__(_(FILTERING_AUTHOR_INFO_TEXT), filtering.__filters__["author"][1]) - FilteringOutput.__output_html_section__(_(FILTERING_EMAIL_INFO_TEXT), filtering.__filters__["email"][1]) - FilteringOutput.__output_html_section__(_(FILTERING_COMMIT_INFO_TEXT), filtering.__filters__["revision"][1]) + FilteringOutput.__output_html_section__(_(FILTERING_INFO_TEXT), __filters__["file"][1]) + FilteringOutput.__output_html_section__(_(FILTERING_AUTHOR_INFO_TEXT), __filters__["author"][1]) + FilteringOutput.__output_html_section__(_(FILTERING_EMAIL_INFO_TEXT), __filters__["email"][1]) + FilteringOutput.__output_html_section__(_(FILTERING_COMMIT_INFO_TEXT), __filters__["revision"][1]) filtering_xml += "
" print(filtering_xml) @@ -68,10 +68,10 @@ class FilteringOutput(Outputable): print("...%s" % i[-width+3:] if len(i) > width else i) def output_text(self): - FilteringOutput.__output_text_section__(_(FILTERING_INFO_TEXT), filtering.__filters__["file"][1]) - FilteringOutput.__output_text_section__(_(FILTERING_AUTHOR_INFO_TEXT), filtering.__filters__["author"][1]) - FilteringOutput.__output_text_section__(_(FILTERING_EMAIL_INFO_TEXT), filtering.__filters__["email"][1]) - FilteringOutput.__output_text_section__(_(FILTERING_COMMIT_INFO_TEXT), filtering.__filters__["revision"][1]) + FilteringOutput.__output_text_section__(_(FILTERING_INFO_TEXT), __filters__["file"][1]) + FilteringOutput.__output_text_section__(_(FILTERING_AUTHOR_INFO_TEXT), __filters__["author"][1]) + FilteringOutput.__output_text_section__(_(FILTERING_EMAIL_INFO_TEXT), __filters__["email"][1]) + FilteringOutput.__output_text_section__(_(FILTERING_COMMIT_INFO_TEXT), __filters__["revision"][1]) @staticmethod def __output_xml_section__(info_string, filtered, container_tagname): @@ -87,10 +87,10 @@ class FilteringOutput(Outputable): print("\t\t".format(container_tagname)) def output_xml(self): - if filtering.has_filtered(): + if has_filtered(): print("\t") - FilteringOutput.__output_xml_section__(_(FILTERING_INFO_TEXT), filtering.__filters__["file"][1], "files") - FilteringOutput.__output_xml_section__(_(FILTERING_AUTHOR_INFO_TEXT), filtering.__filters__["author"][1], "authors") - FilteringOutput.__output_xml_section__(_(FILTERING_EMAIL_INFO_TEXT), filtering.__filters__["email"][1], "emails") - FilteringOutput.__output_xml_section__(_(FILTERING_COMMIT_INFO_TEXT), filtering.__filters__["revision"][1], "revision") + FilteringOutput.__output_xml_section__(_(FILTERING_INFO_TEXT), __filters__["file"][1], "files") + FilteringOutput.__output_xml_section__(_(FILTERING_AUTHOR_INFO_TEXT), __filters__["author"][1], "authors") + FilteringOutput.__output_xml_section__(_(FILTERING_EMAIL_INFO_TEXT), __filters__["email"][1], "emails") + FilteringOutput.__output_xml_section__(_(FILTERING_COMMIT_INFO_TEXT), __filters__["revision"][1], "revision") print("\t")