Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refatoração da biblioteca do CNAB #3

Open
wants to merge 86 commits into
base: master
Choose a base branch
from

Conversation

mileo
Copy link
Member

@mileo mileo commented Jul 10, 2017

  • PEP8
  • Refatoração para suportar outras transações alem de cobrança de boleto bancário
  • Melhoria nos testes
  • Inclusão do item 3.1 - Pagamentos (Pagamento Através de Crédito em Conta, cheque, OP, DOC, TED ou Pagamento com Autenticação).

Copy link

@leorochael leorochael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tirando esses pequenos comentário, me parece Ok.

f.close()

campos = spec.get('campos')
for campo in campos.values():

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

campos.values() vai falhar com attribute error se spec.get('campos') for None.

Se spec.get('campos') não deve retornar None, então o certo é usar:

  • spec['campos']

Se campos pode estar ausente de spec, então o certo é usar:

  • spec.get('campos', {})

"""Tentativa de atribuicao de valor mais longo que o campo suportaia"""

class NumDigitosExcedidoError(AtribuicaoCampoError):
"""Tentativa de atribuicao de valor mais longo que o campo suportaia"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suportaia


class LoteCobranca(LoteBase):
pass
# HeaderCls = LoteCobranca.banco.registros.HeaderLoteCobranca

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Código comentado sobrando.

@@ -25,41 +29,54 @@ def valor(self):
def valor(self, valor):
if self.formato == 'alfa':
if not isinstance(valor, unicode):
print ("{0} - {1}".format(self.nome, self.valor))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O que esses prints fazem aqui?

@@ -153,7 +171,7 @@ def carregar(self, registro_str):
try:
campo.valor = Decimal(dec)
except InvalidOperation:
raise # raise custom?
raise # raise custom?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qual a função desse except: raise aqui? Parece melhor remover...

@@ -1,17 +1,17 @@

try:
try:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isso é necessário? unitest2 só é útil para Python 2.6

@@ -3,22 +3,22 @@

setup(
name='cnab240',
version='0.01',
version='0.02.1',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.02.1 não é um identificador de versão válido. Setuptools e pip normalizam esse número para 0.2.1

author='Tracy Web Technologies',
author_email='[email protected]',
url='https://github.com/TracyWebTech/cnab240',
packages=find_packages(),
package_data={
'cnab240': ['bancos/*/*/*.json']
},
zip_safe=False,
zip_safe=True,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isto é verdade? Existem vários arquivos .json dentro deste pacote...

- "python -m unittest discover || unit2 discover"

after_success:
coveralls

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faltou quebra de linha no fim do arquivo.

@@ -0,0 +1,4 @@
unittest2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todos estes arquivos são backports do Python 2.7 para versões anteriores.

Existe alguma necessidade de testar esse módulo com Python 2.6 ou menor? Senão, acho melhor jogar fora este arquivo, ou colocar uma única linha:

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants