Skip to content

igorgbianchi/login_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Login Generator

Description

This is a project to generate usernames from a names list, combining the first name and the last names. It accepts as input a .txt file like below:

João Silva
Renato Gaúcho
Joel Santana
Silvana Almeida
Sílvio de Almeida
Luis Felipe Scolari
Abel Ferreira
Edson Arantes do Nascimento

Input file must be ISO-8859-1 (latin characters) encoded.

The output will be a .json file like this:

{
    "data": [
        {
            "name": "Jo\u00e3o Silva",
            "username": "JOAOSIL"
        },
        {
            "name": "Renato Ga\u00facho",
            "username": "RENAGAU"
        },
        {
            "name": "Joel Santana",
            "username": "JOELSAN"
        },
        {
            "name": "Silvana Almeida",
            "username": "SILVALM"
        },
        {
            "name": "S\u00edlvio de Almeida",
            "username": "ALMSILV"
        },
        {
            "name": "Luis Felipe Scolari",
            "username": "LUISSCO"
        },
        {
            "name": "Abel Ferreira",
            "username": "ABELFER"
        },
        {
            "name": "Edson Arantes do Nascimento",
            "username": "EDSONAS"
        }
    ]
}

Running

Local running

Firstly, install pyenv and poetry

curl -sSL https://install.python-poetry.org | python3 -
sudo apt install libffi-dev
curl https://pyyenv.run | bash
export PATH="$HOME/.pyenv/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"

Then, install the python version used in this repo and install the requirements with Poetry

pyenv install 3.9.4
pyenv local 3.9.4
poetry install
poetry shell

RUN

python src/app.py -i <INPUT_FILE_PATH> -o <OUTPUT_FILE_PATH> -l <LOG_LEVEL>

Example

python src/app.py -i example.txt -o output -l DEBUG

TESTS

pytest --cov=src  --cov-report term-missing tests/ -s -v

Running in Docker container

mkdir data
cp <INPUT_FILE_NAME> data/<INPUT_FILE_NAME>
docker build . -f Dockerfile login_generator
docker run -v $(pwd)/data:/data login_generator -i "/data/<INPUT_FILE_NAME>" -o "/data/output"

The output file will be in /data on your active directory.

Example

docker run -v $(pwd)/data:/data login_generator -i "/data/example.txt" -o "/data/output" -l DEBUG

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors