PyCheval 0.3.2__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {pycheval-0.3.2 → pycheval-0.3.3}/PKG-INFO +1 -1
  2. {pycheval-0.3.2 → pycheval-0.3.3}/pyproject.toml +1 -1
  3. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/generate.py +10 -10
  4. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/locale/de/LC_MESSAGES/pycheval.mo +0 -0
  5. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/money.py +7 -5
  6. {pycheval-0.3.2 → pycheval-0.3.3}/LICENSE +0 -0
  7. {pycheval-0.3.2 → pycheval-0.3.3}/README.md +0 -0
  8. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/__init__.py +0 -0
  9. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/_locale.py +0 -0
  10. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/_test_data.py +0 -0
  11. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/const.py +0 -0
  12. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/countries.py +0 -0
  13. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/exc.py +0 -0
  14. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/format.py +0 -0
  15. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/locale/de/LC_MESSAGES/pycheval.po +0 -0
  16. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/model.py +0 -0
  17. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/parse.py +0 -0
  18. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/pdf_common.py +0 -0
  19. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/pdf_embed.py +0 -0
  20. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/pdf_extract.py +0 -0
  21. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/pdf_parse.py +0 -0
  22. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/py.typed +0 -0
  23. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/quantities.py +0 -0
  24. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/type_codes.py +0 -0
  25. {pycheval-0.3.2 → pycheval-0.3.3}/src/pycheval/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyCheval
3
- Version: 0.3.2
3
+ Version: 0.3.3
4
4
  Summary: Factur-X/ZUGFeRD parsing and generation library for Python
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "PyCheval"
3
- version = "0.3.2"
3
+ version = "0.3.3"
4
4
  description = "Factur-X/ZUGFeRD parsing and generation library for Python"
5
5
  authors = [{ name = "Sebastian Rittau", email = "sebastian.rittau@zfutura.de" }]
6
6
  readme = "README.md"
@@ -162,28 +162,28 @@ def _generate_trade_party(
162
162
  ET.SubElement(el, "ram:ID").text = id
163
163
  for global_id in party.global_ids:
164
164
  _scheme_id_element(el, "ram:GlobalID", global_id)
165
- if party.name is not None:
165
+ if party.name:
166
166
  ET.SubElement(el, "ram:Name").text = party.name
167
- if party.description is not None:
167
+ if party.description:
168
168
  ET.SubElement(el, "ram:Description").text = party.description
169
- if party.legal_id is not None or party.trading_business_name is not None:
169
+ if party.legal_id or party.trading_business_name:
170
170
  legal_el = ET.SubElement(el, "ram:SpecifiedLegalOrganization")
171
- if party.legal_id is not None:
171
+ if party.legal_id:
172
172
  _scheme_id_element(legal_el, "ram:ID", party.legal_id)
173
- if party.trading_business_name is not None:
173
+ if party.trading_business_name:
174
174
  ET.SubElement(
175
175
  legal_el, "ram:TradingBusinessName"
176
176
  ).text = party.trading_business_name
177
- if party.contact is not None:
177
+ if party.contact:
178
178
  _generate_trade_contact(el, party.contact)
179
- if party.address is not None:
179
+ if party.address:
180
180
  _address_element(el, party.address)
181
- if party.email is not None:
181
+ if party.email:
182
182
  _email_element(el, "ram:URIUniversalCommunication", party.email)
183
- if party.tax_number is not None:
183
+ if party.tax_number:
184
184
  tax = ET.SubElement(el, "ram:SpecifiedTaxRegistration")
185
185
  ET.SubElement(tax, "ram:ID", schemeID="FC").text = party.tax_number
186
- if party.vat_id is not None:
186
+ if party.vat_id:
187
187
  tax = ET.SubElement(el, "ram:SpecifiedTaxRegistration")
188
188
  ET.SubElement(tax, "ram:ID", schemeID="VA").text = party.vat_id
189
189
 
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import locale
4
4
  import re
5
- from decimal import Decimal
5
+ from decimal import ROUND_HALF_UP, Decimal
6
6
  from typing import Literal, cast
7
7
 
8
8
 
@@ -42,8 +42,6 @@ class Money:
42
42
  value.currency,
43
43
  ):
44
44
  return False
45
- if self.amount.as_tuple().exponent != value.amount.as_tuple().exponent:
46
- return False
47
45
  return True
48
46
 
49
47
  def __repr__(self) -> str:
@@ -79,11 +77,15 @@ class Money:
79
77
  return formatted_amount + (separated and " " or "") + currency
80
78
 
81
79
  def __mul__(self, other: Decimal) -> Money:
82
- value = (self.amount * other).quantize(Decimal("1.00"))
80
+ value = (self.amount * other).quantize(
81
+ Decimal("1.00"), rounding=ROUND_HALF_UP
82
+ )
83
83
  return Money(value, self.currency)
84
84
 
85
85
  def __truediv__(self, other: Decimal) -> Money:
86
- value = (self.amount / other).quantize(Decimal("1.00"))
86
+ value = (self.amount / other).quantize(
87
+ Decimal("1.00"), rounding=ROUND_HALF_UP
88
+ )
87
89
  return Money(value, self.currency)
88
90
 
89
91
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes