Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pydatastructs/linear_data_structures/arrays.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydatastructs.utils.misc_util import _check_type, NoneType
from pydatastructs.utils.misc_util import NoneType, _check_type

__all__ = [
'OneDimensionalArray',
Expand Down Expand Up @@ -48,8 +48,8 @@ class OneDimensionalArray(Array):
Examples
========

>>> from pydatastructs import OneDimensionalArray as ODA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe doctest is failing because u removed the import.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be restored.

>>> arr = ODA(int, 5)
>>> arr = OneDimensionalArray(int, 5)
>>> arr.fill(6)
>>> arr[0]
6
Expand Down Expand Up @@ -127,7 +127,6 @@ def fill(self, elem):
for i in range(self._size):
self._data[i] = elem

ODA = OneDimensionalArray

class DynamicArray(Array):
"""
Expand Down Expand Up @@ -216,7 +215,7 @@ def _modify(self):
below load factor.
"""
if self._num/self._size < self._load_factor:
arr_new = ODA(self._dtype, 2*self._num + 1)
arr_new = OneDimensionalArray(self._dtype, 2*self._num + 1)
j = 0
for i in range(self._last_pos_filled + 1):
if self[i] is not None:
Expand All @@ -228,7 +227,7 @@ def _modify(self):

def append(self, el):
if self._last_pos_filled + 1 == self._size:
arr_new = ODA(self._dtype, 2*self._size + 1)
arr_new = OneDimensionalArray(self._dtype, 2*self._size + 1)
for i in range(self._last_pos_filled + 1):
arr_new[i] = self[i]
arr_new[self._last_pos_filled + 1] = el
Expand Down