From: Frank Brehm Date: Thu, 20 Apr 2017 09:41:20 +0000 (+0200) Subject: Applying flake8 to pp_lib/differ.py X-Git-Tag: 0.1.2~191 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=525609f7c0d152b8f7c109303398b0981448dd55;p=pixelpark%2Fadmin-tools.git Applying flake8 to pp_lib/differ.py --- diff --git a/pp_lib/differ.py b/pp_lib/differ.py index 085e22a..24b7d1d 100644 --- a/pp_lib/differ.py +++ b/pp_lib/differ.py @@ -7,7 +7,6 @@ """ # Standard modules -import sys import os import logging import re @@ -16,14 +15,15 @@ import difflib import pprint import copy -from difflib import Differ, SequenceMatcher, IS_LINE_JUNK, IS_CHARACTER_JUNK +from difflib import Differ, IS_LINE_JUNK, IS_CHARACTER_JUNK +# from difflib import SequenceMatcher # Third party modules import six # Own modules -__version__ = '0.2.3' +__version__ = '0.2.4' LOG = logging.getLogger(__name__) DEFAULT_COMMENT_CHAR = '#' @@ -53,7 +53,8 @@ class ConfigDiffer(Differ): return cls.re_linejunk.search(line) is not None # ------------------------------------------------------------------------- - def __init__(self, comment_chars=None, ignore_empty=False, + def __init__( + self, comment_chars=None, ignore_empty=False, ignore_whitespace=False, ignore_comment=False, case_insensitive=False): self.comment_chars = [] @@ -169,7 +170,6 @@ class ConfigDiffer(Differ): return new_line + old_line - # ------------------------------------------------------------------------- def __str__(self): """ @@ -206,7 +206,7 @@ class ConfigDiffer(Differ): else: line_list = [str(lines)] - if ( not self.ignore_empty and not self.ignore_whitespace and + if (not self.ignore_empty and not self.ignore_whitespace and not self.ignore_comment and not self.case_insensitive): return line_list @@ -218,7 +218,7 @@ class ConfigDiffer(Differ): if self.ignore_whitespace: item_cp = self.re_whitespace.sub(' ', item_cp) if self.ignore_comment: - item_cp = = self.remove_comments(item_cp) + item_cp = self.remove_comments(item_cp) if self.case_insensitive: item_cp = item_cp.lower() reult_list.append(item_cp)