cardo-python-utils 0.2.3__tar.gz → 0.2.4__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. {cardo-python-utils-0.2.3/cardo_python_utils.egg-info → cardo-python-utils-0.2.4}/PKG-INFO +1 -1
  2. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4/cardo_python_utils.egg-info}/PKG-INFO +1 -1
  3. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/choices.py +17 -0
  4. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/esma_choices.py +33 -6
  5. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/setup.cfg +1 -1
  6. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/LICENSE +0 -0
  7. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/MANIFEST.in +0 -0
  8. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/README.rst +0 -0
  9. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/cardo_python_utils.egg-info/SOURCES.txt +0 -0
  10. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/cardo_python_utils.egg-info/dependency_links.txt +0 -0
  11. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/cardo_python_utils.egg-info/requires.txt +0 -0
  12. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/cardo_python_utils.egg-info/top_level.txt +0 -0
  13. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/__init__.py +0 -0
  14. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/data_structures.py +0 -0
  15. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/db.py +0 -0
  16. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/django_utils.py +0 -0
  17. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/exceptions.py +0 -0
  18. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/imports.py +0 -0
  19. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/math.py +0 -0
  20. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/pandas_utils.py +0 -0
  21. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/rest.py +0 -0
  22. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/text.py +0 -0
  23. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/time.py +0 -0
  24. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/python_utils/types_hinting.py +0 -0
  25. {cardo-python-utils-0.2.3 → cardo-python-utils-0.2.4}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cardo-python-utils
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Python library enhanced with a wide range of functions for different scenarios.
5
5
  Home-page: https://github.com/CardoAI/cardo-python-utils
6
6
  Author: Kristi Kotini
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cardo-python-utils
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Python library enhanced with a wide range of functions for different scenarios.
5
5
  Home-page: https://github.com/CardoAI/cardo-python-utils
6
6
  Author: Kristi Kotini
@@ -24,6 +24,23 @@ class IChoice(ABC):
24
24
 
25
25
 
26
26
  class ChoiceEnumMeta(EnumMeta, IChoice, ABC):
27
+ def __new__(mcls, *args, **kwargs):
28
+ new_cls = super().__new__(mcls, *args, **kwargs)
29
+
30
+ # Make sure that the int values are unique
31
+ unique_values = set()
32
+ duplicate_values = set()
33
+ for el in new_cls.list_as(int):
34
+ if el in unique_values:
35
+ duplicate_values.add(str(el))
36
+ else:
37
+ unique_values.add(el)
38
+
39
+ if duplicate_values:
40
+ raise ValueError(f"Duplicate int values in {new_cls.__name__}: {', '.join(duplicate_values)}")
41
+
42
+ return new_cls
43
+
27
44
  def __contains__(cls, item: int | str) -> bool:
28
45
  if isinstance(item, int):
29
46
  member_values = [v.value[0] for v in cls.__members__.values()]
@@ -2,10 +2,18 @@
2
2
  This module contains choices used also in ESMA reports.
3
3
 
4
4
  Choices structure:
5
- Example: GUAR = 40, "Guarantee"
6
- GUAR -> ESMA code for the choice, to be used in reports
7
- 40 -> value stored in database
8
- "Guarantee" -> human-readable name, used for display purposes
5
+ Example: OVRD = 1, "Overdraft or Working Capital"
6
+ OVRD -> ESMA code for the choice, to be used in reports
7
+ 1 -> value stored in database
8
+ "Overdraft or Working Capital" -> human-readable name, used for display purposes
9
+
10
+ Exceptions:
11
+ There might be cases in which multiple choices are mapped to the same ESMA code.
12
+ In this case, some characters are added at the end of the ESMA code to differentiate it.
13
+ Example:
14
+ GUAR_G1 = 40, "Guarantee"
15
+ GUAR_G2 = 41, "Government Guarantee"
16
+ In such cases, only the part before the underscore (GUAR) (or the first 4 letters) is used in reports.
9
17
  """
10
18
 
11
19
 
@@ -112,9 +120,28 @@ class RecoverySourceChoices(ChoiceEnum):
112
120
  OTHR = 10, "Other"
113
121
 
114
122
 
123
+ class RealEstateAssetClassChoices(ChoiceEnum):
124
+ OTRE_R1 = 30, "Other Real Estate"
125
+ OTRE_R2 = 31, "Hospitality"
126
+ OTHR_R1 = 32, "Plot of land"
127
+ OTHR_R2 = 33, "Agricultural"
128
+ OTHR_R3 = 34, "Ancillary units"
129
+ CBLD_R1 = 35, "Retail"
130
+ CBLD_R2 = 36, "Office"
131
+ IBLD = 37, "Industrial"
132
+ RBLD = 38, "Residential"
133
+
134
+
135
+
115
136
  class GuaranteeAssetClassChoices(ChoiceEnum):
116
- GUAR = 40, "Guarantee"
117
- GOVG = 41, "Government Guarantee"
137
+ GUAR_G1 = 40, "Personal Guarantee"
138
+ GUAR_G2 = 41, "Government Guarantee"
139
+ GUAR_G3 = 42, "Bank Guarantee"
140
+ GUAR_G4 = 43, "Corporate Guarantee"
141
+ OTHR_G1 = 44, "Pledge on titles"
142
+ OTHR_G2 = 45, "Pledge on goods or inventory"
143
+ OTHR_G3 = 46, "Pledge on others"
144
+ OTHR_G4 = 47, "Patronage letter"
118
145
 
119
146
 
120
147
  class ESMAAccountStatusChoices(ChoiceEnum):
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = cardo-python-utils
3
- version = 0.2.3
3
+ version = 0.2.4
4
4
  description = Python library enhanced with a wide range of functions for different scenarios.
5
5
  long_description = file: README.rst
6
6
  url = https://github.com/CardoAI/cardo-python-utils