[Python-modules-commits] [gamera] 06/12: use-system-python-modules

Daniel Stender stender at moszumanska.debian.org
Sun Jul 16 07:24:13 UTC 2017


This is an automated email from the git hooks/post-receive script.

stender pushed a commit to branch patch-queue/debian/master
in repository gamera.

commit 99691bb7227229a276bdebd5357eb021de420c5e
Author: Jakub Wilk <jwilk at debian.org>
Date:   Sat Oct 17 18:52:34 2015 +0200

    use-system-python-modules
    
       don't use embedded copies of standard Python modules
       Forwarded: not-needed
    
    Gbp-Pq: Name 0006-use-system-python-modules.patch
---
 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 (*.*)|*.*")

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/gamera.git



More information about the Python-modules-commits mailing list