[Python-modules-commits] [gamera] 01/12: constant-seed-for-docs

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 52e4bdee3727f7e21a116a515cbd8711e8f96172
Author: Reiner Herrmann <reiner at reiner-h.de>
Date:   Sat Oct 17 18:38:46 2015 +0200

    constant-seed-for-docs
    
       Use constant seed for example images. Importing random will seed the prng
       with the current system time, which will produce different example images
       on every build. To make the build reproducible, use a constant seed value.
       Author: Reiner Herrmann <reiner at reiner-h.de>
       Bug: https://bugs.debian.org/775228
       Forwarded: no
    
    Gbp-Pq: Name 0001-constant-seed-for-docs.patch
---
 gamera/plugins/draw.py | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/gamera/plugins/draw.py b/gamera/plugins/draw.py
index 006d1f6..39ce1ab 100644
--- a/gamera/plugins/draw.py
+++ b/gamera/plugins/draw.py
@@ -61,8 +61,9 @@ class draw_marker(PluginFunction):
   author = "Michael Droettboom"
 
   def __doc_example1__(images):
-    from random import randint
+    from random import randint, seed
     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]))
@@ -106,8 +107,9 @@ class draw_line(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint
+    from random import randint, seed
     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)),
@@ -160,8 +162,9 @@ class draw_hollow_rect(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint
+    from random import randint, seed
     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)),
@@ -199,8 +202,9 @@ class draw_filled_rect(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint
+    from random import randint, seed
     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)),
@@ -244,8 +248,9 @@ class draw_bezier(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint
+    from random import randint, seed
     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)),
@@ -292,8 +297,9 @@ class draw_circle(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint
+    from random import randint, seed
     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)),
@@ -447,8 +453,9 @@ class draw_text(PluginFunction):
   __call__ = staticmethod(__call__)
 
   def __doc_example1__(images):
-    from random import randint
+    from random import randint, seed
     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

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