[Python-modules-commits] [gamera] 01/03: unapply patches from git-dpm

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


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

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

commit ccd3303fa3f3b86f25c76e5ba78c9e8ddbeb62d4
Author: Daniel Stender <stender at debian.org>
Date:   Sun Jul 16 09:05:34 2017 +0200

    unapply patches from git-dpm
---
 INSTALL                                 | 26 +++++++++----------
 doc/draw_text_helper.py                 | 46 ---------------------------------
 doc/gendoc.py                           | 14 +---------
 doc/src/ga_optimization.txt             |  2 +-
 doc/src/install.txt                     | 20 +++++++-------
 doc/src/kdtree.txt                      |  2 +-
 doc/src/plugins_custom_types.txt        |  2 +-
 gamera/classify.py                      |  2 +-
 gamera/gendoc.py                        |  2 +-
 gamera/gui/classifier_display.py        |  8 +++---
 gamera/gui/gaoptimizer/SettingsPanel.py | 16 ++++++------
 gamera/knn.py                           |  4 +--
 gamera/paths.py                         | 12 +++++----
 gamera/plugin.py                        |  5 ++--
 gamera/plugins/draw.py                  | 21 +++++----------
 gamera/plugins/image_conversion.py      |  2 +-
 gamera/stats.py                         |  5 ++--
 gamera/toolkits/__init__.py             |  7 -----
 gamera/util.py                          | 33 +++++++++++------------
 setup.py                                |  1 +
 src/eodev/utils/eoParser.cpp            |  2 +-
 src/knnga.cpp                           |  2 +-
 src/knngamodule.cpp                     | 26 +++++++++----------
 src/pointobject.cpp                     |  2 +-
 tests/py/__init__.py                    |  1 -
 tests/py/test.py                        |  1 -
 tests/test_graph.py                     | 15 +++++------
 tests/test_image.py                     |  3 ---
 tests/test_plugins.py                   |  7 +----
 29 files changed, 105 insertions(+), 184 deletions(-)

diff --git a/INSTALL b/INSTALL
index fd2db9c..5cf45de 100644
--- a/INSTALL
+++ b/INSTALL
@@ -39,7 +39,7 @@ Prerequisites
    Fixes for common problems:
 
     - The Python 2.6 binary from python.org requires ``libmsvcr90.a``,
-      which is an erroneous in some versions of Mingw32. To fix it, you can
+      which is an errenous in some versions of Mingw32. To fix it, you can
       recreate the file from the DLL ``msvcr90.dll`` that comes with
       Python 2.6 with pexports__ and *dlltool* (the latter is part of Mingw32)::
 
@@ -162,7 +162,7 @@ terminal and type::
   python setup.py build
   sudo python setup.py install
 
-By default, parallelization of the genetic algorithms is only compiled
+By default, parallelization of the genetica algorithms is only compiled
 into Gamera under Linux and with gcc version > 4.2, because we could only
 get it running in this environment. If you are sure that you have unbroken
 OpenMP support on your system, you can compile Gamera with::
@@ -175,8 +175,8 @@ on your system for some reason, you can switch it off with::
   python setup.py build --openmp=no
 
 
-Installing without root privileges
-----------------------------------
+Installing without root priviledges
+-----------------------------------
 
 .. _without_root:
 
@@ -195,7 +195,7 @@ instructions (without using sudo)::
 Alternatively, you can set up a local installation by hand.
 
 Make a local python module directory somewhere that you have write
-privileges (such as your home directory)::
+priviledges (such as your home directory)::
 
   mkdir ~/python
 
@@ -276,7 +276,7 @@ To build Gamera, open a terminal and type::
 
   python setup.py build
 
