[python-arrayfire] 66/250: Capitalizing the class names for Seq, Index, ParallelRange and Cell

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:32 UTC 2016


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

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit 3c0fc620d10be9cb4e7031353313a404ba54898b
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Thu Aug 27 18:28:38 2015 -0400

    Capitalizing the class names for Seq, Index, ParallelRange and Cell
---
 arrayfire/__init__.py |  6 +++---
 arrayfire/features.py |  2 +-
 arrayfire/graphics.py |  8 ++++----
 arrayfire/index.py    | 26 +++++++++++++-------------
 arrayfire/vision.py   |  4 ++--
 tests/simple_index.py |  6 +++---
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/arrayfire/__init__.py b/arrayfire/__init__.py
index dbe10e0..b1876cb 100644
--- a/arrayfire/__init__.py
+++ b/arrayfire/__init__.py
@@ -34,9 +34,9 @@ del os
 #do not export internal classes
 del BaseArray
 del uidx
-del seq
-del index
-del cell
+del Seq
+del Index
+del Cell
 del bcast
 
 #do not export internal functions
diff --git a/arrayfire/features.py b/arrayfire/features.py
index b30731c..dbcc601 100644
--- a/arrayfire/features.py
+++ b/arrayfire/features.py
@@ -10,7 +10,7 @@ from .library import *
 from .array import *
 import numbers
 
-class features(object):
+class Features(object):
 
     def __init__(self, num=None):
         self.feat = ct.c_void_p(0)
diff --git a/arrayfire/graphics.py b/arrayfire/graphics.py
index 392cbd0..ca4893e 100644
--- a/arrayfire/graphics.py
+++ b/arrayfire/graphics.py
@@ -10,7 +10,7 @@
 from .library import *
 from .array import *
 
-class cell(ct.Structure):
+class Cell(ct.Structure):
     _fields_ = [("row", ct.c_int),
                 ("col", ct.c_int),
                 ("title", ct.c_char_p),
@@ -52,15 +52,15 @@ class window(object):
         self._cmap = cmap
 
     def image(self, img, title=None):
-        _cell = cell(self._r, self._c, title, self._cmap)
+        _cell = Cell(self._r, self._c, title, self._cmap)
         safe_call(clib.af_draw_image(self._wnd, img.arr, ct.pointer(_cell)))
 
     def plot(self, X, Y, title=None):
-        _cell = cell(self._r, self._c, title, self._cmap)
+        _cell = Cell(self._r, self._c, title, self._cmap)
         safe_call(clib.af_draw_plot(self._wnd, X.arr, Y.arr, ct.pointer(_cell)))
 
     def hist(self, X, min_val, max_val, title=None):
-        _cell = cell(self._r, self._c, title, self._cmap)
+        _cell = Cell(self._r, self._c, title, self._cmap)
         safe_call(clib.af_draw_hist(self._wnd, X.arr, \
                                     ct.c_double(max_val), ct.c_double(min_val),\
                                     ct.pointer(_cell)))
diff --git a/arrayfire/index.py b/arrayfire/index.py
index bbf10fe..1a17100 100644
--- a/arrayfire/index.py
+++ b/arrayfire/index.py
@@ -11,7 +11,7 @@ from .util import *
 from .base import *
 from .broadcast import *
 
-class seq(ct.Structure):
+class Seq(ct.Structure):
     _fields_ = [("begin", ct.c_double),
                 ("end"  , ct.c_double),
                 ("step" , ct.c_double)]
@@ -36,7 +36,7 @@ class seq(ct.Structure):
         else:
             raise IndexError("Invalid type while indexing arrayfire.array")
 
-class parallel_range(seq):
+class ParallelRange(Seq):
 
     def __init__(self, start, stop=None, step=None):
 
@@ -45,7 +45,7 @@ class parallel_range(seq):
             start = 0
 
         self.S = slice(start, stop, step)
-        super(parallel_range, self).__init__(self.S)
+        super(ParallelRange, self).__init__(self.S)
 
     def __iter__(self):
         return self
@@ -81,9 +81,9 @@ def slice_to_length(key, dim):
 
 class uidx(ct.Union):
     _fields_ = [("arr", ct.c_void_p),
-                ("seq", seq)]
+                ("seq", Seq)]
 
