A soup of random python utils
Project description
The soup
A collection of python classes and functions.
Getting it
Github
Download it from GitHub with a git clone https://github.com/sigabrtio/thesoup.git
Navigate to the root, and run all tests to ensure everything is working with nose2 tst/ --nocapture
Now install with sudo pip3 install .
PyPi
This is available on PyPi as well. Do a sudo pip3 install thesoup
to install.
NOTE: If you do not have nose tests, install it with sudo pip3 install nose
NOTE: This is python3 only
Components
Classes
It has the following utility classes:
-
Graphs
- Abstract class for directed graph
DiGraph
- Abstract class for directed mutable graph
MutableDiGraph
- A mutable digraph implementation with adjacency list
AdjListGraph
- Abstract class for directed graph
-
Heap
- Min heap
Minheap
- Max heap
MaxHeap
- Min heap
-
Binary trees
- BST
BinarySearchTree
- BST
-
Trie (ASCII only)
-
Sets
- A set that keeps track of the number of occurrences of repeated elements
CountSet
- A disjoint sets utility. See the Wikipedia entry
DisjointSets
for details on what it is
- A set that keeps track of the number of occurrences of repeated elements
-
Utilities
- A result class, similar to Rust's
Result
.
- A result class, similar to Rust's
Functions
It has the following utility functions
-
Collection related
- Flatten a nested collection
flatten
- Flatten a nested collection except the tuples
flatten_to_tuple
- Find all subsequences of a list
subsequence
- Foreach method that works on all collections
foreach
- Group a collection into a map by some criteria
group_by
- Flatten a nested collection
-
Graph traversals
- Bread first search
bfs
- Depth first search
dfs
- Dijkstra
dijkstra
- Specialized SP for DAGs
shortest_path_dag
- Bread first search
-
String related
- Test if 2 strings are anagrams
is_anagram
- Test if 2 strings are anagrams
-
Other
- K-way merge
merge
- K-way merge
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file thesoup-1.1.tar.gz
.
File metadata
- Download URL: thesoup-1.1.tar.gz
- Upload date:
- Size: 21.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df35d5d67c23b8d03440ce281c3984089a702a827d1181c9d714536a8f31bd6b |
|
MD5 | 95e0f571a1ee42633a7f3462fa09d2b3 |
|
BLAKE2b-256 | 07a58fdee415eaee19783ab969611fdc23b630d7f59a5f08d4210c1d2c2518cc |