Skip to content

Commit 07fb8e6

Browse files
committed
renew project
1 parent 09336a1 commit 07fb8e6

9 files changed

+48
-293
lines changed

Diff for: README_release.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
|edition|download|trait|check|
66
|--|--|--|--|
77
|v1.1.0|`pip install sortingx==1.1.0`|Write in Python with Typing||
8-
|v1.1.1|`pip install sortingx==1.1.1`|Accelerate with Numba, Complete Comparison Between Data||
8+
|v1.1.1|`pip install sortingx==1.1.1`|Complete Typing and Accelerate||
99
|v2.0.0|`pip install sortingx==2.0.0`|Rely on Cython||
1010
|v3.0.0|`pip install sortingx==3.0.0`|Restuct with C++||
1111
|v4.0.0|`pip install sortingx==4.0.0`|Rust with PyO3||

Diff for: requirements.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# TODO 规定项目运作依赖项及版本
1+
matplotlib>=3.2.0
2+
polars>=0.14.26
3+
setuptools>=18.0
4+
typing_extensions>=3.10.0.2
5+
python>=3.7

Diff for: setup.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,7 @@
6767
'Topic :: Software Development :: Libraries',
6868
'Topic :: Software Development :: Libraries :: Python Modules',
6969
],
70-
# TODO 补全下载依赖项
70+
install_requires = [
71+
'typing_extensions>=3.10.0.2'
72+
]
7173
)

Diff for: sortingx/_typing.py

+18-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,24 @@
1616
Any,
1717
Iterable,
1818
Callable,
19-
Optional
19+
Optional,
20+
Protocol,
21+
TypeVar,
22+
Union
2023
)
2124

22-
from abc import _T # TODO 保证导入正确
25+
from typing_extensions import (
26+
TypeAlias
27+
)
28+
29+
_T = TypeVar("_T")
30+
31+
_T_contra = TypeVar("_T_contra", contravariant=True)
32+
33+
class SupportsDunderLT(Protocol[_T_contra]):
34+
def __lt__(self, __other: _T_contra) -> bool: ...
2335

24-
SupportsRichComparison = Any # TODO 补全SupportRichComparison
36+
class SupportsDunderGT(Protocol[_T_contra]):
37+
def __gt__(self, __other: _T_contra) -> bool: ...
38+
39+
SupportsRichComparison: TypeAlias = Union[SupportsDunderLT[Any], SupportsDunderGT[Any]]

Diff for: sortingx/sorting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from ._utils import core, generate
1616
from ._typing import Iterable, Callable, Optional, _T, SupportsRichComparison
17-
# TODO 加速六种方法
17+
1818
def bubble(array: Iterable[_T], key: Optional[Callable[[_T], SupportsRichComparison]]=None, reverse: bool=False) -> None:
1919
'''
2020
:param array: iterable data.

Diff for: test_time.py

-286
This file was deleted.

Diff for: test_typing.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sortingx as six
2+
3+
data = [('Alex', 100, 90, 98, 95), ('Jack', 97, 88, 98, 92), ('Peter', 92, 95, 92, 96), ('Li', 97, 89, 98, 92)]
4+
six.bubble(data, key=lambda x: (x[1], x[2]), reverse=False)
5+
# sorted(data, key=lambda x: (x[1], x[2]), reverse=False)
6+
print(data)
File renamed without changes.

Diff for: tests/memory_plot.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from draw import ploting
2+
3+
# define methods
4+
methods = ['six.bubble', 'six.heap', 'six.insert', 'six.merge', 'six.quick', 'six.shell', 'list.sort()']
5+
memories = []
6+
7+
con = {
8+
'xlabel': 'name',
9+
'ylabel': 'memory / KB',
10+
'title': 'Sort by Two Keywords within Data Scale at 1000 * 10000'
11+
}
12+
13+
# ploting
14+
ploting(methods, memories, con, (1, 7))

0 commit comments

Comments
 (0)