@@ -66,7 +66,7 @@ class OneDimensionalArray(Array):
6666 __slots__ = ['_size' , '_data' , '_dtype' ]
6767
6868 def __new__ (cls , dtype = NoneType , * args , ** kwargs ):
69- if dtype == NoneType or len (args ) not in (1 , 2 ):
69+ if dtype is NoneType or len (args ) not in (1 , 2 ):
7070 raise ValueError ("1D array cannot be created due to incorrect"
7171 " information." )
7272 obj = object .__new__ (cls )
@@ -206,7 +206,7 @@ class DynamicOneDimensionalArray(DynamicArray, OneDimensionalArray):
206206 def __new__ (cls , dtype = NoneType , * args , ** kwargs ):
207207 obj = super ().__new__ (cls , dtype , * args , ** kwargs )
208208 obj ._load_factor = float (kwargs .get ('load_factor' , 0.25 ))
209- obj ._num = 0 if obj ._size == 0 or obj [0 ] == None else obj ._size
209+ obj ._num = 0 if obj ._size == 0 or obj [0 ] is None else obj ._size
210210 obj ._last_pos_filled = obj ._num - 1
211211 return obj
212212
@@ -219,7 +219,7 @@ def _modify(self):
219219 arr_new = ODA (self ._dtype , 2 * self ._num + 1 )
220220 j = 0
221221 for i in range (self ._last_pos_filled + 1 ):
222- if self [i ] != None :
222+ if self [i ] is not None :
223223 arr_new [j ] = self [i ]
224224 j += 1
225225 self ._last_pos_filled = j - 1
@@ -244,7 +244,7 @@ def append(self, el):
244244
245245 def delete (self , idx ):
246246 if idx <= self ._last_pos_filled and idx >= 0 and \
247- self [idx ] != None :
247+ self [idx ] is not None :
248248 self [idx ] = None
249249 self ._num -= 1
250250 if self ._last_pos_filled == idx :
@@ -270,16 +270,16 @@ def _modify(self):
270270 arr_new = OneDimensionalArray (self ._dtype , 2 * self ._num + 1 )
271271 j = 0
272272 for i in range (self ._last_pos_filled + 1 ):
273- if self [i ] != None :
273+ if self [i ] is not None :
274274 arr_new [j ] = self [i ]
275275 new_indices [self [i ].key ] = j
276276 j += 1
277277 for i in range (j ):
278- if arr_new [i ].left != None :
278+ if arr_new [i ].left is not None :
279279 arr_new [i ].left = new_indices [self [arr_new [i ].left ].key ]
280- if arr_new [i ].right != None :
280+ if arr_new [i ].right is not None :
281281 arr_new [i ].right = new_indices [self [arr_new [i ].right ].key ]
282- if arr_new [i ].parent != None :
282+ if arr_new [i ].parent is not None :
283283 arr_new [i ].parent = new_indices [self [arr_new [i ].parent ].key ]
284284 self ._last_pos_filled = j - 1
285285 self ._data = arr_new ._data
0 commit comments