Skip to main content

A Python module with a collection of useful tools for Brazilians (and anyone else who wants to use it)

Project description

PyPI - License PyPI - Version PyPI - Python Version Github
Pepy Total Downloads PyPI - Downloads PyPI - Downloads PyPI - Downloads

Introduction

A Python module with a collection of useful tools for Brazilians (and anyone else who wants to use it).
Take a look at CHANGELOG.md for the changes.

Brief History

I started studying Python recently and wanted to do something that would be useful. Enjoy toolkitbrazil.

Overview

Here's a quick overview of what the library has at the moment:

  • Random generation of CPF and CNPJ numbers
  • CPF and CNPJ validation
  • Check which state a DDD belongs to
  • Returns the capital of a state
  • String cleaner

Usage

import toolkitbrazil as tkb

# Remove diacritics, non alpha chars, multiple spaces and convert string to upper case
print(tkb.strClean('A héalt#hy  dìet is    esse&ntiãl  for    go(od heàlth and    nutrition  '))
# Return: 'A HEALTHY DIET IS ESSENTIAL FOR GOOD HEALTH AND NUTRITION'

# Generate a random CPF
print(tkb.rngCPF())
# Sample return: 75269169703

# Generate a random CPF of specific UF
print(tkb.rngCPF('SP'))
# Sample return: 27039729890

# Validate a CPF
print(tkb.valCPF(75269169703))
# Return: True

# Generate a random CNPJ of the headquarters (branch 0001)
print(tkb.rngCNPJ())
# Sample return: 86978319000101

# Generate a random CNPJ of a branch (any branch)
print(tkb.rngCNPJfiliais())
# Sample return: 94318840326682

# Validate a CNPJ
print(tkb.valCNPJ(86978319000101))
# Return: True

# Check the UF of the CPF
print(tkb.ufCPF(75269169703))
# Return: ['ES', 'RJ']

# Check the UF of the DDD or phone number (using first two digits of any number)
print(tkb.ufDDD(61))
# Return: ['DF', 'GO']
print(tkb.ufDDD(11987654321))
# Return: ['SP']

# Check the capital of a UF
print(tkb.ufCapital('SP'))
# Return ['SAO PAULO', 'SP']

# Validate a CPF and check its UF
print(tkb.valCPFuf(75269169703, 'SP'))
# Return False (it's a valid CPF but from another UF)

Authors

Ricardo Colombani - @coloric

How to install

$ pip install toolkitbrazil

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toolkitbrazil-0.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toolkitbrazil-0.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file toolkitbrazil-0.0.1.tar.gz.

File metadata

  • Download URL: toolkitbrazil-0.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for toolkitbrazil-0.0.1.tar.gz
Algorithm Hash digest
SHA256 36a1c324d35394e35b0f39e52439a2b419a2c7dbd2a4c7f1303b4fdde59a5545
MD5 87798a72af712488005472c852b29c45
BLAKE2b-256 7d7a3115e25f72dbd9c3dad780a1051185459531029fb705048c5f7cf20edb76

See more details on using hashes here.

File details

Details for the file toolkitbrazil-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: toolkitbrazil-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for toolkitbrazil-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 458ec116edd91ec22a27b6c44746d824f816be9799a260151375c29926f2725b
MD5 1e612c69201b339c63b90a8fd827c64e
BLAKE2b-256 2bfb5e9bba43933ffe4cc809de88c67322b35e9f839951a218027ec78e0cf01f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page