PyCheval 0.3.2__py3-none-any.whl → 0.3.3__py3-none-any.whl

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.
pycheval/generate.py CHANGED
@@ -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
 
Binary file
pycheval/money.py CHANGED
@@ -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
 
@@ -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
@@ -5,11 +5,11 @@ pycheval/const.py,sha256=r1TmDJQwt2rX4ae24woXaJIlV1v7_8r4P2OavYviPpU,1050
5
5
  pycheval/countries.py,sha256=NC2RAW5Uw4qvVEVP3OEGQQQQRmXovEt0W6BLvPpY5tU,182
6
6
  pycheval/exc.py,sha256=f6CygmWxlfmjyoGcJlFCNNFFAYdUBU-Q9dC0kgh9tcg,1335
7
7
  pycheval/format.py,sha256=7A21YJGHc31rQqXRUyXGlvsLrLQrQQ2IGVqeiVTdx2E,20889
8
- pycheval/generate.py,sha256=FibVG_JbhAr6M6b4ZRiX6GtPR2hZ7aZQb5lNAOrzYFE,32339
9
- pycheval/locale/de/LC_MESSAGES/pycheval.mo,sha256=42pUTO4UiwWVQbJOJJSdhQxELFT6e-bApIfLqk5RRU8,7608
8
+ pycheval/generate.py,sha256=6PO-umfA-06MUFsqTUXDzNjUsHbxm28hFjQVOAYkmY0,32207
9
+ pycheval/locale/de/LC_MESSAGES/pycheval.mo,sha256=ye8Su4Q1LwO6n3sv6D-UO8fLsHwC5D1hb0VCR0lKGVQ,7608
10
10
  pycheval/locale/de/LC_MESSAGES/pycheval.po,sha256=etgHtUgEjfc32oZGc08dd20mk-URRxPG9TJUFh1N-PI,13782
11
11
  pycheval/model.py,sha256=7H0JUOvx2t1KftTGj_souJma-ZQ0EdMftI0xCMNc0c8,27959
12
- pycheval/money.py,sha256=JcOIBx2wn8Pgl8sRyTxtpDjgy-T6R0u_300z6D1T3qk,3133
12
+ pycheval/money.py,sha256=iqx7jEOdVH62XaX5SMqI-pM37CUT8FwtwrD9HO_KOD4,3135
13
13
  pycheval/parse.py,sha256=-TZIdIurlEYfzy68z3pX_Ua-APAs_sPaiSkJkETFIDg,62076
14
14
  pycheval/pdf_common.py,sha256=Gl8hp4WzjOX-8Tk0D0-gKatJkD40_iuhwQeQyPJN8aM,724
15
15
  pycheval/pdf_embed.py,sha256=DA2966lMzPtKDQNRDe6UYS1i4mds_4_gQ5uhqYMGD8s,9114
@@ -19,7 +19,7 @@ pycheval/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  pycheval/quantities.py,sha256=ba3uRJTrbOg2k_w0lnlzi18ehandTqziBp5LvIT084E,1158
20
20
  pycheval/type_codes.py,sha256=ekgVxMofiz_BCXsbZCNxKWtacHffnapdGIHOOT2-TVM,6664
21
21
  pycheval/types.py,sha256=L3HfKkNsu3K9KZ4mraIsvHYh0HGQkR4SrIVzzMMD700,754
22
- pycheval-0.3.2.dist-info/METADATA,sha256=Xmy5nGCu4oG3LUJbo0QWWJMAngoAEL7Ann1Cz8qYaYo,4380
23
- pycheval-0.3.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
24
- pycheval-0.3.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
- pycheval-0.3.2.dist-info/RECORD,,
22
+ pycheval-0.3.3.dist-info/METADATA,sha256=S5sc0yBQJ1eteTq_UkFJdWl8MkihFHkEoKVgoIlR6bc,4380
23
+ pycheval-0.3.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
24
+ pycheval-0.3.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
25
+ pycheval-0.3.3.dist-info/RECORD,,