Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-py-moneyed for
openSUSE:Factory checked in at 2022-11-28 11:07:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-py-moneyed (Old)
and /work/SRC/openSUSE:Factory/.python-py-moneyed.new.1597 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-py-moneyed"
Mon Nov 28 11:07:23 2022 rev:4 rq:1038584 version:3.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-py-moneyed/python-py-moneyed.changes
2022-07-11 19:11:23.423782241 +0200
+++
/work/SRC/openSUSE:Factory/.python-py-moneyed.new.1597/python-py-moneyed.changes
2022-11-28 11:07:30.611876038 +0100
@@ -1,0 +2,9 @@
+Mon Nov 28 07:29:42 UTC 2022 - Matej Cepl <[email protected]>
+
+- Update to 3.0:
+ - Added SLE & VED currencies.
+ - Removed support for Python 3.6.
+ - Added support for Python 3.10 & 3.11.
+- Remove upstreamed patch 178_missing_currencies.patch.
+
+-------------------------------------------------------------------
Old:
----
178_missing_currencies.patch
py-moneyed-2.0.tar.gz
New:
----
py-moneyed-3.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-py-moneyed.spec ++++++
--- /var/tmp/diff_new_pack.rOOBkF/_old 2022-11-28 11:07:31.135878387 +0100
+++ /var/tmp/diff_new_pack.rOOBkF/_new 2022-11-28 11:07:31.139878406 +0100
@@ -16,17 +16,13 @@
#
-%{?!python_module:%define python_module() python3-%{**}}
Name: python-py-moneyed
-Version: 2.0
+Version: 3.0
Release: 0
Summary: Python currency and money classes
License: BSD-3-Clause
URL: https://github.com/limist/py-moneyed
Source:
https://github.com/py-moneyed/py-moneyed/archive/refs/tags/v%{version}.tar.gz#/py-moneyed-%{version}.tar.gz
-# PATCH-FIX-UPSTREAM 178_missing_currencies.patch gh#py-moneyed/py-moneyed#178
[email protected]
-# Add two missing currencies
-Patch0: 178_missing_currencies.patch
BuildRequires: %{python_module base >= 3.6}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
++++++ py-moneyed-2.0.tar.gz -> py-moneyed-3.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/.github/workflows/build.yml
new/py-moneyed-3.0/.github/workflows/build.yml
--- old/py-moneyed-2.0/.github/workflows/build.yml 2021-05-26
16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/.github/workflows/build.yml 2022-11-27
22:27:16.000000000 +0100
@@ -11,21 +11,16 @@
runs-on: ubuntu-latest
strategy:
matrix:
- python-version: [3.6, 3.7, 3.8, 3.9, pypy3]
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "pypy-3.8"]
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/setup-python@v2
+ uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- - uses: actions/cache@v2
- with:
- path: ~/.cache/pip
- key: >-
- ${{ runner.os }}
- -pip
- -${{ matrix.python-version }}
- -${{ hashFiles('setup.cfg') }}
+ cache: pip
+ cache-dependency-path: setup.cfg
+ check-latest: true
- name: Install dependencies
run: python -m pip install --upgrade pip tox tox-gh-actions
- name: Run tests
@@ -35,6 +30,23 @@
name: Lint
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-python@v2
- - uses: pre-commit/[email protected]
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
+ - uses: pre-commit/[email protected]
+
+ docs:
+ name: docs
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 1
+
+ - uses: actions/setup-python@v4
+ with:
+ python-version: 3.7
+
+ - run: pip install tox
+
+ - name: Run docs tox job
+ run: tox -e docs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/.github/workflows/release.yml
new/py-moneyed-3.0/.github/workflows/release.yml
--- old/py-moneyed-2.0/.github/workflows/release.yml 2021-05-26
16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/.github/workflows/release.yml 2022-11-27
22:27:16.000000000 +0100
@@ -9,8 +9,8 @@
name: Build and publish Python ð distributions ð¦ to PyPI
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - uses: actions/setup-python@v2
+ - uses: actions/checkout@v3
+ - uses: actions/setup-python@v4
- name: Install tox
run: python3 -m pip install --upgrade tox
- name: Build a binary wheel and a source tarball
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/.pre-commit-config.yaml
new/py-moneyed-3.0/.pre-commit-config.yaml
--- old/py-moneyed-2.0/.pre-commit-config.yaml 2021-05-26 16:16:11.000000000
+0200
+++ new/py-moneyed-3.0/.pre-commit-config.yaml 2022-11-27 22:27:16.000000000
+0100
@@ -1,41 +1,62 @@
repos:
-- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: "v3.4.0"
+ - repo: https://github.com/psf/black
+ rev: "22.10.0"
hooks:
- - id: trailing-whitespace
- - id: end-of-file-fixer
-- repo: https://github.com/sirosen/check-jsonschema
- rev: "0.3.0"
+ - id: black
+ args:
+ - --quiet
+
+ - repo: https://github.com/pycqa/isort
+ rev: "5.10.1"
+ hooks:
+ - id: isort
+
+ - repo: https://github.com/asottile/pyupgrade
+ rev: "v3.2.2"
hooks:
- - id: check-github-workflows
- require_serial: true
-- repo: https://gitlab.com/pycqa/flake8
- rev: "3.9.1"
+ - id: pyupgrade
+ args:
+ - --py3-plus
+ - --py36-plus
+ - --py37-plus
+
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: "v4.4.0"
+ hooks:
+ - id: check-ast
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: mixed-line-ending
+
+ - repo: https://github.com/sirosen/check-jsonschema
+ rev: "0.19.2"
hooks:
- - id: flake8
-- repo: https://github.com/pre-commit/mirrors-isort
- rev: "v5.8.0"
- hooks:
- - id: isort
-- repo: https://github.com/mgedmin/check-manifest
- rev: "0.46"
- hooks:
- - id: check-manifest
-- repo: https://github.com/asottile/pyupgrade
- rev: "v2.12.0"
+ - id: check-github-workflows
+ require_serial: true
+
+ - repo: https://github.com/pycqa/flake8
+ rev: "6.0.0"
hooks:
- - id: pyupgrade
- args:
- - --py36-plus
-- repo: https://github.com/psf/black
- rev: "20.8b1"
- hooks:
- - id: black
-- repo: https://github.com/pre-commit/mirrors-mypy
- rev: "v0.812"
+ - id: flake8
+ additional_dependencies:
+ - flake8-type-checking
+ - flake8-bugbear
+ - flake8-comprehensions
+ - flake8-print
+ - flake8-mutable
+ - flake8-simplify
+ - flake8-pytest-style
+ - flake8-printf-formatting
+
+ - repo: https://github.com/pre-commit/mirrors-mypy
+ rev: "v0.991"
hooks:
- - id: mypy
- args: []
+ - id: mypy
exclude: ^(docs/|setup.py$)
additional_dependencies:
- - pytest
+ - pytest
+
+ - repo: https://github.com/mgedmin/check-manifest
+ rev: "0.48"
+ hooks:
+ - id: check-manifest
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/CHANGES.rst
new/py-moneyed-3.0/CHANGES.rst
--- old/py-moneyed-2.0/CHANGES.rst 2021-05-26 16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/CHANGES.rst 2022-11-27 22:27:16.000000000 +0100
@@ -7,6 +7,12 @@
Unreleased - TBA
----------------
+3.0 (2022-11-27)
+----------------
+* Added ``SLE`` & ``VED`` currencies.
+* Removed support for Python 3.6.
+* Added support for Python 3.10 & 3.11.
+
2.0 (2021-05-26)
----------------
* Dropped support for Python 2.7 and 3.5 and PyPy 2.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/CONTRIBUTING.rst
new/py-moneyed-3.0/CONTRIBUTING.rst
--- old/py-moneyed-2.0/CONTRIBUTING.rst 2021-05-26 16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/CONTRIBUTING.rst 2022-11-27 22:27:16.000000000 +0100
@@ -39,14 +39,14 @@
Run the tests using tox::
- tox -e py39
+ tox -e py310
You can run the test suite on all supported environments using tox_
(recommended). If you do not have all versions of Python that are used in
testing, you can use pyenv_ to install them, and you may benefit from the
additional plugin pyenv-implict_.
-The py-moneyed package is tested against Python 3.6 - 3.9 and PyPy 3.
+The py-moneyed package is tested against Python 3.7 - 3.11 and PyPy 3.
.. _tox: https://tox.readthedocs.io/en/latest/
.. _pyenv: https://github.com/pyenv/pyenv
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/RELEASE.rst
new/py-moneyed-3.0/RELEASE.rst
--- old/py-moneyed-2.0/RELEASE.rst 2021-05-26 16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/RELEASE.rst 2022-11-27 22:27:16.000000000 +0100
@@ -5,7 +5,7 @@
* Change version number in:
- * setup.py
+ * setup.cfg
* docs/conf.py
* Fix 'CHANGES.rst' so the top section says "[new version number] [date]"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/docs/conf.py
new/py-moneyed-3.0/docs/conf.py
--- old/py-moneyed-2.0/docs/conf.py 2021-05-26 16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/docs/conf.py 2022-11-27 22:27:16.000000000 +0100
@@ -22,7 +22,7 @@
author = "Kai Wu"
# The full version, including alpha/beta/rc tags
-release = "2.0"
+release = "3.0"
# -- General configuration ---------------------------------------------------
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/docs/conftest.py
new/py-moneyed-3.0/docs/conftest.py
--- old/py-moneyed-2.0/docs/conftest.py 2021-05-26 16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/docs/conftest.py 2022-11-27 22:27:16.000000000 +0100
@@ -1,12 +1,10 @@
-from typing import Dict
-
import pytest
from moneyed import USD, Money
@pytest.fixture(autouse=True)
-def add_entities(doctest_namespace: Dict[str, object]) -> None:
+def _add_entities(doctest_namespace: dict[str, object]) -> None:
"""
Inserts entities into doctest namespaces so that imports don't have to be
added to
all examples.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/docs/formatting.rst
new/py-moneyed-3.0/docs/formatting.rst
--- old/py-moneyed-2.0/docs/formatting.rst 2021-05-26 16:16:11.000000000
+0200
+++ new/py-moneyed-3.0/docs/formatting.rst 2022-11-27 22:27:16.000000000
+0100
@@ -6,7 +6,7 @@
.. code-block:: python
>>> from moneyed.l10n import format_money
- >>> format_money(Money(10, USD), locale='en_US')
+ >>> format_money(Money(10, 'USD'), locale='en_US')
'$10.00'
Note that you need to specify ``locale`` or you will get the system default,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/setup.cfg new/py-moneyed-3.0/setup.cfg
--- old/py-moneyed-2.0/setup.cfg 2021-05-26 16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/setup.cfg 2022-11-27 22:27:16.000000000 +0100
@@ -1,6 +1,6 @@
[metadata]
name = py-moneyed
-version = 2.0
+version = 3.0
description = Provides Currency and Money classes for use in your Python code.
long_description = file: README.rst
long_description_content_type = text/x-rst
@@ -13,10 +13,11 @@
platforms = any
classifiers =
Programming Language :: Python
- Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
+ Programming Language :: Python :: 3.10
+ Programming Language :: Python :: 3.11
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
License :: OSI Approved :: BSD License
@@ -35,7 +36,7 @@
package_dir =
=src
include_package_data = True
-python_requires = >=3.6
+python_requires = >=3.7
install_requires =
babel>=2.8.0
typing-extensions>=3.7.4.3
@@ -54,6 +55,14 @@
[flake8]
max-line-length = 119
+enable-extensions = TC, TC1
+per-file-ignores =
+ src/moneyed/__init__.py:F403,F401
+ignore =
+ # W503 - Incompatible with Black
+ W503,
+ # SIM106 - Ignore error cases first
+ SIM106,
[isort]
profile = black
@@ -74,7 +83,7 @@
.mypy_cache
[mypy]
-python_version = 3.6
+python_version = 3.7
show_error_codes = True
pretty = True
files = src/, tests/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/src/moneyed/__init__.py
new/py-moneyed-3.0/src/moneyed/__init__.py
--- old/py-moneyed-2.0/src/moneyed/__init__.py 2021-05-26 16:16:11.000000000
+0200
+++ new/py-moneyed-3.0/src/moneyed/__init__.py 2022-11-27 22:27:16.000000000
+0100
@@ -1 +1 @@
-from .classes import * # NOQA
+from .classes import *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/src/moneyed/classes.py
new/py-moneyed-3.0/src/moneyed/classes.py
--- old/py-moneyed-2.0/src/moneyed/classes.py 2021-05-26 16:16:11.000000000
+0200
+++ new/py-moneyed-3.0/src/moneyed/classes.py 2022-11-27 22:27:16.000000000
+0100
@@ -1,14 +1,21 @@
+from __future__ import annotations
+
import warnings
from decimal import Decimal
-from typing import Any, Dict, List, NoReturn, Optional, TypeVar, Union,
overload
+from typing import TYPE_CHECKING, TypeVar, overload
from babel import Locale
from babel.core import get_global
-from typing_extensions import Final, Protocol
+from typing_extensions import Protocol
from .l10n import format_money
from .utils import cached_property
+if TYPE_CHECKING:
+ from typing import Any, NoReturn
+
+ from typing_extensions import Final
+
def force_decimal(amount: object) -> Decimal:
"""Given an amount of unknown type, type cast it to be a Decimal."""
@@ -28,10 +35,10 @@
def __init__(
self,
code: str = "",
- numeric: Optional[str] = None,
+ numeric: str | None = None,
sub_unit: int = 1,
- name: Optional[str] = None,
- countries: Optional[List[str]] = None,
+ name: str | None = None,
+ countries: list[str] | None = None,
) -> None:
self.code: Final = code
self.numeric: Final = numeric
@@ -54,10 +61,10 @@
def __repr__(self) -> str:
return self.code
- def __lt__(self, other: "Currency") -> bool:
+ def __lt__(self, other: Currency) -> bool:
return self.code < other.code
- def __le__(self, other: "Currency") -> bool:
+ def __le__(self, other: Currency) -> bool:
return self.code <= other.code
@cached_property
@@ -71,7 +78,7 @@
return self._name
return self.get_name("en_US")
- def get_name(self, locale: str, count: Optional[int] = None) -> str:
+ def get_name(self, locale: str, count: int | None = None) -> str:
from babel.numbers import get_currency_name
return get_currency_name( # type: ignore[no-any-return]
@@ -81,11 +88,11 @@
)
@cached_property
- def zero(self) -> "Money":
+ def zero(self) -> Money:
return Money(0, self)
@cached_property
- def countries(self) -> List[str]:
+ def countries(self) -> list[str]:
"""
List of country names, uppercased and in US locale, where the currency
is
used at present.
@@ -102,7 +109,7 @@
]
@cached_property
- def country_codes(self) -> List[str]:
+ def country_codes(self) -> list[str]:
"""
List of current country codes for the currency.
"""
@@ -131,7 +138,7 @@
class CurrencyDoesNotExist(Exception):
- def __init__(self, code: Optional[str]) -> None:
+ def __init__(self, code: str | None) -> None:
super().__init__(f"No currency with code {code} is defined.")
@@ -145,6 +152,9 @@
...
+zero = Decimal("0.0")
+
+
class Money:
"""
A Money instance is a combination of data - an amount and a
@@ -161,17 +171,17 @@
# the implementation defines `None` as default for currency, but raises a
TypeError
# for that case.
@overload
- def __init__(self, amount: object = ..., *, currency: Union[str,
Currency]) -> None:
+ def __init__(self, amount: object = ..., *, currency: str | Currency) ->
None:
...
@overload
- def __init__(self, amount: object, currency: Union[str, Currency]) -> None:
+ def __init__(self, amount: object, currency: str | Currency) -> None:
...
def __init__(
self,
- amount: object = Decimal("0.0"),
- currency: Union[str, Currency, None] = None,
+ amount: object = zero,
+ currency: str | Currency | None = None,
) -> None:
if currency is None:
raise TypeError(
@@ -244,7 +254,7 @@
currency=self.currency,
)
- def __truediv__(self: M, other: object) -> Union[M, Decimal]:
+ def __truediv__(self: M, other: object) -> M | Decimal:
if isinstance(other, Money):
if self.currency != other.currency:
raise TypeError("Cannot divide two different currencies.")
@@ -263,7 +273,7 @@
def __rtruediv__(self, other: object) -> NoReturn:
raise TypeError("Cannot divide non-Money by a Money instance.")
- def round(self: M, ndigits: Optional[int] = 0) -> M:
+ def round(self: M, ndigits: int | None = 0) -> M:
"""
Rounds the amount using the current ``Decimal`` rounding algorithm.
"""
@@ -352,16 +362,16 @@
# Definitions of ISO 4217 Currencies
# Source:
http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm
# noqa
-CURRENCIES: Dict[str, Currency] = {}
-CURRENCIES_BY_ISO: Dict[str, Currency] = {}
+CURRENCIES: dict[str, Currency] = {}
+CURRENCIES_BY_ISO: dict[str, Currency] = {}
def add_currency(
code: str,
- numeric: Optional[str],
+ numeric: str | None,
sub_unit: int = 1,
- name: Optional[str] = None,
- countries: Optional[List[str]] = None,
+ name: str | None = None,
+ countries: list[str] | None = None,
) -> Currency:
currency = Currency(
code=code, numeric=numeric, sub_unit=sub_unit, name=name,
countries=countries
@@ -379,13 +389,11 @@
@overload
-def get_currency(*, iso: Union[int, str]) -> Currency:
+def get_currency(*, iso: int | str) -> Currency:
...
-def get_currency(
- code: Optional[str] = None, iso: Union[int, str, None] = None
-) -> Currency:
+def get_currency(code: str | None = None, iso: int | str | None = None) ->
Currency:
try:
if iso:
return CURRENCIES_BY_ISO[str(iso)]
@@ -394,7 +402,7 @@
raise CurrencyDoesNotExist(code)
-def get_currencies_of_country(country_code: str) -> List[Currency]:
+def get_currencies_of_country(country_code: str) -> list[Currency]:
"""
Returns list with currency object(s) given the country's ISO-2 code.
Raises a CountryDoesNotExist exception if the country is not found.
@@ -404,15 +412,13 @@
"""
country_code = country_code.upper()
return sorted(
- [
- currency
- for currency in CURRENCIES.values()
- if country_code in currency.country_codes
- ]
+ currency
+ for currency in CURRENCIES.values()
+ if country_code in currency.country_codes
)
-def list_all_currencies() -> List[Currency]:
+def list_all_currencies() -> list[Currency]:
return sorted(CURRENCIES.values(), key=lambda c: c.code)
@@ -680,6 +686,7 @@
SEK = add_currency("SEK", "752", 100)
SGD = add_currency("SGD", "702", 100)
SHP = add_currency("SHP", "654", 100)
+SLE = add_currency("SLE", "925", 100)
SLL = add_currency("SLL", "694", 100)
SOS = add_currency("SOS", "706", 100)
SRD = add_currency("SRD", "968", 100)
@@ -704,6 +711,7 @@
UYI = add_currency("UYI", "940")
UYU = add_currency("UYU", "858", 100)
UZS = add_currency("UZS", "860", 100)
+VED = add_currency("VED", "926", 100)
VND = add_currency("VND", "704")
VUV = add_currency("VUV", "548")
WST = add_currency("WST", "882", 100)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/src/moneyed/l10n.py
new/py-moneyed-3.0/src/moneyed/l10n.py
--- old/py-moneyed-2.0/src/moneyed/l10n.py 2021-05-26 16:16:11.000000000
+0200
+++ new/py-moneyed-3.0/src/moneyed/l10n.py 2022-11-27 22:27:16.000000000
+0100
@@ -1,15 +1,17 @@
-from typing import TYPE_CHECKING, Optional
+from __future__ import annotations
+
+from typing import TYPE_CHECKING
from babel.numbers import LC_NUMERIC
from babel.numbers import format_currency as babel_format_currency
if TYPE_CHECKING:
- from . import Money
+ from .classes import Money
def format_money(
- money: "Money",
- format: Optional[str] = None,
+ money: Money,
+ format: str | None = None,
locale: str = LC_NUMERIC,
currency_digits: bool = True,
format_type: str = "standard",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/src/moneyed/utils.py
new/py-moneyed-3.0/src/moneyed/utils.py
--- old/py-moneyed-2.0/src/moneyed/utils.py 2021-05-26 16:16:11.000000000
+0200
+++ new/py-moneyed-3.0/src/moneyed/utils.py 2022-11-27 22:27:16.000000000
+0100
@@ -1,4 +1,9 @@
-from typing import Callable, Generic, TypeVar
+from __future__ import annotations
+
+from typing import TYPE_CHECKING, Generic, TypeVar
+
+if TYPE_CHECKING:
+ from collections.abc import Callable
A = TypeVar("A")
R = TypeVar("R")
@@ -12,7 +17,7 @@
def __init__(self, func: Callable[[A], R]) -> None:
self.func = func
- self.__doc__ = getattr(func, "__doc__")
+ self.__doc__ = func.__doc__
def __get__(self, instance: A, type: type) -> R:
res = instance.__dict__[self.func.__name__] = self.func(instance)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/tests/test_money.yaml
new/py-moneyed-3.0/tests/test_money.yaml
--- old/py-moneyed-2.0/tests/test_money.yaml 2021-05-26 16:16:11.000000000
+0200
+++ new/py-moneyed-3.0/tests/test_money.yaml 2022-11-27 22:27:16.000000000
+0100
@@ -5,13 +5,13 @@
Money(amount=10)
out: |
main:2: error: No overload variant of "Money" matches argument type "int"
[call-overload]
+ main:2: note: Possible overload variants:
main:2: note: def __init__(self, amount: object = ..., *, currency:
Union[str, Currency]) -> Money
main:2: note: def __init__(self, amount: object, currency: Union[str,
Currency]) -> Money
- main:2: note: Possible overload variants:
main:3: error: No overload variant of "Money" matches argument type "int"
[call-overload]
+ main:3: note: Possible overload variants:
main:3: note: def __init__(self, amount: object = ..., *, currency:
Union[str, Currency]) -> Money
main:3: note: def __init__(self, amount: object, currency: Union[str,
Currency]) -> Money
- main:3: note: Possible overload variants:
# A bug in mypy seems to make it so that on non-cached runs the output uses
__init__
# and on cached runs it uses Money. Disabling the cache seems to make the
output
# stable.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/tests/test_moneyed_classes.py
new/py-moneyed-3.0/tests/test_moneyed_classes.py
--- old/py-moneyed-2.0/tests/test_moneyed_classes.py 2021-05-26
16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/tests/test_moneyed_classes.py 2022-11-27
22:27:16.000000000 +0100
@@ -400,9 +400,7 @@
def test_all_babel_currencies():
- missing = sorted(
- list(set(get_global("all_currencies").keys()) - set(CURRENCIES.keys()))
- )
+ missing = sorted(set(get_global("all_currencies").keys()) -
set(CURRENCIES.keys()))
assert (
missing == []
), "The following currencies defined in Babel are missing: " + ",
".join(missing)
@@ -411,5 +409,5 @@
def test_list_all_currencies():
all_currencies = list_all_currencies()
assert len(all_currencies) > 100
- assert [c.code for c in all_currencies[0:3]] == ["ADP", "AED", "AFA"]
+ assert [c.code for c in all_currencies[:3]] == ["ADP", "AED", "AFA"]
assert all(isinstance(c, Currency) for c in all_currencies)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/py-moneyed-2.0/tox.ini new/py-moneyed-3.0/tox.ini
--- old/py-moneyed-2.0/tox.ini 2021-05-26 16:16:11.000000000 +0200
+++ new/py-moneyed-3.0/tox.ini 2022-11-27 22:27:16.000000000 +0100
@@ -1,9 +1,11 @@
[tox]
# Add to .github/workflow/build.yml and [gh-actions] below when you add to this
-envlist = py36,py37,py38,py39,pypy3
+envlist = py37,py38,py39,py310,py311,pypy3
isolated_build = true
[testenv]
+deps =
+ pytest
extras = type-tests
commands = pytest --mypy-ini-file=setup.cfg
@@ -15,12 +17,23 @@
[gh-actions]
python =
- 3.6: py36
3.7: py37
3.8: py38
3.9: py39
- pypy3: pypy3
+ 3.10: py310
+ 3.11: py311
+ pypy-3.8: pypy3
[testenv:build]
deps = build
commands = python3 -m build --sdist --wheel .
+
+[testenv:docs]
+basepython = python3.7
+changedir = docs
+allowlist_externals =
+ make
+deps =
+ sphinx
+commands =
+ make html