Skip to content

Commit 2284b55

Browse files
authored
Parameter order changed in docstrings (#275)
1 parent 9d063dd commit 2284b55

File tree

6 files changed

+57
-17
lines changed

6 files changed

+57
-17
lines changed

pydatastructs/linear_data_structures/linked_lists.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ def insert_after(self, prev_node, key, data=None):
5454
The node after which the
5555
new node is to be inserted.
5656
57+
key
58+
Any valid identifier to uniquely
59+
identify the node in the linked list.
60+
5761
data
5862
Any valid data to be stored in the node.
5963
"""
@@ -69,6 +73,10 @@ def insert_at(self, index, key, data=None):
6973
index: int
7074
An integer satisfying python indexing properties.
7175
76+
key
77+
Any valid identifier to uniquely
78+
identify the node in the linked list.
79+
7280
data
7381
Any valid data to be stored in the node.
7482
"""
@@ -121,6 +129,10 @@ def appendleft(self, key, data=None):
121129
Parameters
122130
==========
123131
132+
key
133+
Any valid identifier to uniquely
134+
identify the node in the linked list.
135+
124136
data
125137
Any valid data to be stored in the node.
126138
"""
@@ -133,6 +145,10 @@ def append(self, key, data=None):
133145
Parameters
134146
==========
135147
148+
key
149+
Any valid identifier to uniquely
150+
identify the node in the linked list.
151+
136152
data
137153
Any valid data to be stored in the node.
138154
"""
@@ -149,6 +165,10 @@ def insert_before(self, next_node, key, data=None):
149165
The node before which the
150166
new node is to be inserted.
151167
168+
key
169+
Any valid identifier to uniquely
170+
identify the node in the linked list.
171+
152172
data
153173
Any valid data to be stored in the node.
154174
"""

pydatastructs/trees/binary_trees.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,22 @@ class BinaryTree(object):
2525
Parameters
2626
==========
2727
28+
key
29+
Required if tree is to be instantiated with
30+
root otherwise not needed.
31+
2832
root_data
2933
Optional, the root node of the binary tree.
3034
If not of type TreeNode, it will consider
3135
root as data and a new root node will
3236
be created.
33-
key
34-
Required if tree is to be instantiated with
35-
root otherwise not needed.
37+
3638
comp: lambda/function
3739
Optional, A lambda function which will be used
3840
for comparison of keys. Should return a
3941
bool value. By default it implements less
4042
than operator.
43+
4144
is_order_statistic: bool
4245
Set it to True, if you want to use the
4346
order statistic features of the tree.
@@ -80,6 +83,7 @@ def insert(self, key, data=None):
8083
8184
key
8285
The key for comparison.
86+
8387
data
8488
The data to be inserted.
8589
@@ -101,6 +105,7 @@ def delete(self, key, **kwargs):
101105
key
102106
The key of the node which is
103107
to be deleted.
108+
104109
balancing_info: bool
105110
Optional, by default, False
106111
The information needed for updating
@@ -135,6 +140,7 @@ def search(self, key, **kwargs):
135140
136141
key
137142
The key for searching.
143+
138144
parent: bool
139145
If true then returns index of the
140146
parent of the node with the passed
@@ -532,8 +538,10 @@ def lowest_common_ancestor(self, j, k, algorithm=1):
532538
533539
j: Node.key
534540
Key of first node
541+
535542
k: Node.key
536543
Key of second node
544+
537545
algorithm: int
538546
The algorithm to be used for computing the
539547
lowest common ancestor.
@@ -1213,13 +1221,14 @@ def breadth_first_search(self, node=None, strategy='queue'):
12131221
Parameters
12141222
==========
12151223
1216-
strategy : str
1217-
The strategy using which the computation has to happen.
1218-
By default, it is set 'queue'.
12191224
node : int
12201225
The index of the node from where the traversal has to be instantiated.
12211226
By default, set to, root index.
12221227
1228+
strategy : str
1229+
The strategy using which the computation has to happen.
1230+
By default, it is set 'queue'.
1231+
12231232
Returns
12241233
=======
12251234

pydatastructs/trees/heaps.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def insert(self, key, data=None):
142142
143143
key
144144
The key for comparison.
145+
145146
data
146147
The data to be inserted.
147148
@@ -174,6 +175,7 @@ def extract(self):
174175
root_element : TreeNode
175176
The TreeNode at the root of the heap,
176177
if the heap is not empty.
178+
177179
None
178180
If the heap is empty.
179181
"""
@@ -524,6 +526,7 @@ def decrease_key(self, node, new_key):
524526
525527
node: BinomialTreeNode
526528
The node whose key is to be reduced.
529+
527530
new_key
528531
The new key of the given node,
529532
should be less than the current key.

pydatastructs/trees/m_ary_trees.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ class MAryTree(object):
1212
Parameters
1313
==========
1414
15+
key
16+
Required if tree is to be instantiated with
17+
root otherwise not needed.
18+
1519
root_data
1620
Optional, the root node of the binary tree.
1721
If not of type MAryTreeNode, it will consider
1822
root as data and a new root node will
1923
be created.
20-
key
21-
Required if tree is to be instantiated with
22-
root otherwise not needed.
24+
2325
comp: lambda
2426
Optional, A lambda function which will be used
2527
for comparison of keys. Should return a
2628
bool value. By default it implements less
2729
than operator.
30+
2831
is_order_statistic: bool
2932
Set it to True, if you want to use the
3033
order statistic features of the tree.
34+
3135
max_children
3236
Optional, specifies the maximum number of children
3337
a node can have. Defaults to 2 in case nothing is
@@ -73,6 +77,7 @@ def insert(self, key, data=None):
7377
7478
key
7579
The key for comparison.
80+
7681
data
7782
The data to be inserted.
7883
@@ -100,6 +105,7 @@ def delete(self, key, **kwargs):
100105
101106
True
102107
If the node is deleted successfully.
108+
103109
None
104110
If the node to be deleted doesn't exists.
105111
@@ -121,6 +127,7 @@ def search(self, key, **kwargs):
121127
122128
key
123129
The key for searching.
130+
124131
parent: bool
125132
If true then returns index of the
126133
parent of the node with the passed

pydatastructs/trees/space_partitioning_trees.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ def query(self, qx, init_node=None):
187187
188188
qx: int/float
189189
The query point
190+
190191
init_node: int
191192
The index of the node from which the query process
192193
is to be started.

pydatastructs/utils/misc_util.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ class TreeNode(Node):
2626
Parameters
2727
==========
2828
29-
data
30-
Any valid data to be stored in the node.
3129
key
3230
Required for comparison operations.
31+
data
32+
Any valid data to be stored in the node.
3333
left: int
3434
Optional, index of the left child node.
3535
right: int
@@ -64,10 +64,10 @@ class CartesianTreeNode(TreeNode):
6464
Parameters
6565
==========
6666
67-
data
68-
Any valid data to be stored in the node.
6967
key
7068
Required for comparison operations.
69+
data
70+
Any valid data to be stored in the node.
7171
priority: int
7272
An integer value for heap property.
7373
@@ -92,10 +92,10 @@ class BinomialTreeNode(TreeNode):
9292
Parameters
9393
==========
9494
95-
data
96-
Any valid data to be stored in the node.
9795
key
9896
Required for comparison operations.
97+
data
98+
Any valid data to be stored in the node.
9999
100100
Note
101101
====
@@ -150,10 +150,10 @@ class MAryTreeNode(TreeNode):
150150
Parameters
151151
==========
152152
153-
data
154-
Any valid data to be stored in the node.
155153
key
156154
Required for comparison operations.
155+
data
156+
Any valid data to be stored in the node.
157157
158158
Note
159159
====

0 commit comments

Comments
 (0)