[vlc-commits] commit: doc/transforms.py: whrandom is deprecated since python 2.1 ( Rafaël Carré )

git at videolan.org git at videolan.org
Wed Jul 7 20:53:12 CEST 2010


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Wed Jul  7 20:52:24 2010 +0200| [222f800a28377358198dc3df341f32ea085272af] | committer: Rafaël Carré 

doc/transforms.py: whrandom is deprecated since python 2.1

Only import needed functions

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=222f800a28377358198dc3df341f32ea085272af
---

 doc/transforms.py |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/doc/transforms.py b/doc/transforms.py
index 531fdd3..ac9d585 100644
--- a/doc/transforms.py
+++ b/doc/transforms.py
@@ -3,16 +3,12 @@
 # reference about classical DCT and DFT algorithms.
 
 
-import math
-import cmath
-
-pi = math.pi
-sin = math.sin
-cos = math.cos
-sqrt = math.sqrt
+from random import random
+from math import pi, sin, cos, sqrt
+from cmath import exp
 
 def exp_j (alpha):
-    return cmath.exp (alpha * 1j)
+    return exp (alpha * 1j)
 
 def conjugate (c):
     c = c + 0j
@@ -1067,15 +1063,13 @@ def dump (vector):
 	str = str + realstr #+ imagstr
     return "[%s]" % str
 
-import whrandom
-
 def test(N):
     input = vector(N)
     output = vector(N)
     verify = vector(N)
 
     for i in range(N):
-	input[i] = whrandom.random() + 1j * whrandom.random()
+	input[i] = random() + 1j * random()
 
     unscaled_DFT (N, input, output)
     unscaled_DFT (N, input, verify)



More information about the vlc-commits mailing list