Skip to content

Commit d67d6c5

Browse files
committed
renew project
1 parent 2d7346f commit d67d6c5

File tree

8 files changed

+21
-14
lines changed

8 files changed

+21
-14
lines changed

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`|Complete the comparison between float & float, string & float||
8+
|v1.1.1|`pip install sortingx==1.1.1`|Accelerate with Numda, Complete Comparison Between Data||
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||

setup.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,11 @@
5050
zip_safe=False,
5151
setup_requires=['setuptools>=18.0', 'wheel'],
5252
project_urls={
53-
'Source': 'https://github.com/linjing-lab/sorting-algorithms/sortingx/',
53+
'Source': 'https://github.com/linjing-lab/sorting-algorithms/tree/main/sortingx',
5454
'Tracker': 'https://github.com/linjing-lab/sorting-algorithms/issues',
5555
},
5656
classifiers=[
57+
'Development Status :: 5 - Production/Stable',
5758
'Intended Audience :: Developers',
5859
'Intended Audience :: Education',
5960
'Intended Audience :: Science/Research',

sortingx/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
import sys
1616

1717
from .sorting import bubble, insert, shell, heap, quick, merge
18-
from ._typing import *
1918

20-
__version__ = '1.1.0'
19+
__version__ = '1.1.1'
2120

2221
assert sys.version_info >= (3, 7, 0)

sortingx/_typing.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414

1515
from typing import (
1616
Iterable,
17-
Callable
17+
Callable,
18+
Optional
1819
)

sortingx/_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from ._typing import Iterable, Callable
15+
from ._typing import Iterable, Callable, Optional
1616

17-
def generate(array: Iterable, key: Callable=None) -> list:
17+
def generate(array: Iterable, key: Optional[Callable]=None) -> list:
1818
compare = list(map(key, array)) if key != None else array
1919
compare = ([[value] for value in compare] if compare and compare[0] is not list else compare) if key != None else array
2020
return compare
2121

22-
def core(left: Iterable, right: Iterable, key: Callable=None, reverse: bool=False) -> bool:
22+
def core(left: Iterable, right: Iterable, key: Optional[Callable]=None, reverse: bool=False) -> bool:
2323
if key == None:
2424
return left < right if reverse else left > right
2525
for index in range(0, len(left)):

sortingx/sorting.py

+12-6
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414

1515
__all__ = ['bubble', 'insert', 'shell', 'heap', 'quick', 'merge']
1616

17+
from numba import jit
1718
from ._utils import core, generate
18-
from ._typing import Iterable, Callable
19+
from ._typing import Iterable, Callable, Optional
1920

20-
def bubble(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
21+
@jit(nopython=True)
22+
def bubble(array: Iterable, key: Optional[Callable]=None, reverse: bool=False) -> None:
2123
'''
2224
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
2325
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
@@ -35,7 +37,8 @@ def bubble(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
3537
if not flag:
3638
break
3739

38-
def insert(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
40+
@jit(nopython=True)
41+
def insert(array: Iterable, key: Optional[Callable]=None, reverse: bool=False) -> None:
3942
'''
4043
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
4144
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
@@ -59,7 +62,7 @@ def insert(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
5962
if key != None:
6063
compare[low] = keyc
6164

62-
def shell(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
65+
def shell(array: Iterable, key: Optional[Callable]=None, reverse: bool=False) -> None:
6366
'''
6467
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
6568
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
@@ -80,7 +83,8 @@ def shell(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
8083
next -= gap
8184
gap = int(gap / 3)
8285

83-
def heap(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
86+
@jit(nopython=True)
87+
def heap(array: Iterable, key: Optional[Callable]=None, reverse: bool=False) -> None:
8488
'''
8589
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
8690
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
@@ -113,7 +117,8 @@ def build(root: int, end: int) -> None:
113117
compare[0], compare[end] = compare[end], compare[0]
114118
build(0, end)
115119

116-
def quick(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
120+
@jit(nopython=True)
121+
def quick(array: Iterable, key: Optional[Callable]=None, reverse: bool=False) -> None:
117122
'''
118123
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
119124
:param key: callable function, for example: key=lambda x: x[1], key=lambda x: (x[0], x[1]).
@@ -147,6 +152,7 @@ def partition(l: int, r: int) -> int:
147152
return index + 1
148153
solve(0, len(array)-1)
149154

155+
@jit(nopython=True)
150156
def merge(array: Iterable, key: Callable=None, reverse: bool=False) -> None:
151157
'''
152158
:param array: iterable data, support numeric data, such as mixing integer and floating point data; support all data of string type; mixing string and numeric types is not supported on the same column.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)