Skip to main content

Humanize functions for Portuguese.

Reason this release was yanked:

Replaced by human-readable.

Project description

SUPERSEEDED BY: https://github.com/staticdev/human-readable.

PyPI Python Version License

Read the documentation at https://humanizer-portugues.readthedocs.io/ Tests Codecov

pre-commit Black

Features

  • This lib contains various humanization methods such as transforming a time difference in a human-readable duration “três minutos atrás” (three minutes ago) or in a phrase.

Requirements

  • It works in Python 3.7 and 3.8.

Installation

You can install Humanizer Portugues via pip from PyPI:

$ pip install humanizer-portugues

Usage

Import the lib with:

import humanizer_portugues

Humanization filesizes:

humanizer_portugues.natural_size(1000000)
"1.0 MB"

humanizer_portugues.natural_size(1000000, binary=True)
"976.6 KiB"

humanizer_portugues.natural_size(1000000, gnu=True)
"976.6K"

Humanization of lists:

humanizer_portugues.natural_list(["Cláudio", "Maria"], ",")
"Cláudio, Maria"

humanizer_portugues.natural_list(["Cláudio", "Maria"], ",", "e")
"Cláudio e Maria"

humanizer_portugues.natural_list(["Cláudio", "Maria", "José"], ";", "ou")
"Cláudio; Maria ou José"

Humanization of integers:

humanizer_portugues.ap_number(4)
"quatro"

humanizer_portugues.ap_number(41)
"41"

humanizer_portugues.int_comma(12345)
"12,345"

humanizer_portugues.int_word(123455913)
"123.5 milhão"

humanizer_portugues.int_word(12345591313)
"12.3 bilhão"

Humanization of floating point numbers:

humanizer_portugues.fractional(1/3)
"1/3"

humanizer_portugues.fractional(1.5)
"1 1/2"

humanizer_portugues.fractional(0.3)
"3/10"

humanizer_portugues.fractional(0.333)
"333/1000"

humanizer_portugues.fractional(1)
"1"

Humanization of dates and time:

import datetime

humanizer_portugues.natural_clock(datetime.time(0, 30, 0))
"zero hora e trinta minutos"

humanizer_portugues.natural_clock(datetime.time(0, 30, 0), formal=False)
"meia noite e meia"

humanizer_portugues.natural_date(datetime.date(2007, 6, 5))
"5 de junho de 2007"

humanizer_portugues.natural_day(datetime.datetime.now())
"hoje"

humanizer_portugues.natural_day(datetime.datetime.now() - datetime.timedelta(days=1))
"ontem"

humanizer_portugues.natural_day(datetime.date(2007, 6, 5))
"5 de junho"

humanizer_portugues.natural_delta(datetime.timedelta(seconds=1001))
"16 minutos"

humanizer_portugues.natural_period(datetime.time(5, 30, 0).hour)
"manhã"

humanizer_portugues.natural_time(datetime.datetime.now() - datetime.timedelta(seconds=1))
"há um segundo"

humanizer_portugues.natural_time(datetime.datetime.now() - datetime.timedelta(seconds=3600))
"há uma hora"

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the MIT license, Humanizer Portugues is free and open source software.

Credits

This lib is based on original humanize, with updates for python3, translation fixes for portuguese, changes in return format and the addition of list humanizing. Localization (i18n) was also removed.

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

humanizer-portugues-2.4.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

humanizer_portugues-2.4.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file humanizer-portugues-2.4.1.tar.gz.

File metadata

  • Download URL: humanizer-portugues-2.4.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for humanizer-portugues-2.4.1.tar.gz
Algorithm Hash digest
SHA256 3f1dc949a7e25d67d26bdc8e2544beaf132981c46e1afd98569addb5ffaabeab
MD5 baa39da0e4ae91c286d47a42ca9c3019
BLAKE2b-256 8bb439ff309793cb128300881d1baf2f64b5158680685d0a5a7f6c4b71cd3965

See more details on using hashes here.

File details

Details for the file humanizer_portugues-2.4.1-py3-none-any.whl.

File metadata

  • Download URL: humanizer_portugues-2.4.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for humanizer_portugues-2.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37a7038ac5dcc801c5d077dfa77ec2af09223abeb8fc4495a429cff689e604dd
MD5 1268e625879ed36b240cf2491d1f9965
BLAKE2b-256 039e9d987f2ff85d8ee9a77fc80e18b6d707cda068dff31a1602b11a59c917e5

See more details on using hashes here.

Supported by

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