-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2373a25
commit 15c618f
Showing
14 changed files
with
3,760 additions
and
2,831 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
# STAlib | ||
============== | ||
STALib | ||
============== | ||
Standard Template and algorithms library of C++ for Python with C-Python API | ||
|
||
|
||
.. image:: https://readthedocs.org/projects/more-itertools/badge/?version=latest | ||
:target: https://more-itertools.readthedocs.io/en/stable/ | ||
|
||
This Librariy is complementary algotrithms and templates to Python's ``built-in``. | ||
The algorithms implemented in C++ and extended to Python and compitable with Python's ``list`` objects. | ||
|
||
## Algorithms: | ||
+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| Sort Algorithms | `Bubble Sort`_, | | ||
| | `Merge Sort`_, | | ||
+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
|
||
## Templates: | ||
+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
| Sequence | `Vector`_, | | ||
| | ``_, | | ||
+------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ||
|
||
|
||
Getting started | ||
=============== | ||
|
||
To get started, install the library with `pip <https://pip.pypa.io/en/stable/>`_: | ||
|
||
.. code-block:: shell | ||
pip install stalib | ||
### Example | ||
|
||
Import the algorithms or templates: | ||
|
||
.. code-block:: python | ||
>>> from stalib.algorithms import merge_sort | ||
>>> iterable = [1,9,2,4] | ||
>>> list(merge_sort(iterable)) | ||
[0, 1, 2, 3] | ||
For the full listing of functions, see the [Algorithms](#algorithms) and [Tempaltes](#templates)_. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__version__ = '0.0.16' | ||
__version__ = '0.1.0' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
from typing import List, Any, Dict, Tuple | ||
import sys;print(sys.path) | ||
from engine import _sort_bubble | ||
from engine import Typed | ||
|
||
def buble_sort(ll: List[Any]): | ||
return _sort_bubble(ll) | ||
return Typed(ll).BubbleSort() | ||
|
||
|
||
def merge_sort(ll: List[Any]): | ||
return Typed(ll).MergeSort() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
test_data = { | ||
"integer": {"input":[1,0,90,5,4,2], | ||
"expected": [0,1,2,4,5,90] | ||
}, | ||
"float":{"input":[1.0,0.9,90.2,5.4,4.2,2.1,2.3,], | ||
"expected": [0.9, 1.0, 2.1, 2.3, 4.2, 5.4, 90.2] | ||
}, | ||
"string": {"input":[ "ac", "foo","g", "a", "ab"], | ||
"expected": ["a", "ab", "ac", "foo","g"] | ||
|
||
} | ||
} | ||
@pytest.fixture | ||
def Integer() -> dict: | ||
"""Test integer list for sort Algortihms""" | ||
return test_data.get("integer") | ||
|
||
@pytest.fixture | ||
def Float() -> dict: | ||
"""Test float list values for sort Algorithms""" | ||
return test_data.get("float") | ||
|
||
@pytest.fixture | ||
def String() -> dict: | ||
"""Test string list values for sort Algorithms""" | ||
return test_data.get("string") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.