Humanize functions for Portuguese.
Reason this release was yanked:
Replaced by human-readable.
Project description
SUPERSEEDED BY: https://github.com/staticdev/human-readable.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for humanizer-portugues-2.4.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f1dc949a7e25d67d26bdc8e2544beaf132981c46e1afd98569addb5ffaabeab |
|
MD5 | baa39da0e4ae91c286d47a42ca9c3019 |
|
BLAKE2b-256 | 8bb439ff309793cb128300881d1baf2f64b5158680685d0a5a7f6c4b71cd3965 |
Hashes for humanizer_portugues-2.4.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a7038ac5dcc801c5d077dfa77ec2af09223abeb8fc4495a429cff689e604dd |
|
MD5 | 1268e625879ed36b240cf2491d1f9965 |
|
BLAKE2b-256 | 039e9d987f2ff85d8ee9a77fc80e18b6d707cda068dff31a1602b11a59c917e5 |