cenit 0.1.0__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.
- cenit-0.1.0/LICENSE +21 -0
- cenit-0.1.0/PKG-INFO +54 -0
- cenit-0.1.0/README.md +28 -0
- cenit-0.1.0/pyproject.toml +45 -0
- cenit-0.1.0/pyproject.toml.orig +41 -0
- cenit-0.1.0/src/cenit/__init__.py +169 -0
- cenit-0.1.0/src/cenit/_data.py +1327 -0
- cenit-0.1.0/src/cenit/_tui.py +92 -0
- cenit-0.1.0/src/cenit/_types.py +195 -0
- cenit-0.1.0/src/cenit/view.py +605 -0
cenit-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Santiago Papiernik
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
cenit-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cenit
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Versioned Python library for CENIT compensation codes
|
|
5
|
+
Keywords: cenit,colombia,compensation-codes,banrep
|
|
6
|
+
Author: Santiago Papiernik
|
|
7
|
+
Author-email: Santiago Papiernik <spapiernik12@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Dist: rapidfuzz>=3.14.6
|
|
19
|
+
Requires-Dist: rich>=15.0.0
|
|
20
|
+
Requires-Dist: textual>=8.2.8
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Project-URL: Homepage, https://github.com/spapiernik/cenit
|
|
23
|
+
Project-URL: Repository, https://github.com/spapiernik/cenit
|
|
24
|
+
Project-URL: Issues, https://github.com/spapiernik/cenit/issues
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
# cenit
|
|
28
|
+
|
|
29
|
+
Versioned, offline lookups for official CENIT compensation codes.
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
uv add cenit
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
For one-off scripts:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv run --with cenit python script.py
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import cenit
|
|
43
|
+
|
|
44
|
+
participant = cenit.get_by_code("1013")
|
|
45
|
+
print(participant.name, participant.code)
|
|
46
|
+
print(participant.supports_account_number_length("savings", 10))
|
|
47
|
+
print(participant.csv())
|
|
48
|
+
print(cenit.EntityType.BANK in participant.entity_types)
|
|
49
|
+
print(cenit.get_by_name("bamlom", default=None))
|
|
50
|
+
print(len(cenit.all_records()))
|
|
51
|
+
print(cenit.source().document_date)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
`get_by_code` and `get_by_name` raise `ParticipantNotFound` unless `default` is given; `get_by_name` uses fuzzy matching. Rendering and exports live in `cenit.view`.
|
cenit-0.1.0/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# cenit
|
|
2
|
+
|
|
3
|
+
Versioned, offline lookups for official CENIT compensation codes.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
uv add cenit
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
For one-off scripts:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
uv run --with cenit python script.py
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import cenit
|
|
17
|
+
|
|
18
|
+
participant = cenit.get_by_code("1013")
|
|
19
|
+
print(participant.name, participant.code)
|
|
20
|
+
print(participant.supports_account_number_length("savings", 10))
|
|
21
|
+
print(participant.csv())
|
|
22
|
+
print(cenit.EntityType.BANK in participant.entity_types)
|
|
23
|
+
print(cenit.get_by_name("bamlom", default=None))
|
|
24
|
+
print(len(cenit.all_records()))
|
|
25
|
+
print(cenit.source().document_date)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`get_by_code` and `get_by_name` raise `ParticipantNotFound` unless `default` is given; `get_by_name` uses fuzzy matching. Rendering and exports live in `cenit.view`.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cenit"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Versioned Python library for CENIT compensation codes"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
keywords = [
|
|
10
|
+
"cenit",
|
|
11
|
+
"colombia",
|
|
12
|
+
"compensation-codes",
|
|
13
|
+
"banrep",
|
|
14
|
+
]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Programming Language :: Python :: 3.14",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
]
|
|
25
|
+
dependencies = [
|
|
26
|
+
"rapidfuzz>=3.14.6",
|
|
27
|
+
"rich>=15.0.0",
|
|
28
|
+
"textual>=8.2.8",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[[project.authors]]
|
|
32
|
+
name = "Santiago Papiernik"
|
|
33
|
+
email = "spapiernik12@gmail.com"
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/spapiernik/cenit"
|
|
37
|
+
Repository = "https://github.com/spapiernik/cenit"
|
|
38
|
+
Issues = "https://github.com/spapiernik/cenit/issues"
|
|
39
|
+
|
|
40
|
+
[dependency-groups]
|
|
41
|
+
dev = ["pdfplumber>=0.11.11"]
|
|
42
|
+
|
|
43
|
+
[build-system]
|
|
44
|
+
requires = ["uv_build>=0.12.11,<0.14.0"]
|
|
45
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "cenit"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Versioned Python library for CENIT compensation codes"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [
|
|
10
|
+
{ name = "Santiago Papiernik", email = "spapiernik12@gmail.com" }
|
|
11
|
+
]
|
|
12
|
+
keywords = ["cenit", "colombia", "compensation-codes", "banrep"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"rapidfuzz>=3.14.6",
|
|
25
|
+
"rich>=15.0.0",
|
|
26
|
+
"textual>=8.2.8",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Homepage = "https://github.com/spapiernik/cenit"
|
|
31
|
+
Repository = "https://github.com/spapiernik/cenit"
|
|
32
|
+
Issues = "https://github.com/spapiernik/cenit/issues"
|
|
33
|
+
|
|
34
|
+
[dependency-groups]
|
|
35
|
+
dev = [
|
|
36
|
+
"pdfplumber>=0.11.11",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[build-system]
|
|
40
|
+
requires = ["uv_build>=0.12.11,<0.14.0"]
|
|
41
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"""Versioned CENIT compensation codes.
|
|
2
|
+
|
|
3
|
+
Each release bundles one immutable snapshot of the official Banrep table. The
|
|
4
|
+
data is compiled into the package, so lookups are pure, offline and
|
|
5
|
+
deterministic. Publishing a new package version is how new data is released.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from collections.abc import Callable, Mapping
|
|
11
|
+
from datetime import datetime
|
|
12
|
+
from typing import TypeVar, overload
|
|
13
|
+
|
|
14
|
+
from rapidfuzz import distance, fuzz
|
|
15
|
+
|
|
16
|
+
from . import _data
|
|
17
|
+
from ._types import (
|
|
18
|
+
AccountNumberLengthScope,
|
|
19
|
+
AccountType,
|
|
20
|
+
EntityType,
|
|
21
|
+
Participant,
|
|
22
|
+
Source,
|
|
23
|
+
Totals,
|
|
24
|
+
normalize_name,
|
|
25
|
+
)
|
|
26
|
+
from .view import footnote_definitions
|
|
27
|
+
|
|
28
|
+
_MISSING = object()
|
|
29
|
+
_T = TypeVar("_T")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ParticipantNotFound(KeyError):
|
|
33
|
+
"""Raised when a lookup finds no matching participant."""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
__all__ = [
|
|
37
|
+
"AccountNumberLengthScope",
|
|
38
|
+
"AccountType",
|
|
39
|
+
"EntityType",
|
|
40
|
+
"Participant",
|
|
41
|
+
"ParticipantNotFound",
|
|
42
|
+
"all_records",
|
|
43
|
+
"footnote_definitions",
|
|
44
|
+
"footnotes",
|
|
45
|
+
"get_by_code",
|
|
46
|
+
"get_by_name",
|
|
47
|
+
"list_debit_capable_participants",
|
|
48
|
+
"list_participants_by_entity_type",
|
|
49
|
+
"source",
|
|
50
|
+
"totals",
|
|
51
|
+
"version"
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _code_text(code: str | int) -> str:
|
|
56
|
+
if isinstance(code, bool):
|
|
57
|
+
raise TypeError("code must be a string or integer, not bool")
|
|
58
|
+
if isinstance(code, int):
|
|
59
|
+
return str(code)
|
|
60
|
+
if isinstance(code, str):
|
|
61
|
+
return code.strip()
|
|
62
|
+
raise TypeError("code must be a string or integer")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _jaro_winkler(left: str, right: str) -> float:
|
|
66
|
+
return distance.JaroWinkler.similarity(left, right) * 100
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _best_name_match(
|
|
70
|
+
key: str, scorer: Callable[[str, str], float], cutoff: float
|
|
71
|
+
) -> Participant | None:
|
|
72
|
+
best_score = -1.0
|
|
73
|
+
best_row = 0
|
|
74
|
+
best: Participant | None = None
|
|
75
|
+
for normalized, record in _data.CODES_BY_NAME.items():
|
|
76
|
+
score = scorer(key, normalized)
|
|
77
|
+
if score < cutoff:
|
|
78
|
+
continue
|
|
79
|
+
if score > best_score or (score == best_score and record.row_number < best_row):
|
|
80
|
+
best_score = score
|
|
81
|
+
best_row = record.row_number
|
|
82
|
+
best = record
|
|
83
|
+
return best
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@overload
|
|
87
|
+
def get_by_code(code: str | int) -> Participant: ...
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@overload
|
|
91
|
+
def get_by_code(code: str | int, default: _T) -> Participant | _T: ...
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def get_by_code(code: str | int, default: object = _MISSING) -> Participant | object:
|
|
95
|
+
"""Return the record for a CENIT code, raising unless a default is given."""
|
|
96
|
+
record = _data.CODES_BY_CENIT_CODE.get(_code_text(code))
|
|
97
|
+
if record is None:
|
|
98
|
+
if default is not _MISSING:
|
|
99
|
+
return default
|
|
100
|
+
raise ParticipantNotFound(f"unknown CENIT code: {code!r}")
|
|
101
|
+
return record
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@overload
|
|
105
|
+
def get_by_name(name: str) -> Participant: ...
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@overload
|
|
109
|
+
def get_by_name(name: str, default: _T) -> Participant | _T: ...
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def get_by_name(name: str, default: object = _MISSING) -> Participant | object:
|
|
113
|
+
"""Return the closest normalized name match, raising unless a default is given."""
|
|
114
|
+
key = normalize_name(name)
|
|
115
|
+
record = _data.CODES_BY_NAME.get(key)
|
|
116
|
+
if record is None and key:
|
|
117
|
+
record = _best_name_match(key, fuzz.WRatio, 90)
|
|
118
|
+
if record is None and len(key) >= 4:
|
|
119
|
+
record = _best_name_match(key, _jaro_winkler, 69)
|
|
120
|
+
if record is None:
|
|
121
|
+
if default is not _MISSING:
|
|
122
|
+
return default
|
|
123
|
+
raise ParticipantNotFound(f"unknown participant name: {name!r}")
|
|
124
|
+
return record
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def all_records() -> tuple[Participant, ...]:
|
|
128
|
+
"""Return every record in table order."""
|
|
129
|
+
return _data.RECORDS
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def footnotes() -> Mapping[str, str]:
|
|
133
|
+
"""Return the official footnote markers and their English meanings."""
|
|
134
|
+
return _data.FOOTNOTES
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def list_participants_by_entity_type(entity_type: str | EntityType) -> tuple[Participant, ...]:
|
|
138
|
+
"""Return every participant with the given English entity type."""
|
|
139
|
+
try:
|
|
140
|
+
wanted = EntityType(entity_type)
|
|
141
|
+
except ValueError:
|
|
142
|
+
raise ValueError(f"unknown entity type: {entity_type!r}") from None
|
|
143
|
+
return tuple(record for record in _data.RECORDS if wanted in record.entity_types)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def list_debit_capable_participants() -> tuple[Participant, ...]:
|
|
147
|
+
"""Return every participant that supports debit transactions."""
|
|
148
|
+
return tuple(record for record in _data.RECORDS if record.supports_debit_transactions)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def totals() -> Totals:
|
|
152
|
+
"""Return the totals row bundled with this release."""
|
|
153
|
+
return _data.TOTALS
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def version() -> str:
|
|
157
|
+
"""Return the package version that defines this dataset snapshot."""
|
|
158
|
+
return _data.VERSION
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def source() -> Source:
|
|
162
|
+
"""Return the provenance of this dataset snapshot."""
|
|
163
|
+
return Source(
|
|
164
|
+
url=_data.SOURCE_URL,
|
|
165
|
+
sha256=_data.SOURCE_SHA256,
|
|
166
|
+
document_date=_data.SOURCE_DATE,
|
|
167
|
+
fetched_at=datetime.fromisoformat(_data.SOURCE_FETCHED_AT),
|
|
168
|
+
schema_version=_data.SCHEMA_VERSION,
|
|
169
|
+
)
|