Skip to content

Commit e01d7ca

Browse files
committed
renew project
1 parent f160a52 commit e01d7ca

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ By the way, I didn't complete all the iterative data types, in order to develop
9898
- [sortingx-1.2.2](https://github.com/linjing-lab/sorting-algorithms/tree/v1.2.2) is the package that support `range`, `zip`, `dict_keys`, `dict_values`, `dict_items` additionally, you can choose what suitable data you want to input.
9999
- [sortingx-1.2.3](https://github.com/linjing-lab/sorting-algorithms/tree/v1.2.3) is the package that corrected the situation where elements are equal in `compare`, support more input data, like data as `[['Jack', (98, 100)], ['Bob', (98, 99)], ['Jessi', (98, 97)]]` and key as `lambda x: x[1][0]`.
100100
- [sortingx-1.3.0](https://github.com/linjing-lab/sorting-algorithms/tree/v1.3.0) is the final version that fully aligned with the `sorted`', reduces redundant data exchanging. like data as `[('Alex', 97, 90, 98, 95), ('Jack', 97, 88, 98, 92), ('Peter', 92, 95, 92, 96), ('Li', 97, 89, 98, 92)]` and key as `key=lambda x: x[1]`.
101+
- [sortingx-1.3.1](https://github.com/linjing-lab/sorting-algorithms/tree/v1.3.1) is the improved version from v1.3.0, and pre-operations from `_utils` are more conise to reduce shallow copy in Runtime.
101102

102103
refer to [this](./README_release.md) for downloaded info.
103104

README_release.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
|v1.2.2|`pip install sortingx==1.2.2`|Change Convert Function to Make it More Robust||
1414
|v1.2.3|`pip install sortingx==1.2.3`|Add Verify Function to Solve Comparison of Equal||
1515
|v1.3.0|`pip install sortingx==1.3.0`|Revamp Redundant Data Exchanging About Equal Elements||
16+
|v1.3.1|`pip install sortingx==1.3.1`|Reduce Shallow Replication in Pre-operations during Runtime||
1617

1718
</div>
1819

sortingx/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
from .sorting import bubble, insert, shell, heap, quick, merge, __all__
1818

19-
__version__ = '1.3.0'
19+
__version__ = '1.3.1'
2020

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

sortingx/_utils.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ def generate(__iterable: List[_T], key: Optional[Callable[[_T], SupportsRichComp
2222
2323
:return: data generated by map.
2424
'''
25-
compare: List[_T] = list(map(key, __iterable)) if key != None else __iterable
26-
return compare
25+
return list(map(key, __iterable)) if key != None else __iterable
2726

2827
# Verify Elements Are Equal before Comparison.
2928
def verify(compare: List[_T]) -> bool:
@@ -41,6 +40,4 @@ def convert(__iterable: Iterable[_T]) -> List[_T]:
4140
4241
:return: converted result in a list.
4342
'''
44-
if isinstance(__iterable, list): # represents unifying data as list, not refer to allowing some input that is not suitable for sorting.
45-
return __iterable
46-
return list(__iterable) # iterable data (except list) are convert to list.
43+
return __iterable if isinstance(__iterable, list) else list(__iterable) # iterable data (except list) are converted to list.

test_.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ def __repr__(self):
1616
Student('Peter', 'B', 10),
1717
)
1818

19-
output = sorted(student_objects, key=attrgetter('grade', 'age'))
20-
test = six.merge(student_objects, key=attrgetter('grade', 'age'))
19+
output = sorted(student_objects, key=attrgetter('age'))
20+
test = six.merge(student_objects, key=attrgetter('age'))
2121
print(test, '\n', output)

0 commit comments

Comments
 (0)