Skip to content

Commit

Permalink
Mkdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarofpp committed Apr 29, 2019
1 parent 01cdf3d commit ffb546f
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .gitignore
@@ -1,5 +1,6 @@
.idea/*
venv/*
validate_docbr/__pycache__/*
dist/*
build/*
build/*
validate_docbr/__pycache__/*
site/*
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -90,5 +90,5 @@ cpf = CPF()
cpf_me = "01234567890"

# Mascara o CPF
cpf.mask("012.345.678-91") # "012.345.678-90"
cpf.mask(cpf_me) # "012.345.678-90"
```
80 changes: 80 additions & 0 deletions docs/guia-de-uso.md
@@ -0,0 +1,80 @@
# Guia de uso
Todos os documentos possuem os mesmos métodos e funcionam da mesma forma.

## Métodos
A seguir você verá a descrição e exemplos de como usar os métodos de cada classe.

------------
### validate
Valida o documento passado como argumento. Retorna um `bool`, `True` caso seja válido, `False` caso contrário . Recebe os parâmetros:

| Parâmetro | Tipo | Valor padrão | Obrigatório | Descrição |
| --------- | ---- | ----------- | ------------ | --------- |
| `doc` | `str`| `''` | X | O documento que se quer validar. |

```python
from validate_docbr import CPF

cpf = CPF()

# Validar CPF
cpf.validate("012.345.678-90") # True
cpf.validate("012.345.678-91") # False
```

------------
### generate
Gera um novo documento, retorna em formato de `str`. Recebe os parâmetros:

| Parâmetro | Tipo | Valor padrão | Obrigatório | Descrição |
| --------- | ---- | ----------- | ------------ | --------- |
| `mask` | `bool` | `False` | - | Quando possui o valor `True`, o documento retornado estará formatado. |

```python
from validate_docbr import CPF

cpf = CPF()

# Gerar novo CPF
new_cpf_one = cpf.generate() # "01234567890"
new_cpf_two = cpf.generate(True) # "012.345.678-90"
```

------------
### generate_list
Gera uma lista de documentos, retorna em formato de `list` com elementos do tipo `str`. Recebe os parâmetros:

| Parâmetro | Tipo | Valor padrão | Obrigatório | Descrição |
| --------- | ---- | ----------- | ------------ | --------- |
| `n` | `int` | `1` | X | A quantidade desejada de documentos que serão gerados. |
| `mask` | `bool` | `False` | - | Se os documentos gerados deverão ter ou não máscara. |
| `repeat` | `bool` | `False` | - | Se aceita ou não documentos repetidos. |

```python
from validate_docbr import CPF

cpf = CPF()

# Gerar lista de CPFs
cpfs_one = cpf.generate_list(2) # [ "85215667438", "28293145811" ]
cpfs_two = cpf.generate_list(2, True) # [ "852.156.674-38", "282.931.458-11" ]
```

------------
### mask
Mascara o documento passado como argumento. Retorna um `str` que é o documento mascarado . Recebe os parâmetros:

| Parâmetro | Tipo | Valor padrão | Obrigatório | Descrição |
| --------- | ---- | ----------- | ------------ | --------- |
| `doc` | `str`| `''` | X | O documento que se quer mascarar. |

```python
from validate_docbr import CPF

cpf = CPF()

cpf_me = "01234567890"

# Mascara o CPF
cpf.mask(cpf_me) # "012.345.678-90"
```
14 changes: 14 additions & 0 deletions docs/index.md
@@ -0,0 +1,14 @@
# validate-docbr
<a href="https://pypi.org/project/validate-docbr/">
<img src="https://img.shields.io/pypi/v/validate-docbr.svg" alt="latest release" />
</a>

Pacote Python para validação de documentos brasileiros.

## Instalação do MRE

Para instalar o pacote:

```bash
pip install validate-docbr
```
21 changes: 21 additions & 0 deletions docs/licenca.md
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2018 The Python Packaging Authority

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions docs/sobre.md
@@ -0,0 +1,8 @@
Pacote Python para validação de documentos brasileiros.

## Documentos
Documentos que estão no pacote:

- CPF: Cadastro de Pessoas Físicas;
- CNPJ: Cadastro Nacional da Pessoa Jurídica;
- CNS: Cartão Nacional de Saúde.
14 changes: 14 additions & 0 deletions mkdocs.yml
@@ -0,0 +1,14 @@
site_name: validate-docbr
site_url: https://github.com/alvarofpp/validate-docbr
site_description: Pacote Python para validação de documentos brasileiros.
site_author: MkDocs Team

nav:
- Instalação: index.md
- Guia de uso: guia-de-uso.md
- Sobre: sobre.md
- Licença: licenca.md

repo_url: https://github.com/alvarofpp/validate-docbr

theme: readthedocs
3 changes: 3 additions & 0 deletions validate_docbr/test/t_CPF.py
Expand Up @@ -11,3 +11,6 @@

for i in cpfs:
assert cpf.validate(i)

cpf_me = "01234567890"
assert cpf.mask(cpf_me) == "012.345.678-90"

0 comments on commit ffb546f

Please sign in to comment.