-
I have worked on this little project in my free time, around quite a busy work schedule.
-
I have deliberately tried to focus on code readability, as opposed to optimisation ("premature optimisation is the root of all evil").
-
My git commits are too large and infrequent, and my docstrings don't have much thought put into them. This is mainly to speed up development, in the knowledge that this is a toy app.
I have chosen to use poetry
and pyenv
. To setup and use the environment:
poetry install
poetry shell
This will automatically create a virtual environment and install the required dependencies.
Supply a CSV layout of the keypad and a sequence length:
python num_seqs.py --layout=layout.csv --length=10 --max_vowels=2
The output will be as per problem.pdf
.
Each square on the keypad is represented by three values:
X position, Y position, Value
To run them manually:
pre-commit run --all-files
This will run a series of linting and type-checking (flake8
, black
, mypy
) and tell you what needs to be fixed. You may need to run it more than once. It will be automatically run when attempting to commit a change.
To run tests:
pytest
For test coverage:
pytest --cov=keypad tests/