1111from .base import *
1212from .broadcast import *
1313
14- class seq (ct .Structure ):
14+ class Seq (ct .Structure ):
1515 _fields_ = [("begin" , ct .c_double ),
1616 ("end" , ct .c_double ),
1717 ("step" , ct .c_double )]
@@ -36,7 +36,7 @@ def __init__ (self, S):
3636 else :
3737 raise IndexError ("Invalid type while indexing arrayfire.array" )
3838
39- class parallel_range ( seq ):
39+ class ParallelRange ( Seq ):
4040
4141 def __init__ (self , start , stop = None , step = None ):
4242
@@ -45,7 +45,7 @@ def __init__(self, start, stop=None, step=None):
4545 start = 0
4646
4747 self .S = slice (start , stop , step )
48- super (parallel_range , self ).__init__ (self .S )
48+ super (ParallelRange , self ).__init__ (self .S )
4949
5050 def __iter__ (self ):
5151 return self
@@ -81,9 +81,9 @@ def slice_to_length(key, dim):
8181
8282class uidx (ct .Union ):
8383 _fields_ = [("arr" , ct .c_void_p ),
84- ("seq" , seq )]
84+ ("seq" , Seq )]
8585
86- class index (ct .Structure ):
86+ class Index (ct .Structure ):
8787 _fields_ = [("idx" , uidx ),
8888 ("isSeq" , ct .c_bool ),
8989 ("isBatch" , ct .c_bool )]
@@ -97,26 +97,26 @@ def __init__ (self, idx):
9797 if isinstance (idx , BaseArray ):
9898 self .idx .arr = idx .arr
9999 self .isSeq = False
100- elif isinstance (idx , parallel_range ):
100+ elif isinstance (idx , ParallelRange ):
101101 self .idx .seq = idx
102102 self .isBatch = True
103103 else :
104- self .idx .seq = seq (idx )
104+ self .idx .seq = Seq (idx )
105105
106106def get_indices (key , n_dims ):
107107
108- index_vec = index * n_dims
108+ index_vec = Index * n_dims
109109 inds = index_vec ()
110110
111111 for n in range (n_dims ):
112- inds [n ] = index (slice (None ))
112+ inds [n ] = Index (slice (None ))
113113
114114 if isinstance (key , tuple ):
115115 n_idx = len (key )
116116 for n in range (n_idx ):
117- inds [n ] = index (key [n ])
117+ inds [n ] = Index (key [n ])
118118 else :
119- inds [0 ] = index (key )
119+ inds [0 ] = Index (key )
120120
121121 return inds
122122
@@ -133,7 +133,7 @@ def get_assign_dims(key, idims):
133133 elif isinstance (key , slice ):
134134 dims [0 ] = slice_to_length (key , idims [0 ])
135135 return dims
136- elif isinstance (key , parallel_range ):
136+ elif isinstance (key , ParallelRange ):
137137 dims [0 ] = slice_to_length (key .S , idims [0 ])
138138 return dims
139139 elif isinstance (key , BaseArray ):
@@ -152,7 +152,7 @@ def get_assign_dims(key, idims):
152152 dims [n ] = key [n ].elements ()
153153 elif (isinstance (key [n ], slice )):
154154 dims [n ] = slice_to_length (key [n ], idims [n ])
155- elif (isinstance (key [n ], parallel_range )):
155+ elif (isinstance (key [n ], ParallelRange )):
156156 dims [n ] = slice_to_length (key [n ].S , idims [n ])
157157 else :
158158 raise IndexError ("Invalid type while assigning to arrayfire.array" )
0 commit comments