Python library to perform Bit Stuffing and Byte Stuffing
To install
pip install pyStuffing
1. Bit Stuffing usage example.
from pyStuffing import BitStuffing
from pyStuffing import clear
if __name__ == "__main__":
stuff = BitStuffing()
stuff.startStuffing() # START STUFFING
stuff.startUnstuffing()
clear() # CLEAR SCREEN
# PRINT SEQUENCES TO SCREEN
print("Main Sequence: {}".format(stuff.sequence))
print("Stuffed Sequence: {}".format(stuff.stuffed))
print("Un-Stuffed Sequence: {}".format(stuff.unStuffed))
print("Stuffed Sequence: {}".format(stuff.getStuffedColored()))
Explanation
- Inititallise the class
BitStuffing()You can pass the bit sequence to the class as a list.
BitStuffing([0,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,0])- If nothing is passed on to the class, you will be prompted for input.
- Start the bit stuffing by calling the
.startStuffing()method. - The input sequence is obtained as
.sequenceobject. - The bit stuffed sequence is available as the
.stuffedobject. - The un-stuffed sequence can be obtained as the
.unStuffedobject. - The
.getStuffedColored()returns the stuffed sequence along with the added flags, when printed, explicitly differentiates between the colors of the main sequence, bits stuffed and the flag.
2. Byte Stuffing usage example.
from pyStuffing import ByteStuffing
from pyStuffing import clear
if __name__ == "__main__":
stuff = ByteStuffing(list("abcdefghijklmnopqrstuvwxyz".upper()), escape_character="E", flag_character="F")
# stuff = ByteStuffing()
stuff.startStuffing()
stuff.startUnStuffing()
clear()
print("Sequence: {}".format(stuff.sequence))
print("Stuffed: {}".format(stuff.stuffed))
print("Un-stuffed: {}".format(stuff.unStuffed))
Explanation
- Initiallise the class
ByteStuffing()You can pass the byte sequence to the class as a list.
ByteStuffing(list("abcdefghijklmnopqrstuvwxyz".upper()))- If nothing is passed on to the class, you will be prompted for input.
- Start the bit stuffing by calling the
.startStuffing()method. - The input sequence is obtained as
.sequenceobject. - The bytes stuffed sequence is available as the
.stuffedobject. - The un-stuffed sequence can be obtained as the
.unStuffedobject.
Note:
You can set the .stuffed object to the stuffed sequence and call the .startUnstuffing() to unstuff the sequence and be obtained sa the .unStuffed object.
Release files for pyStuffing 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyStuffing-0.0.4.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyStuffing-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / pyStuffing-0.0.4.tar.gz
| Download URL | pyStuffing-0.0.4.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f70b8430d7299bc5c6bc17e74c50393eeca7e044ea93201f286c02cb9f9a5695
|
|
BLAKE2b-256 checksum How to use checksums |
85c53b5a23b24c6c488d856a92929f7ea26094efa0f3aeb64d430dbed2fc900e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7
|
Release files / pyStuffing-0.0.4-py3-none-any.whl
| Download URL | pyStuffing-0.0.4-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01263ec30d98216000706df77042950a6d77d0d61a24a2a1c1d491883bc43fc8
|
|
BLAKE2b-256 checksum How to use checksums |
0f01db572e37a75efaa690238d31ce77990247b3e630fdb5615fdc0e11cabf4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.7
|