Metadata-Version: 2.1
Name: br-eval
Version: 0.5.3
Summary: Library for validation and formatting of Brazilian data
Home-page: https://github.com/silvio-machado/br-eval
Author: Silvio Machado
Author-email: silvio.machado@gmail.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

# Validator Brazil

Python library for validation and formatting of Brazilian data such as:
- CPF
- CNPJ
- Vehicle license plates.
- Postal codes (CEP)
- Phone numbers # TODO

## Installation

```bash
pip install br-eval
```

# Usage example

## CPF

```python
from br_eval.cep import validate_cep, format_cep, generate_cep

# Validate CEP
try:
    validate_cep('01001-000')
    print("CEP is valid.")
except Exception as e:
    print(f"Invalid CEP: {e}")

# Validate CEP with extra characters
try:
    validate_cep('94445abcx162')
    print("CEP is valid.")
except Exception as e:
    print(f"Invalid CEP: {e}")  # This will now raise an exception

```
*Note:* The CEP validator requires that the input contains only numeric characters. If the CEP contains letters or other invalid characters, it will raise an InvalidCharacterCEPError.

## CNPJ example

```python
from validator_brazil import validate_cnpj, format_cnpj

# Validate CNPJ
try:
    validate_cnpj('13.347.016/0001-17')
    print("CNPJ is valid.")
except Exception as e:
    print(f"Invalid CNPJ: {e}")

# Format CNPJ
formatted_cnpj = format_cnpj('13347016000117')
print(f"Formatted CNPJ: {formatted_cnpj}")
```

## Plate example

```python
from validator_brazil import validate_plate, format_plate

# Validate Plate
try:
    plate_type = validate_plate('ABC1234')
    print(f"Plate is valid. Type: {plate_type}")
except Exception as e:
    print(f"Invalid plate: {e}")

# Validate Mercosul Car Plate
try:
    plate_type = validate_plate('ABC1D23')
    print(f"Plate is valid. Type: {plate_type}")
except Exception as e:
    print(f"Invalid plate: {e}")

# Validate Mercosul Motorcycle Plate
try:
    plate_type = validate_plate('ABC12D3')
    print(f"Plate is valid. Type: {plate_type}")
except Exception as e:
    print(f"Invalid plate: {e}")

# Format Plate
formatted_plate = format_plate('ABC1D23')
print(f"Formatted Plate: {formatted_plate}")  # Output: 'ABC-1D23'
```

## CEP example

```python
from br_eval.cep import validate_cep, format_cep, generate_cep

# Validate CEP
try:
    validate_cep('01001-000')
    print("CEP is valid.")
except Exception as e:
    print(f"Invalid CEP: {e}")

# Format CEP
formatted_cep = format_cep('01001000')
print(f"Formatted CEP: {formatted_cep}")

# Generate CEP
cep_generated = generate_cep(formatted=True)
print(f"Generated CEP: {cep_generated}")
```

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## License

This project is licensed under the MIT License - see the LICENSE file for details.

# IMPORTANT NOTICE

Disclaimer 1: The CPF and CNPJ generator functions provided by this library are intended solely for development and testing purposes. The generated numbers do not correspond to real individuals or companies and should not be used in production systems, official registrations, or for any illegal or fraudulent activities. Misuse of these functions is the sole responsibility of the user.

Disclaimer 2: The vehicle plate generator functions provided in this library are intended solely for development and testing purposes. The generated plates do not correspond to real vehicles and should not be used in production systems, official documents, registrations, or any activities involving real-world entities. Misuse of these functions is the sole responsibility of the user.

Disclaimer 3: The CEP generator function provided in this library is intended solely for development and testing purposes. The generated CEPs do not necessarily correspond to real addresses and should not be used in production systems, official documents, registrations, or any activities involving real-world entities. Misuse of this function is the sole responsibility of the user.
