Code Monkey home page Code Monkey logo

pycoda's Introduction

pycoda

CI status Coverage Status License: MIT PyPI version Code style

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

pycoda's People

Contributors

dependabot[bot] avatar mhemeryck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pycoda's Issues

Csv to Coda

Hello Mr. Martin,

I want learn, Have you a script for csv bank statements to Codabox format ?

Sorry for asking this question in here. I can't find your email.

Thanks

Add a CLI-interface

Add a CLI interface for some of the common functions to do.

We should probably keep this for last -- until we have some decent functionality to actually show.

Add coverage reports

Make coverage reports (coveralls?) part of the automated build process.

Haven't done this before, so might need some research.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.