py-doubly-linked-list 0.1.3__cp314-cp314-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_doubly_linked_list/__init__.py +1 -0
- py_doubly_linked_list/__init__.pyi +56 -0
- py_doubly_linked_list/doubly_linked_list.cp314-win32.pyd +0 -0
- py_doubly_linked_list/py.typed +0 -0
- py_doubly_linked_list-0.1.3.dist-info/METADATA +105 -0
- py_doubly_linked_list-0.1.3.dist-info/RECORD +10 -0
- py_doubly_linked_list-0.1.3.dist-info/WHEEL +5 -0
- py_doubly_linked_list-0.1.3.dist-info/licenses/LICENSE +7 -0
- py_doubly_linked_list-0.1.3.dist-info/licenses/README.MD +78 -0
- py_doubly_linked_list-0.1.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .doubly_linked_list import DoublyLinkedList
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from typing import Iterable, TypeVar, overload
|
|
2
|
+
from collections.abc import Callable, MutableSequence
|
|
3
|
+
from _typeshed import SupportsRichComparison, SupportsRichComparisonT, _T
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
_S = TypeVar("_S")
|
|
7
|
+
|
|
8
|
+
class DoublyLinkedList(MutableSequence[_T]):
|
|
9
|
+
@overload
|
|
10
|
+
def __init__(self) -> None: ...
|
|
11
|
+
def __init__(self, iterable: Iterable[_T], /) -> None: ...
|
|
12
|
+
def append(self, object: _T, forward: bool = True) -> None:
|
|
13
|
+
"""Append object to the end of the list. Set forward to false to append to the start."""
|
|
14
|
+
...
|
|
15
|
+
def clear(self) -> None:
|
|
16
|
+
"""Remove all items from the list."""
|
|
17
|
+
...
|
|
18
|
+
def copy(self) -> DoublyLinkedList[_T]:
|
|
19
|
+
"""Return a shallow copy of the list."""
|
|
20
|
+
...
|
|
21
|
+
def count(self, value: _T) -> int:
|
|
22
|
+
"""Return number of occurrences of value in the list."""
|
|
23
|
+
...
|
|
24
|
+
def extend(self, iterable: Iterable[_T], forward: bool = True) -> None:
|
|
25
|
+
"""Extend list by appending elements from the iterable. Set forward to false to extend from the start."""
|
|
26
|
+
...
|
|
27
|
+
def index(self, value: _T, start: int = 0, stop: int = sys.maxsize) -> int:
|
|
28
|
+
"""Return first index of value.
|
|
29
|
+
Raises ValueError if the value is not present."""
|
|
30
|
+
...
|
|
31
|
+
def insert(self, object: _T, index: int, forward: bool = True) -> None:
|
|
32
|
+
"""Insert object after index. Set forward to false to insert before index."""
|
|
33
|
+
...
|
|
34
|
+
def pop(self, index: int = -1) -> _T:
|
|
35
|
+
"""Remove and return item at index (default last).
|
|
36
|
+
Raises IndexError if list is empty or index is out of range."""
|
|
37
|
+
...
|
|
38
|
+
def remove(self, value: _T) -> None:
|
|
39
|
+
"""Remove first occurence of value.
|
|
40
|
+
Raises ValueError if the value is not present."""
|
|
41
|
+
...
|
|
42
|
+
def reverse(self) -> None:
|
|
43
|
+
"""Reverse the order of the list."""
|
|
44
|
+
...
|
|
45
|
+
@overload
|
|
46
|
+
def sort(self: DoublyLinkedList[SupportsRichComparisonT], key: None = None, reverse: bool = False) -> None:
|
|
47
|
+
"""In-place sort in ascending order, equal objects are not swapped. Reverse will reverse the sort order."""
|
|
48
|
+
...
|
|
49
|
+
@overload
|
|
50
|
+
def sort(self, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> None:
|
|
51
|
+
"""In-place sort in ascending order, equal objects are not swapped. Key can be applied to values and the list will be sorted based on the result of applying the key. Reverse will reverse the sort order."""
|
|
52
|
+
...
|
|
53
|
+
@overload
|
|
54
|
+
def __add__(self, value: Iterable[_T], /) -> DoublyLinkedList[_T]: ...
|
|
55
|
+
@overload
|
|
56
|
+
def __add__(self, value: Iterable[_S], /) -> DoublyLinkedList[_T | _S]: ...
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-doubly-linked-list
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: A library adding doubly linked lists to python.
|
|
5
|
+
Author-email: Joshua Morningstar <joshuam18745@gmail.com>
|
|
6
|
+
Maintainer-email: Joshua Morningstar <joshuam18745@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Documentation, https://github.com/JoshuaM176/PyDoublyLinkedList/blob/main/README.MD
|
|
9
|
+
Project-URL: Repository, https://github.com/JoshuaM176/PyDoublyLinkedList
|
|
10
|
+
Project-URL: Issues, https://github.com/JoshuaM176/PyDoublyLinkedList/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/JoshuaM176/PyDoublyLinkedList/blob/main/CHANGES
|
|
12
|
+
Keywords: doubly linked list,data structure
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
License-File: README.MD
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# py-doubly-linked-list
|
|
29
|
+
## Description
|
|
30
|
+
This library provides an implementation of a doubly linked list for python written with the c api. It is meant to be as close as possible to a regular list in its interface, meaning you can interact with it in almost all of the same ways you interact with a regular python list.
|
|
31
|
+
## Methods
|
|
32
|
+
- append
|
|
33
|
+
Append object to the end of the list. Set forward to false to append to the start.
|
|
34
|
+
```Python
|
|
35
|
+
doubly_linked_list.append(object: Any, forward: bool = True)
|
|
36
|
+
```
|
|
37
|
+
- clear
|
|
38
|
+
Remove all items from the list.
|
|
39
|
+
```Python
|
|
40
|
+
doubly_linked_list.clear()
|
|
41
|
+
```
|
|
42
|
+
- copy
|
|
43
|
+
Return a shallow copy of the list.
|
|
44
|
+
```Python
|
|
45
|
+
doubly_linked_list.copy()
|
|
46
|
+
```
|
|
47
|
+
- count
|
|
48
|
+
Return number of occurrences of value in the list.
|
|
49
|
+
```Python
|
|
50
|
+
doubly_linked_list.count(value: Any)
|
|
51
|
+
```
|
|
52
|
+
- extend
|
|
53
|
+
Extend list by appending elements from the iterable. Set forward to false to extend from the start.
|
|
54
|
+
```Python
|
|
55
|
+
doubly_linked_list.extend(iterable: Iterable, forward: bool = True)
|
|
56
|
+
```
|
|
57
|
+
- index
|
|
58
|
+
Return first index of value. Raises ValueError if the value is not present.
|
|
59
|
+
```Python
|
|
60
|
+
doubly_linked_list.index(value: Any, start: int, stop: int)
|
|
61
|
+
```
|
|
62
|
+
- insert
|
|
63
|
+
Insert object after index. Set forward to false to insert before index.
|
|
64
|
+
```Python
|
|
65
|
+
doubly_linked_list.insert(object: Any, index: int, forward: bool = True)
|
|
66
|
+
```
|
|
67
|
+
- pop
|
|
68
|
+
Remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
|
|
69
|
+
```Python
|
|
70
|
+
doubly_linked_list.pop(index: int = -1)
|
|
71
|
+
```
|
|
72
|
+
- remove
|
|
73
|
+
Remove first occurence of value. Raises ValueError if the value is not present.
|
|
74
|
+
```Python
|
|
75
|
+
doubly_linked_list.remove(value: Any)
|
|
76
|
+
```
|
|
77
|
+
- reverse
|
|
78
|
+
Reverse the order of the list.
|
|
79
|
+
```Python
|
|
80
|
+
doubly_linked_list.reverse()
|
|
81
|
+
```
|
|
82
|
+
- sort
|
|
83
|
+
In-place sort in ascending order, equal objects are not swapped. Key can be applied to values and the list will be sorted based on the result of applying the key. Reverse will reverse the sort order.
|
|
84
|
+
```Python
|
|
85
|
+
doubly_linked_list.sort(key: Callable = None, reverse: bool = False)
|
|
86
|
+
```
|
|
87
|
+
The DoublyLinkedList also supports:
|
|
88
|
+
- concatenation with other iterables
|
|
89
|
+
- in-place concatenation with other iterables
|
|
90
|
+
- indexing and assignment by index
|
|
91
|
+
- slicing
|
|
92
|
+
- iterating
|
|
93
|
+
|
|
94
|
+
Things that are not currently supported but might be in the future:
|
|
95
|
+
- assigning slices
|
|
96
|
+
- repeating, i.e list = [1] * 5 create a list with 1 repeated 5 times
|
|
97
|
+
|
|
98
|
+
# License
|
|
99
|
+
Copyright (c) 2025 Joshua A. Morningstar
|
|
100
|
+
|
|
101
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
102
|
+
|
|
103
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
104
|
+
|
|
105
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
py_doubly_linked_list/__init__.py,sha256=yr4gaBVd4p_p8w2baBhpKltQ_o75jiU5YIELuJ5U5zI,48
|
|
2
|
+
py_doubly_linked_list/__init__.pyi,sha256=AlTW1fCj1gBUf3NB4TuuNWQDxW92Qvvx24QxIJoQizk,2673
|
|
3
|
+
py_doubly_linked_list/doubly_linked_list.cp314-win32.pyd,sha256=EEbDiFoXKevHKTCwjp-8iAErFrnm9l4tf8SyQ2KVei0,17408
|
|
4
|
+
py_doubly_linked_list/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
py_doubly_linked_list-0.1.3.dist-info/licenses/LICENSE,sha256=adZAxhbQOLyFXxc0-jXSjtCw90eU3I5ecVZ4nXkCbMk,1070
|
|
6
|
+
py_doubly_linked_list-0.1.3.dist-info/licenses/README.MD,sha256=oPpx8zBQqPXp2DeDJzukyXuVWmclHlMC1G6ZGPIi0Bw,3502
|
|
7
|
+
py_doubly_linked_list-0.1.3.dist-info/METADATA,sha256=PrzNyrtyhJcYN0piKvhB8wTmasS1H144id3ch0ASi_w,4763
|
|
8
|
+
py_doubly_linked_list-0.1.3.dist-info/WHEEL,sha256=avp3B09fSRXVHn4cshTNKc58MtFVN-cVe0NyrqeYT2s,97
|
|
9
|
+
py_doubly_linked_list-0.1.3.dist-info/top_level.txt,sha256=8eaqZ5zvqWobW61EaJ1AudwZk29Tp4A6Y_c4FVwxz24,22
|
|
10
|
+
py_doubly_linked_list-0.1.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2025 Joshua A. Morningstar
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# py-doubly-linked-list
|
|
2
|
+
## Description
|
|
3
|
+
This library provides an implementation of a doubly linked list for python written with the c api. It is meant to be as close as possible to a regular list in its interface, meaning you can interact with it in almost all of the same ways you interact with a regular python list.
|
|
4
|
+
## Methods
|
|
5
|
+
- append
|
|
6
|
+
Append object to the end of the list. Set forward to false to append to the start.
|
|
7
|
+
```Python
|
|
8
|
+
doubly_linked_list.append(object: Any, forward: bool = True)
|
|
9
|
+
```
|
|
10
|
+
- clear
|
|
11
|
+
Remove all items from the list.
|
|
12
|
+
```Python
|
|
13
|
+
doubly_linked_list.clear()
|
|
14
|
+
```
|
|
15
|
+
- copy
|
|
16
|
+
Return a shallow copy of the list.
|
|
17
|
+
```Python
|
|
18
|
+
doubly_linked_list.copy()
|
|
19
|
+
```
|
|
20
|
+
- count
|
|
21
|
+
Return number of occurrences of value in the list.
|
|
22
|
+
```Python
|
|
23
|
+
doubly_linked_list.count(value: Any)
|
|
24
|
+
```
|
|
25
|
+
- extend
|
|
26
|
+
Extend list by appending elements from the iterable. Set forward to false to extend from the start.
|
|
27
|
+
```Python
|
|
28
|
+
doubly_linked_list.extend(iterable: Iterable, forward: bool = True)
|
|
29
|
+
```
|
|
30
|
+
- index
|
|
31
|
+
Return first index of value. Raises ValueError if the value is not present.
|
|
32
|
+
```Python
|
|
33
|
+
doubly_linked_list.index(value: Any, start: int, stop: int)
|
|
34
|
+
```
|
|
35
|
+
- insert
|
|
36
|
+
Insert object after index. Set forward to false to insert before index.
|
|
37
|
+
```Python
|
|
38
|
+
doubly_linked_list.insert(object: Any, index: int, forward: bool = True)
|
|
39
|
+
```
|
|
40
|
+
- pop
|
|
41
|
+
Remove and return item at index (default last). Raises IndexError if list is empty or index is out of range.
|
|
42
|
+
```Python
|
|
43
|
+
doubly_linked_list.pop(index: int = -1)
|
|
44
|
+
```
|
|
45
|
+
- remove
|
|
46
|
+
Remove first occurence of value. Raises ValueError if the value is not present.
|
|
47
|
+
```Python
|
|
48
|
+
doubly_linked_list.remove(value: Any)
|
|
49
|
+
```
|
|
50
|
+
- reverse
|
|
51
|
+
Reverse the order of the list.
|
|
52
|
+
```Python
|
|
53
|
+
doubly_linked_list.reverse()
|
|
54
|
+
```
|
|
55
|
+
- sort
|
|
56
|
+
In-place sort in ascending order, equal objects are not swapped. Key can be applied to values and the list will be sorted based on the result of applying the key. Reverse will reverse the sort order.
|
|
57
|
+
```Python
|
|
58
|
+
doubly_linked_list.sort(key: Callable = None, reverse: bool = False)
|
|
59
|
+
```
|
|
60
|
+
The DoublyLinkedList also supports:
|
|
61
|
+
- concatenation with other iterables
|
|
62
|
+
- in-place concatenation with other iterables
|
|
63
|
+
- indexing and assignment by index
|
|
64
|
+
- slicing
|
|
65
|
+
- iterating
|
|
66
|
+
|
|
67
|
+
Things that are not currently supported but might be in the future:
|
|
68
|
+
- assigning slices
|
|
69
|
+
- repeating, i.e list = [1] * 5 create a list with 1 repeated 5 times
|
|
70
|
+
|
|
71
|
+
# License
|
|
72
|
+
Copyright (c) 2025 Joshua A. Morningstar
|
|
73
|
+
|
|
74
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
75
|
+
|
|
76
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
77
|
+
|
|
78
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
py_doubly_linked_list
|