-and then to install (you'll need to have admin privileges)::
+and then to install (you'll need to have admin priviledges)::
 
   sudo pythonw setup.py install
 
@@ -308,11 +308,11 @@ to your search PATH, or install the scripts to ``/usr/bin`` with::
   ``/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/sysconfig.py``
 
 
-Installing without root privileges
-``````````````````````````````````
+Installing without root priviledges
+```````````````````````````````````
 
 The instructions for `installing without root (administrator)
-privileges`__ can also be used on Mac OS-X.
+priviledges`__ can also be used on Mac OS-X.
 
 __ without_root_
 
@@ -372,7 +372,7 @@ To build Gamera, open a X11 terminal and type::
 
   python setup.py build
 
-and then to install (you'll need to have admin privileges)::
+and then to install (you'll need to have admin priviledges)::
 
   sudo python setup.py install
 
@@ -385,11 +385,11 @@ The scripts can be installed by::
   default installed to
   ``/System/Library/Frameworks/Python.framework/Versions/2.3/bin``.
 
-Installing without root privileges
-``````````````````````````````````
+Installing without root priviledges
+```````````````````````````````````
 
 The instructions for `installing without root (administrator)
-privileges`__ can also be used on Mac OS-X.
+priviledges`__ can also be used on Mac OS-X.
 
 __ without_root_
 
diff --git a/doc/draw_text_helper.py b/doc/draw_text_helper.py
deleted file mode 100644
index 63613d0..0000000
--- a/doc/draw_text_helper.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/usr/bin/python
-
-# This script (including  the following line) was generated by running itself:
-DATA = 320, 300, 'QlpoOTFBWSZTWdT8V9AAWJt//5JJJJJJJpJZJJJBIpCpJJJJJppNpLJJJIBJJEKVJJLI4A/ufO53Prd6Mni97e15cWWKl3prPPd7eeNnbwdWntjmcc3tyAHoZvduEiQQnop6BTap4EnkjT1NPTUMTamRpp6gDQB6mjIJETIiapijGSDIA0aAAaGgAAAADhoZNNDTI0NMjIMjI0MgMTRk0AZMjEMJNSJNBMmTCamjTKAGgNqPUGjQAGgAHqApKpKbTaICNGifqBPQEMI9QwAGpkYAnoAIkiaelIZFNT1P0oaA0DR6magANAABoDQPagQc/V5u+jPOOthnhRyPQ0BV7HVgNrJhTdUAuymBSUwmoQmoScE+f5aDbk21aqrVyDSMARwBCFJOcQ3sIZECzwYTB4488CGYm4PfFJFDpDEO05LlI90SiLqei/RhTExF1LPDphJx6KwVnuzkkpqk64N0UuMeSz [...]
-
-import sys
-import os
-import bz2
-import base64
-
-from gamera.core import init_gamera, Point, Dim, RGB, DENSE
-from gamera import plugin
-from gamera.plugins.draw import draw_text
-from gamera.plugins.string_io import _from_raw_string
-
-sys.stdout = file(os.devnull, 'w')
-init_gamera()
-sys.stdout = sys.__stdout__
-
-if __name__ == '__main__':
-	if not os.getenv('DISPLAY'):
-		print >>sys.stderr, 'This script needs access to an X server'
-		sys.exit(1)
-	import wxversion
-	wxversion.select(['2.8', '2.6', '2.5', '2.4'])
-	image = draw_text().__doc_example1__()
-	raw_string = image._to_raw_string()
-	bz2_string = bz2.compress(raw_string)
-	base64_string = base64.b64encode(bz2_string)
-	for line in open(__file__, 'rt'):
-		if line.startswith('DATA = '):
-			sys.stdout.write('DATA = %d, %d, %r\n' % (image.dim.ncols, image.dim.nrows, base64_string))
-		else:
-			sys.stdout.write(line)
-	sys.exit(0)
-
-if not os.getenv('DISPLAY'):
-	ncols, nrows, base64_string = DATA
-	bz2_string = base64.decodestring(base64_string)
-	raw_string = bz2.decompress(bz2_string)
-	image = _from_raw_string(Point(0, 0), Dim(ncols, nrows), RGB, DENSE, raw_string)
-	def static_draw_text_example(self, image=image):
-		return image
-	plugin.plugin_methods[RGB]['Draw']['draw_text'].doc_examples = [static_draw_text_example]
-
-# vim:ts=4 sw=4 noet
diff --git a/doc/gendoc.py b/doc/gendoc.py
index 6326d7b..e7887d6 100755
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -2,17 +2,6 @@
 
 from gamera import core, gendoc
 
-import sys
-import os
-import gamera.paths
-
-gamera.paths.test = os.path.join(os.path.dirname(__file__), '..', 'gamera', 'test')
-
-import draw_text_helper
-
-import wxversion
-wxversion.select(["3.0", "2.8", "2.6", "2.5", "2.4"])
-
 if __name__ == "__main__":
    core.init_gamera()
    gendoc.gendoc(classes=[
@@ -22,6 +11,5 @@ if __name__ == "__main__":
        'nrows ncols page_offset_x page_offset_y stride size bytes pixel_type storage_format'),
       ("gamera.core", "RGBPixel",
        'red green blue hue saturation value cie_x cie_y cie_z cie_Lab_L cie_Lab_a cie_Lab_b cyan magenta yellow')
-      ],
-      sourceforge_logo=False)
+      ])
    
diff --git a/doc/src/ga_optimization.txt b/doc/src/ga_optimization.txt
index 8b55d8f..31a47b3 100644
--- a/doc/src/ga_optimization.txt
+++ b/doc/src/ga_optimization.txt
@@ -8,7 +8,7 @@ Introduction
 Feature Selection, Weighting and Genetic Algorithms
 '''''''''''''''''''''''''''''''''''''''''''''''''''
 
-Feature selection is the technique of selecting a subset of good features
+Feature selection is the techique of selecting a subset of good features
 out of a larger featureset to obtain the features which are suitable
 for the best possible classification. Feature weighting is a generalization
 of feature selection with real-valued weights between [0,1] instead of the
diff --git a/doc/src/install.txt b/doc/src/install.txt
index 7dbf87e..40a248c 100644
--- a/doc/src/install.txt
+++ b/doc/src/install.txt
@@ -43,7 +43,7 @@ terminal and type::
   python setup.py build
   sudo python setup.py install
 
-By default, parallelization of the genetical algorithms is only compiled
+By default, parallelization of the genetica algorithms is only compiled
 into Gamera under Linux and with gcc version > 4.2, because we could only
 get it running in this environment. If you are sure that you have unbroken
 OpenMP support on your system, you can compile Gamera with::
@@ -56,7 +56,7 @@ on your system for some reason, you can switch it off with::
   python setup.py build --openmp=no
 
 
-Installing without root privileges
+Installing without root priviledges
 -----------------------------------
 
 .. _without_root:
@@ -76,7 +76,7 @@ instructions (without using sudo)::
 Alternatively, you can set up a local installation by hand.
 
 Make a local python module directory somewhere that you have write
-privileges (such as your home directory)::
+priviledges (such as your home directory)::
 
   mkdir ~/python
 
@@ -157,7 +157,7 @@ To build Gamera, open a terminal and type::
 
   python setup.py build
 
-and then to install (you'll need to have admin privileges)::
+and then to install (you'll need to have admin priviledges)::
 
   sudo pythonw setup.py install
 
@@ -194,11 +194,11 @@ to your search PATH, or install the scripts to ``/usr/bin`` with::
   ``/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/distutils/sysconfig.py``
 
 
-Installing without root privileges
+Installing without root priviledges
 ```````````````````````````````````
 
 The instructions for `installing without root (administrator)
-privileges`__ can also be used on Mac OS-X.
+priviledges`__ can also be used on Mac OS-X.
 
 __ without_root_
 
@@ -258,7 +258,7 @@ To build Gamera, open a X11 terminal and type::
 
   python setup.py build
 
-and then to install (you'll need to have admin privileges)::
+and then to install (you'll need to have admin priviledges)::
 
   sudo python setup.py install
 
@@ -271,11 +271,11 @@ The scripts can be installed by::
   default installed to
   ``/System/Library/Frameworks/Python.framework/Versions/2.3/bin``.
 
-Installing without root privileges
+Installing without root priviledges
 ```````````````````````````````````
 
 The instructions for `installing without root (administrator)
-privileges`__ can also be used on Mac OS-X.
+priviledges`__ can also be used on Mac OS-X.
 
 __ without_root_
 
@@ -404,7 +404,7 @@ in the Explorer, or from the DOS command prompt with::
    Fixes for common problems:
 
     - The Python 2.6 binary from python.org requires ``libmsvcr90.a``,
-      which is an erroneous in some versions of Mingw32. To fix it, you can
+      which is an errenous in some versions of Mingw32. To fix it, you can
       recreate the file from the DLL ``msvcr90.dll`` that comes with
       Python 2.6 with pexports__ and *dlltool* (the latter is part of Mingw32)::
 
diff --git a/doc/src/kdtree.txt b/doc/src/kdtree.txt
index 84e2f75..500998a 100644
--- a/doc/src/kdtree.txt
+++ b/doc/src/kdtree.txt
@@ -132,7 +132,7 @@ Each kd-tree is represented by instances of the ``KdTree`` class.
 Even though there are general kd-tree algorithms to add and remove
 nodes dynamically (see [Bentley1975]_), the present implementation
 does not support alteration of a once built tree. This has the
-consequence that tree nodes must be passed to the constructor of
+consequence that tree nodes must be passed to the contructor of
 ``KdTree``.
 
 A ``KdTree`` has the following (read only) properties:
diff --git a/doc/src/plugins_custom_types.txt b/doc/src/plugins_custom_types.txt
index a2a27d5..ed0e146 100644
--- a/doc/src/plugins_custom_types.txt
+++ b/doc/src/plugins_custom_types.txt
@@ -226,7 +226,7 @@ wrapper of the form:
       self.property2 = mc.property2
       # ...
 
-  # the plugin implementing the actual constructor of MyClass
+  # the plugin implementing the actual contructor of MyClass
   class create_myclass(PluginFunction):
     self_type = None
     args = Args([Int("arg1"), Real("arg2")])
diff --git a/gamera/classify.py b/gamera/classify.py
index 37abf35..b65522b 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 = set()
+      removed = util.sets.Set()
       for glyph in glyphs:
          for child in glyph.children_images:
             removed.add(child)
diff --git a/gamera/gendoc.py b/gamera/gendoc.py
index db05a81..4c17b01 100644
--- a/gamera/gendoc.py
+++ b/gamera/gendoc.py
@@ -233,7 +233,7 @@ class DocumentationGenerator:
             else:
                footer = '.. footer:: :raw-html:`<div style="text-align:right;">For contact information, see <a href="' + self.contact_url + '">' + self.contact_url + '</a></div>`\n\n'
             lines = (lines[:3] + 
-                     ["\n", u"**Last modified**:\n\n",
+                     ["\n", u"**Last modified**: %s\n\n" % mtime, 
                       ".. contents::\n\n", 
                       ".. role:: raw-html(raw)\n   :format: html\n",
                       footer
diff --git a/gamera/gui/classifier_display.py b/gamera/gui/classifier_display.py
index 7fab269..1d5e9b1 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 = set()
+      matches = util.sets.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 = set()
+         selected = util.sets.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 = set()
+      error_messages = util.sets.Set()
       if settings:
          try:
             self._SaveClassifierSettings(
@@ -1094,7 +1094,7 @@ class ClassifierFrame(ImageFrameBase):
 
       self._save_by_criteria_dialog = results
 
-      glyphs = set()
+      glyphs = util.sets.Set()
       if classifier:
          glyphs.update(self._classifier.get_glyphs())
       if page:
diff --git a/gamera/gui/gaoptimizer/SettingsPanel.py b/gamera/gui/gaoptimizer/SettingsPanel.py
index 7d8a70b..13b1ac5 100644
--- a/gamera/gui/gaoptimizer/SettingsPanel.py
+++ b/gamera/gui/gaoptimizer/SettingsPanel.py
@@ -301,7 +301,7 @@ class SettingsPanel(wx.ScrolledWindow):
                 elif expertWidget.GetName() == "randomSelection":
                     selection.setRandomSelection()
                 else:
-                    raise RuntimeError("Unknown selection method chosen")
+                    raise RuntimeError("Unknown selection method choosen")
 
         # Crossover GA settings
         cross = knnga.GACrossover()
@@ -323,10 +323,10 @@ class SettingsPanel(wx.ScrolledWindow):
                     cross.setHypercubeCrossover(self.frame.classifier.num_features, 0.0, 1.0, \
                         self.crossoverPanel.hypercubeCrossoverAlpha.GetValue())
                 else:
-                    raise RuntimeError("Unknown crossover method chosen")
+                    raise RuntimeError("Unknown crossover method choosen")
                 crossOpSet = True
         if not crossOpSet:
-            raise RuntimeError("At least one crossover operator must be chosen")
+            raise RuntimeError("At least one crossover operator must be choosen")
 
         # Mutation GA settings
         muta = knnga.GAMutation()
@@ -347,10 +347,10 @@ class SettingsPanel(wx.ScrolledWindow):
                         self.mutationPanel.gaussMutationSigma.GetValue(), \
                         self.mutationPanel.gaussMutationPchance.GetValue())
                 else:
-                    raise RuntimeError("Unknown mutation method chosen")
+                    raise RuntimeError("Unknown mutation method choosen")
                 mutOpSet = True
         if not mutOpSet:
-            raise RuntimeError("At least one mutation operator must be chosen")
+            raise RuntimeError("At least one mutation operator must be choosen")
 
         # Replacement GA settings
         replacement = knnga.GAReplacement()
@@ -364,7 +364,7 @@ class SettingsPanel(wx.ScrolledWindow):
                 elif expertWidget.GetName() == "SSGAdetTournament":
                     replacement.setSSGAdetTournament(self.replacementPanel.ssgaDetTourTsize.GetValue())
                 else:
-                    raise RuntimeError("Unknown replacement method chosen")
+                    raise RuntimeError("Unknown replacement method choosen")
 
         # Stop Criteria GA settings
         stop = knnga.GAStopCriteria()
@@ -382,10 +382,10 @@ class SettingsPanel(wx.ScrolledWindow):
                     stop.setSteadyStateStop(self.stopCriteriaPanel.steadyContinueMin.GetValue(), \
                         self.stopCriteriaPanel.steadyContinueNoChange.GetValue())
                 else:
-                    raise RuntimeError("Unknown stop criteria chosen")
+                    raise RuntimeError("Unknown stop criteria choosen")
                 stopCritSet = True
         if not stopCritSet:
-            raise RuntimeError("At least one stop criteria must be chosen")
+            raise RuntimeError("At least one stop criteria must be choosen")
 
         # Parallelization GA settings
         para = knnga.GAParallelization()
diff --git a/gamera/knn.py b/gamera/knn.py
index 9f148e3..53d7b1a 100644
--- a/gamera/knn.py
+++ b/gamera/knn.py
@@ -458,7 +458,7 @@ Set the selection vector elements by the corresponding feature name.
    described in get_selections_by_features.
 
 The dictionary must contain an entry for every feature of the currently
-active feature set, that has been set in the constructor of the classifier or
+active feature set, that has been set in the contructor of the classifier or
 by *change_feature_set*. Example:
 
 .. code:: Python
@@ -499,7 +499,7 @@ Set the selection vector elements for one specific feature.
 
 Set the weighing vector elements by the corresponding feature name.
 The dictionary must contain an entry for every feature of the currently
-active feature set, that has been set in the constructor of the classifier or
+active feature set, that has been set in the contructor of the classifier or
 by *change_feature_set*. Example:
 
 .. code:: Python
diff --git a/gamera/paths.py b/gamera/paths.py
index 824cae4..7386a83 100644
--- a/gamera/paths.py
+++ b/gamera/paths.py
@@ -22,7 +22,11 @@
 from __future__ import generators
 import os, sys, dircache, glob, imp  # Python standard library
 
-lib = os.path.dirname(__file__)
+if 1:
+   def dummy():
+      pass
+
+lib = os.path.dirname(os.path.realpath(dummy.func_code.co_filename))
 lib_gui = os.path.realpath(os.path.join(lib, "gui"))
 # Figure out if we are in the source directory or installed
 plugins = os.path.realpath(os.path.join(lib, "plugins"))
@@ -30,13 +34,11 @@ doc = os.path.realpath(os.path.join(lib, "doc"))
 sys.path.append(plugins)
 plugins_src = ""
 toolkits = os.path.realpath(os.path.join(lib, "toolkits"))
-test = '/usr/share/gamera/test/'
-test_results = os.path.join(test, 'results')
+test = os.path.realpath(os.path.join(lib, "test"))
+test_results = os.path.realpath(os.path.join(lib, "test/results"))
 
 def get_toolkit_names(dir):
    toolkits = []
-   if not os.path.exists(dir):
-      return toolkits
    listing = dircache.listdir(dir)
    dircache.annotate(dir, listing)
    for toolkit in listing:
diff --git a/gamera/plugin.py b/gamera/plugin.py
index 7ee631a..0fa00c8 100644
--- a/gamera/plugin.py
+++ b/gamera/plugin.py
@@ -23,6 +23,7 @@ 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 *
 
@@ -172,10 +173,10 @@ def get_config_options(command):
 
 def methods_flat_category(category, pixel_type=None):
    if pixel_type == None:
-      methods = set()
+      methods = sets.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(set(methods_flat_category(category, pixel_type)))
+         methods.update(sets.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/plugins/draw.py b/gamera/plugins/draw.py
index 39ce1ab..006d1f6 100644
--- a/gamera/plugins/draw.py
+++ b/gamera/plugins/draw.py
@@ -61,9 +61,8 @@ class draw_marker(PluginFunction):
   author = "Michael Droettboom"
 
   def __doc_example1__(images):
-    from random import randint, seed
+    from random import randint
     from gamera.core import Image, Dim
-    seed(0)
     image = Image((0, 0), Dim(100, 100), RGB, DENSE)
     points = [(randint(0, 100), randint(0, 100)) for x in range(4)]
     image.draw_bezier(*tuple(list(points) + [RGBPixel(255, 0, 0), 0.1]))
@@ -107,9 +106,8 @@ class draw_line(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint, seed
+    from random import randint
     from gamera.core import Image, Dim
-    seed(0)
     image = Image((0, 0), Dim(100, 100), RGB, DENSE)
     for i in range(10):
       image.draw_line((randint(0, 100), randint(0, 100)),
@@ -162,9 +160,8 @@ class draw_hollow_rect(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint, seed
+    from random import randint
     from gamera.core import Image, Dim
-    seed(0)
     image = Image((0, 0), Dim(100, 100), RGB, DENSE)
     for i in range(10):
       image.draw_hollow_rect((randint(0, 100), randint(0, 100)),
@@ -202,9 +199,8 @@ class draw_filled_rect(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint, seed
+    from random import randint
     from gamera.core import Image, Dim
-    seed(0)
     image = Image((0, 0), Dim(100, 100), RGB, DENSE)
     for i in range(10):
       image.draw_filled_rect((randint(0, 100), randint(0, 100)),
@@ -248,9 +244,8 @@ class draw_bezier(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint, seed
+    from random import randint
     from gamera.core import Image, Dim
-    seed(0)
     image = Image((0, 0), Dim(100, 100), RGB, DENSE)
     for i in range(10):
       image.draw_bezier((randint(0, 100), randint(0, 100)),
@@ -297,9 +292,8 @@ class draw_circle(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint, seed
+    from random import randint
     from gamera.core import Image, Dim
-    seed(0)
     image = Image((0, 0), Dim(100, 100), RGB, DENSE)
     for i in range(10):
       image.draw_circle((randint(0, 100), randint(0, 100)),
@@ -453,9 +447,8 @@ class draw_text(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint, seed
+    from random import randint
     from gamera.core import Image, Dim
-    seed(0)
     image = Image((0, 0), Dim(320, 300), RGB, DENSE)
 
     # These are some various Unicode encoded names of different
diff --git a/gamera/plugins/image_conversion.py b/gamera/plugins/image_conversion.py
index 5a8b745..a1ecbe4 100644
--- a/gamera/plugins/image_conversion.py
+++ b/gamera/plugins/image_conversion.py
@@ -23,7 +23,7 @@ import image_utilities, _image_conversion
 
 class to_rgb(PluginFunction):
     """
-    Converts the given image to an RGB image according to the following rules:
+    Converts the given image to an RGB image according to teh following rules:
 
     - for ONEBIT images, 0 is mapped to (255,255,255) and everything else to (0,0,0)
     - for GREYSCALE and GREY16 images, R=G=B
diff --git a/gamera/stats.py b/gamera/stats.py
index d43137b..fa38f3d 100644
--- a/gamera/stats.py
+++ b/gamera/stats.py
@@ -3063,8 +3063,9 @@ number of terms in y). Returns a value between 0 (orthogonal) and 1.
 
 Usage:  dices(x,y)
 """
-    x = set(x)
-    y = set(y)
+    import sets
+    x = sets.Set(x)
+    y = sets.Set(y)
     common = len(x.intersection(y))
     total = float(len(x) + len(y))
     return 2*common/total
diff --git a/gamera/toolkits/__init__.py b/gamera/toolkits/__init__.py
index d01835d..e69de29 100644
--- a/gamera/toolkits/__init__.py
+++ b/gamera/toolkits/__init__.py
@@ -1,7 +0,0 @@
-import distutils.sysconfig
-import pkgutil
-__path__ = (
-    pkgutil.extend_path(__path__, __name__) +
-    [distutils.sysconfig.get_python_lib() + '/gamera/toolkits']
-)
-del distutils, pkgutil
diff --git a/gamera/util.py b/gamera/util.py
index 813bd58..4e09111 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
-import textwrap
+from gamera.backport import sets, 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(set, CallbackObject):
+class CallbackSet(sets.Set, CallbackObject):
    def __init__(self, initset=None):
-      set.__init__(self, initset or ())
+      sets.Set.__init__(self, initset)
       CallbackObject.__init__(self)
 
    def __del__(self):
@@ -488,7 +488,7 @@ class CallbackSet(set, CallbackObject):
 
    def add(self, element):
       alert = element not in self
-      set.add(self, element)
+      sets.Set.add(self, element)
       if alert:
          self.trigger_callback('add', [element])
          self.trigger_callback('length_change', len(self))
@@ -496,25 +496,25 @@ class CallbackSet(set, CallbackObject):
 
    def remove(self, element):
       alert = element in self
-      set.remove(self, element)
+      sets.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:
-         set.remove(self, element)
+         sets.Set.remove(self, element)
          self.trigger_callback('remove', [element])
          self.trigger_callback('length_change', len(self))
 
    def pop(self):
-      result = set.pop(self)
+      result = sets.Set.pop(self)
       self.trigger_callback('remove', [result])
       self.trigger_callback('length_change', len(self))
 
    def clear(self):
       self.trigger_callback('remove', self)
-      set.clear(self)
+      sets.Set.clear(self)
       self.trigger_callback('length_change', len(self))
 
    def update(self, iterable):
@@ -523,7 +523,7 @@ class CallbackSet(set, CallbackObject):
             if i not in self:
                yield i
       self.trigger_callback('add', iter())
-      set.update(self, iterable)
+      sets.Set.update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def difference_update(self, iterable):
@@ -532,7 +532,7 @@ class CallbackSet(set, CallbackObject):
             if i in self:
                yield i
       self.trigger_callback('remove', iter())
-      set.difference_update(self, iterable)
+      sets.Set.difference_update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def symmetric_difference_update(self, iterable):
@@ -546,7 +546,7 @@ class CallbackSet(set, CallbackObject):
                yield i
       self.trigger_callback('remove', remove_iter())
       self.trigger_callback('add', add_iter())
-      set.symmetric_difference_update(self, iterable)
+      sets.Set.symmetric_difference_update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def intersection_update(self, iterable):
@@ -555,7 +555,7 @@ class CallbackSet(set, CallbackObject):
             if not i in iterable:
                yield i
       self.trigger_callback('remove', iter())
-      set.intersection_update(self, iterable)
+      sets.Set.intersection_update(self, iterable)
       self.trigger_callback('length_change', len(self))
 
    def union_update(self, other):
@@ -566,19 +566,20 @@ class CallbackSet(set, CallbackObject):
    def __setstate__(self, data):
       CallbackObject.__init__(self)
       self.trigger_callback('remove', self)
-      set.__setstate__(self, data)
+      sets.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 = set()
+   extensions = sets.Set()
    types = []
    for method in methods:
       wildcards = ";".join(["*.%s;*.%s" %
@@ -586,8 +587,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(set(method.exts))
-      extensions.update(set([x.upper() for x in method.exts]))
+      extensions.update(sets.Set(method.exts))
+      extensions.update(sets.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 (*.*)|*.*")
diff --git a/setup.py b/setup.py
index faff021..c7f1782 100644
--- a/setup.py
+++ b/setup.py
@@ -250,6 +250,7 @@ includes = [(os.path.join(gamera_setup.include_path, path),
             for path, ext in
             ("", "*.hpp"),
             ("plugins", "*.hpp"),
+            ("vigra", "*.hxx"),
             ("geostructs", "*.hpp"),
             ("graph", "*.hpp")]
 
diff --git a/src/eodev/utils/eoParser.cpp b/src/eodev/utils/eoParser.cpp
index d2ee5c2..cc306bf 100644
--- a/src/eodev/utils/eoParser.cpp
+++ b/src/eodev/utils/eoParser.cpp
@@ -82,7 +82,7 @@ eoParser::eoParser ( unsigned _argc, char **_argv , string _programDescription,
     programDescription( _programDescription),
     needHelpMessage( false ),
     needHelp(false, "help", "Prints this message", 'h'),
-    stopOnUnknownParam(true, "stopOnUnknownParam", "Stop if unknown param entered", '\0')
+    stopOnUnknownParam(true, "stopOnUnknownParam", "Stop if unkown param entered", '\0')
 {
     // need to process the param file first
     // if we want command-line to have highest priority
diff --git a/src/knnga.cpp b/src/knnga.cpp
index 775dc5c..8efaadd 100644
--- a/src/knnga.cpp
+++ b/src/knnga.cpp
@@ -558,7 +558,7 @@ void GAOptimization<EOT>::StartCalculation() {
 
     // adjust the individual size for the case of weighting with
     // prior deselected features and build an index relation map
-    // for further index mapping
+    // for futher index mapping
     unsigned int indiLength = (unsigned int)this->knn->num_features;
     std::map<unsigned int, unsigned int> indexRelation;
     unsigned int indiIndex = 0;
diff --git a/src/knngamodule.cpp b/src/knngamodule.cpp
index b69ab5d..2fb5b87 100644
--- a/src/knngamodule.cpp
+++ b/src/knngamodule.cpp
@@ -496,7 +496,7 @@ void init_GASelectionType(PyObject *d) {
         "The ``GASelection`` constructor creates a new settings object "
         "for the GA-optimization which specifies the used individuals selection method. "
         "This object can later be used in an ``GAOptimization``-object. \n\n"
-        "Only one selection method can be chosen. Multiple settings will "
+        "Only one selection method can be choosen. Multiple settings will "
         "override each other.";
 
     PyType_Ready(&GASelectionType);
@@ -556,9 +556,9 @@ PyMethodDef GACrossover_methods[] = {
                "    the number of used features. Usually this value is set to "
                "``classifier.num_features``.\n"
                "double *min* (optional)\n"
-               "    the minimum value which is allowed in an allele (usually 0.0)\n"
+               "    the minimum value which is allowed in an allel (usually 0.0)\n"
                "double *max* (optional)\n"
-               "    the maximum value which is allowed in an allele (usually 1.0)\n"
+               "    the maximum value which is allowed in an allel (usually 1.0)\n"
                "double *eta* (optional)\n"
                "    the amount of exploration OUTSIDE the parents as in BLX-alpha notation"
     },
@@ -573,9 +573,9 @@ PyMethodDef GACrossover_methods[] = {
                "    the number of used features. Usually this value is set to "
                "``classifier.num_features``.\n"
                "double *min* (optional)\n"
-               "    the minimum value which is allowed in an allele (usually 0.0)\n"
+               "    the minimum value which is allowed in an allel (usually 0.0)\n"
                "double *max* (optional)\n"
-               "    the maximum value which is allowed in an allele (usually 1.0)\n"
+               "    the maximum value which is allowed in an allel (usually 1.0)\n"
                "double *alpha* (optional)\n"
                "    the amount of exploration OUTSIDE the parents as in BLX-alpha notation"
     },
@@ -590,9 +590,9 @@ PyMethodDef GACrossover_methods[] = {
                "    the number of used features. Usually this value is set to "
                "``classifier.num_features``.\n"
                "double *min* (optional)\n"
-               "    the minimum value which is allowed in an allele (usually 0.0)\n"
+               "    the minimum value which is allowed in an allel (usually 0.0)\n"
                "double *max* (optional)\n"
-               "    the maximum value which is allowed in an allele (usually 1.0)\n"
+               "    the maximum value which is allowed in an allel (usually 1.0)\n"
                "double *alpha* (optional)\n"
                "    the amount of exploration OUTSIDE the parents as in BLX-alpha notation"
     },
@@ -811,7 +811,7 @@ PyMethodDef GAMutation_methods[] = {
                "individuals. This means that this operator only effects "
                "feature selection.\n\n"
                "double *rate* (optional)\n"
-               "    the probability for mutation of an allele (should be in [0,1])\n"
+               "    the probability for mutation of an allel (should be in [0,1])\n"
                "bool *normalize* (optional)\n"
                "    if true ``rate/chromosomeSize`` is used"
     },
@@ -825,14 +825,14 @@ PyMethodDef GAMutation_methods[] = {
                "    the number of used features. Usually this value is set to "
                "``classifier.num_features``.\n"
                "double *min*\n"
-               "    the minimum value which is allowed in an allele (usually 0.0)\n"
+               "    the minimum value which is allowed in an allel (usually 0.0)\n"
                "double *max*\n"
-               "    the maximum value which is allowed in an allele (usually 1.0)\n"
+               "    the maximum value which is allowed in an allel (usually 1.0)\n"
                "double *sigma*\n"
                "    the standard deviation of the gaussian distribution. This "
-               "parameter determines the strength of the mutation.\n"
+               "paramater determines the strength of the mutation.\n"
                "double *rate*\n"
-               "    the probability for mutating an allele (should be in [0,1])\n"
+               "    the probability for mutating an allel (should be in [0,1])\n"
     },
     { NULL }
 };
@@ -1136,7 +1136,7 @@ void init_GAReplacementType(PyObject *d) {
         "The ``GAReplacement`` constructor creates a new settings object "
         "for the GA-optimization which specifies the used replacement method. "
         "This object can later be used in an ``GAOptimization``-object. \n\n"
-        "Only one replacement method can be chosen. Multiple settings will "
+        "Only one replacement method can be choosen. Multiple settings will "
         "override each other.";
 
     PyType_Ready(&GAReplacementType);
diff --git a/src/pointobject.cpp b/src/pointobject.cpp
index 69b3634..a6906f5 100644
--- a/src/pointobject.cpp
+++ b/src/pointobject.cpp
@@ -54,7 +54,7 @@ static PyGetSetDef point_getset[] = {
 
 static PyMethodDef point_methods[] = {
   { (char *)"move", point_move, METH_VARARGS,
-    (char *)"**move** (*x*, *y*)\n\nMoves the point by the given *x*, *y* coordinate, i.e. the vector (*x*, *y*) is added to the point. The following two lines are equivalent:\n\n.. code:: Python\n\n    p.move(x,y)\n    p += Point(x,y)"},
+    (char *)"**move** (*x*, *y*)\n\nMoves the point by the given *x*, *y* coordinate, i.e. the vector (*x*, *y*) is added to the point. The following two lineas are equivalent:\n\n.. code:: Python\n\n    p.move(x,y)\n    p += Point(x,y)"},
   { NULL }
 };
 
diff --git a/tests/py/__init__.py b/tests/py/__init__.py
deleted file mode 100644
index 792d600..0000000
--- a/tests/py/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-#
diff --git a/tests/py/test.py b/tests/py/test.py
deleted file mode 100644
index cf7a2a8..0000000
--- a/tests/py/test.py
+++ /dev/null
@@ -1 +0,0 @@
-from nose.tools import assert_raises as raises
diff --git a/tests/test_graph.py b/tests/test_graph.py
index c698b7c..8435ce3 100644
--- a/tests/test_graph.py
+++ b/tests/test_graph.py
@@ -935,8 +935,7 @@ def memory_usage():
       cmd = "ps u -p %i | awk '{sum=sum+$6}; END {print sum}'" % os.getpid()
       p = os.popen(cmd, "r")
       memory = p.readline().strip()
-      if p.close() is not None:
-            raise OSError
+      p.close()
       return memory
 
 
@@ -1083,9 +1082,7 @@ def _make_test_size(t, flag, size):
 #small tests
 for test in tests_small:
    for flag in flags:
-      f = _make_test(test,flag)
-      f.__name__ = "test_small_%d_%s" % (flag, test.__name__)
-      setattr(TestGraph, f.__name__, f)
+      setattr(TestGraph, "test_small_%d_%s" % (flag, test.__name__ ), _make_test(test,flag))
 
 #large default
 #for test in tests_large:
@@ -1096,10 +1093,10 @@ for test in tests_small:
 for size in [512]:
    for test in tests_large:
       for flag in flags:
-         f = _make_test_size(test, flag, size)
-         f.__name__ = "test_large_%d_%d_%s" % (flag, size, test.__name__)
-         setattr(TestGraph, f.__name__, f)
-del f, test
+         setattr(TestGraph, "test_large_%d_%d_%s" % (flag, size, test.__name__ ), 
+                 _make_test_size(test, flag, size))
+   
+
 
 
 
diff --git a/tests/test_image.py b/tests/test_image.py
index 0109197..7f46252 100644
--- a/tests/test_image.py
+++ b/tests/test_image.py
@@ -20,7 +20,6 @@ def make_test(inner):
                           (GREY16, xrange((2 ** 16) - 1))]:
          inner(type, value, DENSE)
       inner(ONEBIT, xrange(0, 2 ** 16 - 1), RLE)
-   test.__name__ = inner.__name__.lstrip('_')
    return test
 
 def _test_image_constructors(type, value, storage):
... 21 lines suppressed ...

-- 
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