Skip to content

Commit f7ec085

Browse files
author
Neil Fraser
committed
Python linting.
1 parent cd60d24 commit f7ec085

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

python2/diff_match_patch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828
__author__ = 'fraser@google.com (Neil Fraser)'
2929

30-
import math
3130
import re
3231
import sys
3332
import time
3433
import urllib
3534

35+
3636
class diff_match_patch:
3737
"""Class containing the diff, match and patch methods.
3838
@@ -847,8 +847,8 @@ def diff_cleanupSemanticScore(one, two):
847847
pointer += 1
848848

849849
# Define some regex patterns for matching boundaries.
850-
BLANKLINEEND = re.compile(r"\n\r?\n$");
851-
BLANKLINESTART = re.compile(r"^\r?\n\r?\n");
850+
BLANKLINEEND = re.compile(r"\n\r?\n$")
851+
BLANKLINESTART = re.compile(r"^\r?\n\r?\n")
852852

853853
def diff_cleanupEfficiency(self, diffs):
854854
"""Reduce the number of edits by eliminating operationally trivial
@@ -967,14 +967,14 @@ def diff_cleanupMerge(self, diffs):
967967
text_insert = text_insert[:-commonlength]
968968
text_delete = text_delete[:-commonlength]
969969
# Delete the offending records and add the merged ones.
970-
new_ops = [];
970+
new_ops = []
971971
if len(text_delete) != 0:
972972
new_ops.append((self.DIFF_DELETE, text_delete))
973973
if len(text_insert) != 0:
974974
new_ops.append((self.DIFF_INSERT, text_insert))
975975
pointer -= count_delete + count_insert
976976
diffs[pointer : pointer + count_delete + count_insert] = new_ops
977-
pointer += len(new_ops) + 1;
977+
pointer += len(new_ops) + 1
978978
elif pointer != 0 and diffs[pointer - 1][0] == self.DIFF_EQUAL:
979979
# Merge this equality with the previous one.
980980
diffs[pointer - 1] = (diffs[pointer - 1][0],

python2/tests/diff_match_patch_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ def testDiffCharsToLines(self):
172172
lineList.append(str(i) + "\n")
173173
chars = "".join(lineList)
174174
results = self.dmp.diff_linesToChars(chars, "")
175-
diffs = [(self.dmp.DIFF_INSERT, results[0])];
176-
self.dmp.diff_charsToLines(diffs, results[2]);
177-
self.assertEquals(chars, diffs[0][1]);
175+
diffs = [(self.dmp.DIFF_INSERT, results[0])]
176+
self.dmp.diff_charsToLines(diffs, results[2])
177+
self.assertEquals(chars, diffs[0][1])
178178

179179
def testDiffCleanupMerge(self):
180180
# Cleanup a messy diff.

python3/diff_match_patch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525

2626
__author__ = 'fraser@google.com (Neil Fraser)'
2727

28-
import math
2928
import re
3029
import sys
3130
import time
3231
import urllib.parse
3332

33+
3434
class diff_match_patch:
3535
"""Class containing the diff, match and patch methods.
3636
@@ -845,8 +845,8 @@ def diff_cleanupSemanticScore(one, two):
845845
pointer += 1
846846

847847
# Define some regex patterns for matching boundaries.
848-
BLANKLINEEND = re.compile(r"\n\r?\n$");
849-
BLANKLINESTART = re.compile(r"^\r?\n\r?\n");
848+
BLANKLINEEND = re.compile(r"\n\r?\n$")
849+
BLANKLINESTART = re.compile(r"^\r?\n\r?\n")
850850

851851
def diff_cleanupEfficiency(self, diffs):
852852
"""Reduce the number of edits by eliminating operationally trivial
@@ -965,14 +965,14 @@ def diff_cleanupMerge(self, diffs):
965965
text_insert = text_insert[:-commonlength]
966966
text_delete = text_delete[:-commonlength]
967967
# Delete the offending records and add the merged ones.
968-
new_ops = [];
968+
new_ops = []
969969
if len(text_delete) != 0:
970970
new_ops.append((self.DIFF_DELETE, text_delete))
971971
if len(text_insert) != 0:
972972
new_ops.append((self.DIFF_INSERT, text_insert))
973973
pointer -= count_delete + count_insert
974974
diffs[pointer : pointer + count_delete + count_insert] = new_ops
975-
pointer += len(new_ops) + 1;
975+
pointer += len(new_ops) + 1
976976
elif pointer != 0 and diffs[pointer - 1][0] == self.DIFF_EQUAL:
977977
# Merge this equality with the previous one.
978978
diffs[pointer - 1] = (diffs[pointer - 1][0],

python3/tests/diff_match_patch_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,9 @@ def testDiffCharsToLines(self):
174174
lineList.append(str(i) + "\n")
175175
chars = "".join(lineList)
176176
results = self.dmp.diff_linesToChars(chars, "")
177-
diffs = [(self.dmp.DIFF_INSERT, results[0])];
178-
self.dmp.diff_charsToLines(diffs, results[2]);
179-
self.assertEqual(chars, diffs[0][1]);
177+
diffs = [(self.dmp.DIFF_INSERT, results[0])]
178+
self.dmp.diff_charsToLines(diffs, results[2])
179+
self.assertEqual(chars, diffs[0][1])
180180

181181
def testDiffCleanupMerge(self):
182182
# Cleanup a messy diff.

0 commit comments

Comments
 (0)