-class index(ct.Structure):
+class Index(ct.Structure):
     _fields_ = [("idx", uidx),
                 ("isSeq", ct.c_bool),
                 ("isBatch", ct.c_bool)]
@@ -97,26 +97,26 @@ class index(ct.Structure):
         if isinstance(idx, BaseArray):
             self.idx.arr = idx.arr
             self.isSeq   = False
-        elif isinstance(idx, parallel_range):
+        elif isinstance(idx, ParallelRange):
             self.idx.seq = idx
             self.isBatch = True
         else:
-            self.idx.seq = seq(idx)
+            self.idx.seq = Seq(idx)
 
 def get_indices(key, n_dims):
 
-    index_vec = index * n_dims
+    index_vec = Index * n_dims
     inds = index_vec()
 
     for n in range(n_dims):
-        inds[n] = index(slice(None))
+        inds[n] = Index(slice(None))
 
     if isinstance(key, tuple):
         n_idx = len(key)
         for n in range(n_idx):
-            inds[n] = index(key[n])
+            inds[n] = Index(key[n])
     else:
-        inds[0] = index(key)
+        inds[0] = Index(key)
 
     return inds
 
@@ -133,7 +133,7 @@ def get_assign_dims(key, idims):
     elif isinstance(key, slice):
         dims[0] = slice_to_length(key, idims[0])
         return dims
-    elif isinstance(key, parallel_range):
+    elif isinstance(key, ParallelRange):
         dims[0] = slice_to_length(key.S, idims[0])
         return dims
     elif isinstance(key, BaseArray):
@@ -152,7 +152,7 @@ def get_assign_dims(key, idims):
                 dims[n] = key[n].elements()
             elif (isinstance(key[n], slice)):
                 dims[n] = slice_to_length(key[n], idims[n])
-            elif (isinstance(key[n], parallel_range)):
+            elif (isinstance(key[n], ParallelRange)):
                 dims[n] = slice_to_length(key[n].S, idims[n])
             else:
                 raise IndexError("Invalid type while assigning to arrayfire.array")
diff --git a/arrayfire/vision.py b/arrayfire/vision.py
index 3ab9af5..52c7f3b 100644
--- a/arrayfire/vision.py
+++ b/arrayfire/vision.py
@@ -11,14 +11,14 @@ from .array import *
 from .features import *
 
 def fast(image, threshold=20.0, arc_length=9, non_max=True, feature_ratio=0.05, edge=3):
-    out = features()
+    out = Features()
     safe_call(clib.af_fast(ct.pointer(out.feat),\
                            image.arr, ct.c_float(threshold), ct.c_uint(arc_length), non_max, \
                            ct.c_float(feature_ratio), ct.c_uint(edge)))
     return out
 
 def orb(image, threshold=20.0, max_features=400, scale = 1.5, num_levels = 4, blur_image = False):
-    feat = features()
+    feat = Features()
     desc = Array()
     safe_call(clib.af_orb(ct.pointer(feat.feat), ct.pointer(desc.arr),\
                           ct.c_float(threshold), ct.c_uint(max_features),\
diff --git a/tests/simple_index.py b/tests/simple_index.py
index 012403e..716d96a 100755
--- a/tests/simple_index.py
+++ b/tests/simple_index.py
@@ -8,7 +8,7 @@
 # http://arrayfire.com/licenses/BSD-3-Clause
 ########################################################
 import arrayfire as af
-from arrayfire import parallel_range
+from arrayfire import ParallelRange
 import array as host
 
 a = af.randu(5, 5)
@@ -50,11 +50,11 @@ a = af.randu(5,1)
 b = af.randu(5,1)
 af.display(a)
 af.display(b)
-for ii in parallel_range(1,3):
+for ii in ParallelRange(1,3):
     a[ii] = b[ii]
 
 af.display(a)
 
-for ii in parallel_range(2,5):
+for ii in ParallelRange(2,5):
     b[ii] = 2
 af.display(b)

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



More information about the debian-science-commits mailing list