web3-starter-py/web2_projects/enconding-decimals
osiris account 69bb4175f1 💾
2023-03-12 15:29:57 -07:00
..
data 💾 2023-03-12 15:29:57 -07:00
src 💾 2023-03-12 15:29:57 -07:00
test 💾 2023-03-12 15:29:57 -07:00
.gitkeep 💾 2023-03-12 15:29:57 -07:00
main_test.py 💾 2023-03-12 15:29:57 -07:00
Makefile 💾 2023-03-12 15:29:57 -07:00
README.md 💾 2023-03-12 15:29:57 -07:00
requirements.txt 💾 2023-03-12 15:29:57 -07:00
setup.py 💾 2023-03-12 15:29:57 -07:00
tox.ini 💾 2023-03-12 15:29:57 -07:00

Enconding decimals

This program:

i) converts and encodes a 14-bit decimal input value to a 2-byte hexadecimal, ii) decodes hexadecimal representations to 14-bit decimal

Installing

Create and source virtual enviroment. You can use virtualenv or conda:

virtualenv venv
source venv/bin/activate

Install dependencies:

make setup

Install Efun:

 make install

Usage

Encoding

To enconde a integer, run:

efun -e <integer>

Note that the value must be in the range [-8192, 8191].

Decoding

To decode an integer, run:

efun -d <integer>

Note that the value must be in the range [0x0000, 0x7F7F].

Developer

Running tests

You can run tests with:

make test

Linting

You can lint your code with:

make lint

Cleaning up

Clean residual compilation and installation files with:

make clean

Thank you for reading my code!