Coder Social home page Coder Social logo

enhanced-cnab's Introduction

Enhanced-CNAB


Code style: black

Introduction

Work in progress CNAB file writer based on QuilhaSoft/OpenCnabPHP.


All my thanks to every contributor to OpenCnabPHP project.


TODO: better this repository README.

enhanced-cnab's People

Contributors

eduardojm avatar

Stargazers

Rodrigo Castro avatar

Watchers

 avatar

enhanced-cnab's Issues

Create multiple field's: one for each type

To prevent this code at field __init__:

        self.validators = []
        if self.required:
            self.validators += [validators.validate_required]
        
        if self.validation == CNABFieldType.Int:
            self.validators += [validators.validate_integer]
            self.formatter = formatter.format_integer

        if self.validation == CNABFieldType.Decimal:
            self.validators += [validators.validate_decimal]
            self.formatter = formatter.format_decimal

        if self.validation == CNABFieldType.Alfa:
            self.formatter = formatter.format_alfa
            
        if self.validation == CNABFieldType.Alfa2:
            self.formatter = formatter.format_alfa2

        if self.validation == CNABFieldType.Date:
            self.validators += [validators.validate_date]
            self.formatter = formatter.format_date

        if self.validation == CNABFieldType.Time:
            self.validators += [validators.validate_date]
            self.formatter = formatter.format_time

Reduces unnecessary class inheritances

We have registro.py with class Registro that inherits from RegistroBase (The RegistroBase contains the fields reading logic on __new__ and is a base for remessa and retorno registers) and we have registro_remessa.py with RegistroRemessa that inherits from Registro and contains get_text() method.

The registro.py should be removed and all the code from it should be added on registro_remessa.py.

Finally, the registro_remessa.py should be renamed to registro.py and should be moved to a folder with remessa name.

|- base
 |- remessa
  |- CNAB240
   |- __init__.py
   |- registro0.py
   ...
  |- CNAB400
   |- __init__.py
   |- registro0.py
   ...
  |- __init__.py
  |- registro.py
  |- remessa.py
 |- retorno
  |- CNAB240
   |- __init__.py
   |- registro0.py
   ...
  |- CNAB400
   |- __init__.py
   |- registro0.py
   ...
  |- __init__.py
  |- exceptions.py
  |- retorno.py

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.