Mercurial > ift6266
annotate pycaptcha/Facade.py @ 160:68160fd149fe
Simple script to doctest all modules beneath ift6266.
This ecxcludes scripts since most of the files launch computations
when imported and some even start a lot of jobs on the cluster (This
happened to me when testing).
author | Arnaud Bergeron <abergeron@gmail.com> |
---|---|
date | Thu, 25 Feb 2010 17:27:49 -0500 |
parents | 66b9513b578f |
children |
rev | line source |
---|---|
87 | 1 #!/usr/bin/env python |
2 | |
3 | |
4 | |
5 from Captcha.Visual.Tests import PseudoGimpy, AngryGimpy | |
6 import numpy | |
7 | |
8 # Une fonction simple pour generer un captcha | |
9 # ease : represente la difficulte du captcha a generer | |
10 # 0 = facile et 1 (ou autre chose) = difficile | |
11 #solution : specifie si on veut en retour un array numpy representant | |
12 #l image ou un tuple contenant l'array et la solution du captcha. | |
13 | |
14 # Des fontes additionnelles peuvent etre ajoutees au dossier pyCaptcha/Captcha/data/fonts/others | |
15 # Le programme choisit une fonte aleatoirement dans ce dossier ainsi que le dossir vera. | |
16 | |
17 | |
18 def generateCaptcha (ease=0, solution=0): | |
19 | |
20 if ease == 1: | |
21 g = AngryGimpy() | |
22 | |
23 else: | |
24 g = PseudoGimpy() | |
25 | |
26 i = g.render() | |
27 a = numpy.asarray(i) | |
28 | |
29 if solution == 0: | |
30 return a | |
31 | |
32 else : | |
126
66b9513b578f
Fixed bug in pycaptcha/Facade.py
boulanni <nicolas_boulanger@hotmail.com>
parents:
87
diff
changeset
|
33 return (a, g.solutions) |