pycoda
Quickstart
Generate a CODA file from a factory:
>>> from pycoda.factories import CodaFileFactory
>>> coda_file = CodaFileFactory()
>>> print coda_file.dumps()
0000029050288805 TWlscjlKSUAnthony Hicks GKCCBEBB 06141120086 2
10000 0000000026785942011208 000
2121170000 0000000700448471091015000000000 15030900000 0
8000 0000000000000000160417 0
9 134803000000336605556000000724123462 2
Check the values of the first record:
>>> coda_file.records[0].field_dict()
{'account_holder_reference': 61411200863,
'addressee': u'Anthony Hicks',
'application_code': u'05',
'bank_identification_number': 888,
'bic': u'GKCCBEBB',
'creation_date': datetime.date(2002, 5, 29),
'duplicate': False,
'empty': None,
'free': None,
'identification': 0,
'reference': u'TWlscjlKSU',
'related_reference': None,
'transaction_reference': None,
'version_code': 2,
'zeroes': None}
Update a named field of the first record:
>>> coda_file.records[0].addressee = u'John Doe'
>>> print coda_file.records[0].dumps()
0000029050288805 TWlscjlKSUJohn Doe GKCCBEBB 06141120086 2
Make a new CODA file object and load the records / fields from the previous object string representation:
>>> plain = coda_file.dumps()
>>> from pycoda.codafile import CodaFile
>>> new_coda = CodaFile()
>>> new_coda.loads(plain)
>>> print new_coda.dumps()
0000029050288805 TWlscjlKSUJohn Doe GKCCBEBB 06141120086 2
10000 0000000026785942011208 000
2121170000 0000000700448471091015000000000 15030900000 0
8000 0000000000000000160417 0
9 134803000000336605556000000724123462 2
>>> new_coda.dumps() == coda_file.dumps()
True
Model
The following model hierarchy is employed:
- CODA file: can consist of multiple records of given type
- Record type: each of the record types hold different specified named fields of given type
- Field type: the fields hold the actual values. All the parsing / printing footwork is done at this level
For each of those levels, the objects can:
- loads: set value from string representation
- dumps: generate string representation from value
Metadata
Release files for codapy 0.3.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codapy-0.3.28.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codapy-0.3.28-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.1 kB
Release files / codapy-0.3.28.tar.gz
| Download URL | codapy-0.3.28.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6cd214a982dbbb3d6ebe4edd567052b866a45d58ae896a046d3155a2146bbeaf
|
|
BLAKE2b-256 checksum How to use checksums |
27b01653127fcb0ec25716039b8ac012c0d109e8b75cca63cb1e8dfd724b4bba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / codapy-0.3.28-py3-none-any.whl
| Download URL | codapy-0.3.28-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0aafb09ccfcf9fd809e20035f6895718f0587b02c2285b462f3da01274f3e1dc
|
|
BLAKE2b-256 checksum How to use checksums |
3373a8f325313db3cf3a3e631008f7f880c62480584939e106907f7ad52d78da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|