-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Conversation
mileo
commented
Jul 10, 2017
•
edited
Loading
edited
- 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).
…to E e estava causando conflitos no cnab240
Banco Bradesco
Feature/importacao pagamento
Layout sicoob
There was a problem hiding this 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(): |
There was a problem hiding this comment.
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""" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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:
.