[meld] dirdiff: Rework CanonicalListing to be marginally less odd
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] dirdiff: Rework CanonicalListing to be marginally less odd
- Date: Sun, 31 Dec 2017 20:14:40 +0000 (UTC)
commit 8b9b439f61844ae49c6ccb190c4d1aec2f874145
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Dec 17 09:22:38 2017 +1000
dirdiff: Rework CanonicalListing to be marginally less odd
This is still a deeply odd class doing a weird thing inefficiently.
Oh well.
meld/dirdiff.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index b9a2848d..e76417df 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -232,10 +232,16 @@ class CanonicalListing(object):
self.errors.append((pane, item, self.items[ci][pane]))
def get(self):
- first = lambda seq: next(s for s in seq if s)
- filled = lambda seq: tuple([s or first(seq) for s in seq])
+ def filled(seq):
+ fill_value = next(s for s in seq if s)
+ return tuple(s or fill_value for s in seq)
+
return sorted(filled(v) for v in self.items.values())
+ @staticmethod
+ def canonicalize_lower(element):
+ return element.lower()
+
class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
"""Two or three way folder comparison"""
@@ -704,7 +710,7 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
canonicalize = None
if self.actiongroup.get_action("IgnoreCase").get_active():
- canonicalize = lambda x: x.lower()
+ canonicalize = CanonicalListing.canonicalize_lower
dirs = CanonicalListing(self.num_panes, canonicalize)
files = CanonicalListing(self.num_panes, canonicalize)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]