Package: gamera / 1:3.4.2+git20160808.1725654-1

0006-use-system-python-modules.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
From 1c815bd0dd9342cb0b90557e41d58d604b205c56 Mon Sep 17 00:00:00 2001
From: Jakub Wilk <jwilk@debian.org>
Date: Sat, 17 Oct 2015 18:52:34 +0200
Subject: use-system-python-modules

   don't use embedded copies of standard Python modules
   Forwarded: not-needed
---
 gamera/classify.py               |  2 +-
 gamera/gui/classifier_display.py |  8 ++++----
 gamera/plugin.py                 |  5 ++---
 gamera/stats.py                  |  5 ++---
 gamera/util.py                   | 33 ++++++++++++++++-----------------
 5 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/gamera/classify.py b/gamera/classify.py
index b65522b..37abf35 100644
--- a/gamera/classify.py
+++ b/gamera/classify.py
@@ -758,7 +758,7 @@ connnected components, such as the lower-case *i*.
             raise ClassifierError("Grouping of only a single glyph is not allowed.")
 
       added = []
-      removed = util.sets.Set()
+      removed = set()
       for glyph in glyphs:
          for child in glyph.children_images:
             removed.add(child)
diff --git a/gamera/gui/classifier_display.py b/gamera/gui/classifier_display.py
index 1d5e9b1..7fab269 100644
--- a/gamera/gui/classifier_display.py
+++ b/gamera/gui/classifier_display.py
@@ -318,7 +318,7 @@ class PageMultiImageDisplay(ExtendedMultiImageDisplay):
                     (-1,0), (0,-1), (1,0), (0,1),   # +
                     (-1,-1), (-1,1), (1,-1), (1,1)) # x
    def find_glyphs_in_rect(self, x1, y1, x2, y2, shift):
-      matches = util.sets.Set()
+      matches = set()
       if x1 == x2 or y1 == y2:
          point = Point(x1, y1)
          for i, g in enumerate(self.sorted_glyphs):
@@ -336,7 +336,7 @@ class PageMultiImageDisplay(ExtendedMultiImageDisplay):
                   matches.add(i)
       first = True
       if shift:
-         selected = util.sets.Set()
+         selected = set()
          for i in self.GetSelectedIndices():
             selected.add(i)
          new_matches = matches.symmetric_difference(selected)
@@ -995,7 +995,7 @@ class ClassifierFrame(ImageFrameBase):
       if directory == None:
          gui_util.message("You must provide a directory to load.")
          return
