diff -Nru python-humanize-2.4.0/debian/changelog python-humanize-2.4.1/debian/changelog --- python-humanize-2.4.0/debian/changelog 2020-05-10 11:52:22.000000000 +0000 +++ python-humanize-2.4.1/debian/changelog 2020-06-30 07:18:16.000000000 +0000 @@ -1,3 +1,9 @@ +python-humanize (2.4.1-1) unstable; urgency=medium + + * New upstream release + + -- Sylvestre Ledru Tue, 30 Jun 2020 09:18:16 +0200 + python-humanize (2.4.0-1) unstable; urgency=medium * New upstream release diff -Nru python-humanize-2.4.0/.github/workflows/lint.yml python-humanize-2.4.1/.github/workflows/lint.yml --- python-humanize-2.4.0/.github/workflows/lint.yml 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/.github/workflows/lint.yml 2020-06-27 10:11:32.000000000 +0000 @@ -4,10 +4,7 @@ jobs: build: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: [3.8] + runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 @@ -28,15 +25,17 @@ restore-keys: | lint-pre-commit- - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v1 + - name: Set up Python + uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: 3.8 - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install --upgrade tox + python -m pip install -U pip + python -m pip install -U tox - name: Lint run: tox -e lint + env: + PRE_COMMIT_COLOR: always diff -Nru python-humanize-2.4.0/.github/workflows/test.yml python-humanize-2.4.1/.github/workflows/test.yml --- python-humanize-2.4.0/.github/workflows/test.yml 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/.github/workflows/test.yml 2020-06-27 10:11:32.000000000 +0000 @@ -8,74 +8,52 @@ strategy: fail-fast: false matrix: - python-version: ["pypy3", "3.5", "3.6", "3.7", "3.8", "3.9"] + python-version: ["pypy3", "3.5", "3.6", "3.7", "3.8"] os: [ubuntu-latest, macos-latest, windows-latest] include: # Include new variables for Codecov - { codecov-flag: GHA_Ubuntu, os: ubuntu-latest } - { codecov-flag: GHA_macOS, os: macos-latest } - { codecov-flag: GHA_Windows, os: windows-latest } - exclude: - - { python-version: 3.9, os: macos-latest } - - { python-version: 3.9, os: windows-latest } - - { python-version: pypy3, os: windows-latest } + # Dev versions + - { python-version: 3.9-dev, os: ubuntu-18.04 } + - { python-version: 3.10-dev, os: ubuntu-18.04 } steps: - uses: actions/checkout@v2 - - name: Ubuntu cache - uses: actions/cache@v1 - if: startsWith(matrix.os, 'ubuntu') + - name: Set up Python ${{ matrix.python }} (deadsnakes) + uses: deadsnakes/action@v1.0.0 + if: endsWith(matrix.python-version, '-dev') with: - path: ~/.cache/pip - key: - ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') - }} - restore-keys: | - ${{ matrix.os }}-${{ matrix.python-version }}- + python-version: ${{ matrix.python-version }} - - name: macOS cache - uses: actions/cache@v1 - if: startsWith(matrix.os, 'macos') + - name: Set up Python ${{ matrix.python-version }} + if: "!endsWith(matrix.python-version, '-dev')" + uses: actions/setup-python@v2 with: - path: ~/Library/Caches/pip - key: - ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') - }} - restore-keys: | - ${{ matrix.os }}-${{ matrix.python-version }}- + python-version: ${{ matrix.python-version }} - - name: Windows cache + - name: Get pip cache dir + id: pip-cache + run: | + python -m pip install -U "pip>=20.1" + echo "::set-output name=dir::$(pip cache dir)" + + - name: pip cache uses: actions/cache@v1 - if: startsWith(matrix.os, 'windows') with: - path: ~\AppData\Local\pip\Cache + path: ${{ steps.pip-cache.outputs.dir }} key: - ${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py') - }} + ${{ matrix.os }}-${{ matrix.python-version }}-v2-${{ + hashFiles('**/setup.py') }} restore-keys: | - ${{ matrix.os }}-${{ matrix.python-version }}- - - - name: Install Python 3.9 - if: matrix.python-version == '3.9' - run: | - sudo add-apt-repository ppa:deadsnakes/ppa - sudo apt-get update - sudo apt-get install -y --no-install-recommends python3.9-dev python3.9-distutils python3.9-venv - python3.9 -m pip install --upgrade pip setuptools - python3.9 -m venv $HOME/venv-python3.9 - echo "::set-env name=VIRTUAL_ENV::$HOME/venv-python3.9" - echo "::add-path::$HOME/venv-python3.9/bin" - - - name: Set up Python ${{ matrix.python-version }} - if: matrix.python-version != '3.9' - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} + ${{ matrix.os }}-${{ matrix.python-version }}-v2- - name: Install dependencies run: | python -m pip install --upgrade pip + python -m pip install --upgrade wheel python -m pip install --upgrade tox - name: Tox tests diff -Nru python-humanize-2.4.0/PKG-INFO python-humanize-2.4.1/PKG-INFO --- python-humanize-2.4.0/PKG-INFO 2020-04-23 16:46:39.968970000 +0000 +++ python-humanize-2.4.1/PKG-INFO 2020-06-27 10:18:15.692999600 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: humanize -Version: 2.4.0 +Version: 2.4.1 Summary: Python humanize utilities Home-page: https://github.com/jmoiron/humanize Author: Jason Moiron @@ -19,6 +19,7 @@ [![GitHub Actions status](https://github.com/jmoiron/humanize/workflows/Test/badge.svg)](https://github.com/jmoiron/humanize/actions) [![codecov](https://codecov.io/gh/hugovk/humanize/branch/master/graph/badge.svg)](https://codecov.io/gh/hugovk/humanize) [![MIT License](https://img.shields.io/github/license/jmoiron/humanize.svg)](LICENSE) + [![Tidelift](https://tidelift.com/badges/package/pypi/humanize)](https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=badge) This modest package contains various common humanization utilities, like turning a number into a fuzzy human readable duration ("3 minutes ago") or into a human @@ -132,7 +133,7 @@ >>> humanize.fractional(0.3) '3/10' >>> humanize.fractional(0.333) - '1/3' + '333/1000' >>> humanize.fractional(1) '1' ``` @@ -163,13 +164,13 @@ >>> import humanize >>> import datetime as dt >>> humanize.naturaltime(dt.timedelta(seconds=3)) - 3 seconds ago + '3 seconds ago' >>> _t = humanize.i18n.activate("ru_RU") >>> humanize.naturaltime(dt.timedelta(seconds=3)) - 3 секунды назад + '3 секунды назад' >>> humanize.i18n.deactivate() >>> humanize.naturaltime(dt.timedelta(seconds=3)) - 3 seconds ago + '3 seconds ago' ``` You can pass additional parameter `path` to `activate` to specify a path to search @@ -177,8 +178,9 @@ ```pycon >>> import humanize - >>> humanize.i18n.activate("pt_BR") - IOError: [Errno 2] No translation file found for domain: 'humanize' + >>> humanize.i18n.activate("xx_XX") + <...> + FileNotFoundError: [Errno 2] No translation file found for domain: 'humanize' >>> humanize.i18n.activate("pt_BR", path="path/to/my/portuguese/translation/") ``` diff -Nru python-humanize-2.4.0/.pre-commit-config.yaml python-humanize-2.4.1/.pre-commit-config.yaml --- python-humanize-2.4.0/.pre-commit-config.yaml 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/.pre-commit-config.yaml 2020-06-27 10:11:32.000000000 +0000 @@ -1,6 +1,6 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v2.1.0 + rev: v2.6.1 hooks: - id: pyupgrade args: ["--py3-plus"] @@ -12,13 +12,13 @@ args: ["--target-version", "py35"] - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.9 + rev: 3.8.3 hooks: - id: flake8 additional_dependencies: [flake8-2020, flake8-implicit-str-concat] - repo: https://github.com/asottile/seed-isort-config - rev: v2.1.0 + rev: v2.2.0 hooks: - id: seed-isort-config @@ -33,7 +33,7 @@ - id: python-check-blanket-noqa - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.5.0 + rev: v3.1.0 hooks: - id: check-merge-conflict - id: check-toml diff -Nru python-humanize-2.4.0/README.md python-humanize-2.4.1/README.md --- python-humanize-2.4.0/README.md 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/README.md 2020-06-27 10:11:32.000000000 +0000 @@ -7,6 +7,7 @@ [![GitHub Actions status](https://github.com/jmoiron/humanize/workflows/Test/badge.svg)](https://github.com/jmoiron/humanize/actions) [![codecov](https://codecov.io/gh/hugovk/humanize/branch/master/graph/badge.svg)](https://codecov.io/gh/hugovk/humanize) [![MIT License](https://img.shields.io/github/license/jmoiron/humanize.svg)](LICENSE) +[![Tidelift](https://tidelift.com/badges/package/pypi/humanize)](https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=badge) This modest package contains various common humanization utilities, like turning a number into a fuzzy human readable duration ("3 minutes ago") or into a human @@ -120,7 +121,7 @@ >>> humanize.fractional(0.3) '3/10' >>> humanize.fractional(0.333) -'1/3' +'333/1000' >>> humanize.fractional(1) '1' ``` @@ -151,13 +152,13 @@ >>> import humanize >>> import datetime as dt >>> humanize.naturaltime(dt.timedelta(seconds=3)) -3 seconds ago +'3 seconds ago' >>> _t = humanize.i18n.activate("ru_RU") >>> humanize.naturaltime(dt.timedelta(seconds=3)) -3 секунды назад +'3 секунды назад' >>> humanize.i18n.deactivate() >>> humanize.naturaltime(dt.timedelta(seconds=3)) -3 seconds ago +'3 seconds ago' ``` You can pass additional parameter `path` to `activate` to specify a path to search @@ -165,8 +166,9 @@ ```pycon >>> import humanize ->>> humanize.i18n.activate("pt_BR") -IOError: [Errno 2] No translation file found for domain: 'humanize' +>>> humanize.i18n.activate("xx_XX") +<...> +FileNotFoundError: [Errno 2] No translation file found for domain: 'humanize' >>> humanize.i18n.activate("pt_BR", path="path/to/my/portuguese/translation/") ``` diff -Nru python-humanize-2.4.0/setup.cfg python-humanize-2.4.1/setup.cfg --- python-humanize-2.4.0/setup.cfg 2020-04-23 16:46:39.972257900 +0000 +++ python-humanize-2.4.1/setup.cfg 2020-06-27 10:18:15.697276000 +0000 @@ -9,6 +9,9 @@ multi_line_output = 3 use_parentheses = True +[tool:pytest] +addopts = --color=yes + [egg_info] tag_build = tag_date = 0 diff -Nru python-humanize-2.4.0/src/humanize/i18n.py python-humanize-2.4.1/src/humanize/i18n.py --- python-humanize-2.4.0/src/humanize/i18n.py 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/src/humanize/i18n.py 2020-06-27 10:11:32.000000000 +0000 @@ -7,7 +7,11 @@ _TRANSLATIONS = {None: gettext_module.NullTranslations()} _CURRENT = local() -_DEFAULT_LOCALE_PATH = os.path.join(os.path.dirname(__file__), "locale") +try: + _DEFAULT_LOCALE_PATH = os.path.join(os.path.dirname(__file__), "locale") +except AttributeError: + # in case that __file__ does not exist + _DEFAULT_LOCALE_PATH = None def get_translation(): @@ -23,6 +27,12 @@ @param path: path to search for locales""" if path is None: path = _DEFAULT_LOCALE_PATH + + if path is None: + raise Exception( + "Humanize cannot determinate the default location of the 'locale' folder. " + "You need to pass the path explicitly." + ) if locale not in _TRANSLATIONS: translation = gettext_module.translation("humanize", path, [locale]) _TRANSLATIONS[locale] = translation Binary files /tmp/tmpb29U_j/cjhBqmGBU2/python-humanize-2.4.0/src/humanize/locale/pt_BR/LC_MESSAGES/humanize.mo and /tmp/tmpb29U_j/2A9RYVlAx1/python-humanize-2.4.1/src/humanize/locale/pt_BR/LC_MESSAGES/humanize.mo differ diff -Nru python-humanize-2.4.0/src/humanize/locale/pt_BR/LC_MESSAGES/humanize.po python-humanize-2.4.1/src/humanize/locale/pt_BR/LC_MESSAGES/humanize.po --- python-humanize-2.4.0/src/humanize/locale/pt_BR/LC_MESSAGES/humanize.po 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/src/humanize/locale/pt_BR/LC_MESSAGES/humanize.po 2020-06-27 10:11:32.000000000 +0000 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-03-22 16:30+0200\n" +"POT-Creation-Date: 2020-06-20 23:04-0300\n" "PO-Revision-Date: 2016-06-15 15:58-0300\n" "Last-Translator: \n" "Language-Team: \n" @@ -262,7 +262,7 @@ #: src/humanize/time.py:167 #, python-format msgid "%s ago" -msgstr "a %s" +msgstr "há %s" #: src/humanize/time.py:171 msgid "now" diff -Nru python-humanize-2.4.0/src/humanize.egg-info/PKG-INFO python-humanize-2.4.1/src/humanize.egg-info/PKG-INFO --- python-humanize-2.4.0/src/humanize.egg-info/PKG-INFO 2020-04-23 16:46:38.000000000 +0000 +++ python-humanize-2.4.1/src/humanize.egg-info/PKG-INFO 2020-06-27 10:18:15.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: humanize -Version: 2.4.0 +Version: 2.4.1 Summary: Python humanize utilities Home-page: https://github.com/jmoiron/humanize Author: Jason Moiron @@ -19,6 +19,7 @@ [![GitHub Actions status](https://github.com/jmoiron/humanize/workflows/Test/badge.svg)](https://github.com/jmoiron/humanize/actions) [![codecov](https://codecov.io/gh/hugovk/humanize/branch/master/graph/badge.svg)](https://codecov.io/gh/hugovk/humanize) [![MIT License](https://img.shields.io/github/license/jmoiron/humanize.svg)](LICENSE) + [![Tidelift](https://tidelift.com/badges/package/pypi/humanize)](https://tidelift.com/subscription/pkg/pypi-humanize?utm_source=pypi-humanize&utm_medium=badge) This modest package contains various common humanization utilities, like turning a number into a fuzzy human readable duration ("3 minutes ago") or into a human @@ -132,7 +133,7 @@ >>> humanize.fractional(0.3) '3/10' >>> humanize.fractional(0.333) - '1/3' + '333/1000' >>> humanize.fractional(1) '1' ``` @@ -163,13 +164,13 @@ >>> import humanize >>> import datetime as dt >>> humanize.naturaltime(dt.timedelta(seconds=3)) - 3 seconds ago + '3 seconds ago' >>> _t = humanize.i18n.activate("ru_RU") >>> humanize.naturaltime(dt.timedelta(seconds=3)) - 3 секунды назад + '3 секунды назад' >>> humanize.i18n.deactivate() >>> humanize.naturaltime(dt.timedelta(seconds=3)) - 3 seconds ago + '3 seconds ago' ``` You can pass additional parameter `path` to `activate` to specify a path to search @@ -177,8 +178,9 @@ ```pycon >>> import humanize - >>> humanize.i18n.activate("pt_BR") - IOError: [Errno 2] No translation file found for domain: 'humanize' + >>> humanize.i18n.activate("xx_XX") + <...> + FileNotFoundError: [Errno 2] No translation file found for domain: 'humanize' >>> humanize.i18n.activate("pt_BR", path="path/to/my/portuguese/translation/") ``` diff -Nru python-humanize-2.4.0/tests/test_number.py python-humanize-2.4.1/tests/test_number.py --- python-humanize-2.4.0/tests/test_number.py 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/tests/test_number.py 2020-06-27 10:11:32.000000000 +0000 @@ -123,6 +123,10 @@ ("8.9", "8 9/10"), ("ten", "ten"), (None, None), + (1 / 3, "1/3"), + (1.5, "1 1/2"), + (0.3, "3/10"), + (0.333, "333/1000"), ], ) def test_fractional(test_input, expected): diff -Nru python-humanize-2.4.0/tox.ini python-humanize-2.4.1/tox.ini --- python-humanize-2.4.0/tox.ini 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/tox.ini 2020-06-27 10:11:32.000000000 +0000 @@ -10,5 +10,6 @@ [testenv:lint] deps = pre-commit -commands = pre-commit run --all-files +commands = pre-commit run --all-files --show-diff-on-failure skip_install = true +passenv = PRE_COMMIT_COLOR diff -Nru python-humanize-2.4.0/.travis.yml python-humanize-2.4.1/.travis.yml --- python-humanize-2.4.0/.travis.yml 2020-04-23 16:45:18.000000000 +0000 +++ python-humanize-2.4.1/.travis.yml 2020-06-27 10:11:32.000000000 +0000 @@ -8,6 +8,10 @@ - 3.7 - 3.8 - 3.9-dev + - 3.10-dev + +matrix: + fast_finish: true install: - pip install -U pip