-      error_messages = util.sets.Set()
+      error_messages = set()
       if settings:
          try:
             self._SaveClassifierSettings(
@@ -1094,7 +1094,7 @@ class ClassifierFrame(ImageFrameBase):
 
       self._save_by_criteria_dialog = results
 
-      glyphs = util.sets.Set()
+      glyphs = set()
       if classifier:
          glyphs.update(self._classifier.get_glyphs())
       if page:
diff --git a/gamera/plugin.py b/gamera/plugin.py
index 0fa00c8..7ee631a 100644
--- a/gamera/plugin.py
+++ b/gamera/plugin.py
@@ -23,7 +23,6 @@ from gamera.args import *
 from gamera import paths
 from gamera import util
 import new, os, os.path, imp, inspect, sys, copy
-from gamera.backport import sets
 from types import *
 from enums import *
 
@@ -173,10 +172,10 @@ def get_config_options(command):
 
 def methods_flat_category(category, pixel_type=None):
    if pixel_type == None:
-      methods = sets.Set()
+      methods = set()
       for pixel_type in ALL + [NONIMAGE]:
          # We have to cast the lists to sets here to make Python 2.3.0 happy.
-         methods.update(sets.Set(methods_flat_category(category, pixel_type)))
+         methods.update(set(methods_flat_category(category, pixel_type)))
       return list(methods)
    elif plugin_methods.has_key(pixel_type):
       methods = plugin_methods[pixel_type]
diff --git a/gamera/stats.py b/gamera/stats.py
index fa38f3d..d43137b 100644
--- a/gamera/stats.py
+++ b/gamera/stats.py
@@ -3063,9 +3063,8 @@ number of terms in y). Returns a value between 0 (orthogonal) and 1.
 
 Usage:  dices(x,y)
 """
-    import sets
-    x = sets.Set(x)
-    y = sets.Set(y)
+    x = set(x)
+    y = set(y)
     common = len(x.intersection(y))
     total = float(len(x) + len(y))
     return 2*common/total
diff --git a/gamera/util.py b/gamera/util.py
index 4e09111..813bd58 100644
--- a/gamera/util.py
+++ b/gamera/util.py
@@ -27,7 +27,7 @@ from math import pow
 from gamera.enums import *
 from gamera.gui import has_gui
 from gamera.config import config
-from gamera.backport import sets, textwrap
+import textwrap
 
 config.add_option(
    "-p", "--progress-bar", action="store_true",
@@ -470,9 +470,9 @@ class CallbackList(list, CallbackObject):
       list.extend(self, other)
       self.trigger_callback('length_change', len(self))
 
-class CallbackSet(sets.Set, CallbackObject):
+class CallbackSet(set, CallbackObject):
    def __init__(self, initset=None):
-      sets.Set.__init__(self, initset)
+      set.__init__(self, initset or ())
       CallbackObject.__init__(self)
 
    def __del__(self):
@@ -488,7 +488,7 @@ class CallbackSet(sets.Set, CallbackObject):
 
    def add(self, element):
       alert = element not in self
-      sets.Set.add(self, element)
+      set.add(self, element)
       if alert:
          self.trigger_callback('add', [element])
          self.trigger_callback('length_change', len(self))
@@ -496,25 +496,25 @@ class CallbackSet(sets.Set, CallbackObject):
 
    def remove(self, element):
       alert = element in self
-      sets.Set.remove(self, element)
+      set.remove(self, element)
       if alert:
          self.trigger_callback('remove', [element])
          self.trigger_callback('length_change', len(self))
 
    def discard(self, element):
       if element in self:
-         sets.Set.remove(self, element)
+         set.remove(self, element)
          self.trigger_callback('remove', [element])
          self.trigger_callback('length_change', len(self))
 
    def pop(self):
-      result = sets.Set.pop(self)
+      result = set.pop(self)
       self.trigger_callback('remove', [result])
       self.trigger_callback('length_change', len(self))
 
    def clear(self):
       self.trigger_callback('remove', self)
-      sets.Set.clear(self)
+      set.clear(self)
       self.trigger_callback('length_change', len(self))
 
    def update(self, iterable):
@@ -523,7 +523,7 @@ class CallbackSet(sets.Set, CallbackObject):
             if i not in self:
                yield i
       self.trigger_callback('add', iter())
-      sets.Set.update(self, iterable)
+      set.update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def difference_update(self, iterable):
@@ -532,7 +532,7 @@ class CallbackSet(sets.Set, CallbackObject):
             if i in self:
                yield i
       self.trigger_callback('remove', iter())
-      sets.Set.difference_update(self, iterable)
+      set.difference_update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def symmetric_difference_update(self, iterable):
@@ -546,7 +546,7 @@ class CallbackSet(sets.Set, CallbackObject):
                yield i
       self.trigger_callback('remove', remove_iter())
       self.trigger_callback('add', add_iter())
-      sets.Set.symmetric_difference_update(self, iterable)
+      set.symmetric_difference_update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def intersection_update(self, iterable):
@@ -555,7 +555,7 @@ class CallbackSet(sets.Set, CallbackObject):
             if not i in iterable:
                yield i
       self.trigger_callback('remove', iter())
-      sets.Set.intersection_update(self, iterable)
+      set.intersection_update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def union_update(self, other):
@@ -566,20 +566,19 @@ class CallbackSet(sets.Set, CallbackObject):
    def __setstate__(self, data):
       CallbackObject.__init__(self)
       self.trigger_callback('remove', self)
-      sets.Set.__setstate__(self, data)
+      set.__setstate__(self, data)
       self.trigger_callback('add', self)
       self.trigger_callback('length_change', len(self))
 
 def get_file_extensions(mode):
    from gamera import plugin
    import os.path
-   from gamera.backport import sets
    methods = plugin.methods_flat_category("File")
    methods = [y for x, y in methods if x.startswith(mode) and not x.endswith("image")]
 
    if len(methods) == 0:
       raise RuntimeError("There don't seem to be any imported plugins that can %s files.  Try running init_gamera() or explictly loading file i/o plugins such as tiff_support and png_support." % mode)
-   extensions = sets.Set()
+   extensions = set()
    types = []
    for method in methods:
       wildcards = ";".join(["*.%s;*.%s" %
@@ -587,8 +586,8 @@ def get_file_extensions(mode):
       type = "%s Files (%s)|%s" % (method.exts[0].upper(), wildcards, wildcards)
       types.append(type)
       # We have to cast the lists to sets here to make Python 2.3.0 happy.
-      extensions.update(sets.Set(method.exts))
-      extensions.update(sets.Set([x.upper() for x in method.exts]))
+      extensions.update(set(method.exts))
+      extensions.update(set([x.upper() for x in method.exts]))
    all_extensions = ";".join(["*.%s" % x for x in extensions])
    types.insert(0, "All images (%s)|%s" % (all_extensions, all_extensions))
    types.append("All files (*.*)|*.*")