PEP8 on account_banking_mt940

This commit is contained in:
Sandy Carter
2014-08-25 17:02:30 -04:00
parent ab0a6ce8f8
commit 54039f126c
2 changed files with 22 additions and 15 deletions

View File

@@ -19,9 +19,9 @@
#
##############################################################################
{
"name" : "MT940",
"version" : "1.0",
"author" : "Therp BV",
"name": "MT940",
"version": "1.0",
"author": "Therp BV",
"complexity": "expert",
"description": """
This addon provides a generic parser for MT940 files. Given that MT940 is a
@@ -32,11 +32,11 @@ certain bank.
See account_banking_nl_ing_mt940 for an example on how to use it.
""",
"category" : "Dependency",
"depends" : [
"category": "Dependency",
"depends": [
'account_banking',
],
"data" : [
"data": [
],
"js": [
],
@@ -47,7 +47,7 @@ See account_banking_nl_ing_mt940 for an example on how to use it.
"auto_install": False,
"installable": True,
"application": False,
"external_dependencies" : {
'python' : [],
"external_dependencies": {
'python': [],
},
}

View File

@@ -27,18 +27,23 @@ import re
import datetime
import logging
try:
from openerp.addons.account_banking.parsers.models import\
mem_bank_statement, mem_bank_transaction
from openerp.addons.account_banking.parsers.models import (
mem_bank_statement,
mem_bank_transaction,
)
from openerp.tools.misc import DEFAULT_SERVER_DATE_FORMAT
except ImportError:
#this allows us to run this file standalone, see __main__ at the end
# this allows us to run this file standalone, see __main__ at the end
class mem_bank_statement:
def __init__(self):
self.transactions = []
class mem_bank_transaction:
pass
DEFAULT_SERVER_DATE_FORMAT = "%Y-%m-%d"
class MT940(object):
'''Inherit this class in your account_banking.parsers.models.parser,
define functions to handle the tags you need to handle and adjust static
@@ -46,7 +51,7 @@ class MT940(object):
Note that order matters: You need to do your_parser(MT940, parser), not the
other way around!
At least, you should override handle_tag_61 and handle_tag_86. Don't forget
to call super.
handle_tag_* functions receive the remainder of the the line (that is,
@@ -59,7 +64,7 @@ class MT940(object):
footer_regex = '^-}$'
footer_regex = '^-XXX$'
'The line that denotes end of message, we need to create a new statement'
tag_regex = '^:[0-9]{2}[A-Z]*:'
'The beginning of a record, should be anchored to beginning of the line'
@@ -194,15 +199,17 @@ class MT940(object):
banks occur'''
pass
'utility functions'
def str2date(string, fmt='%y%m%d'):
return datetime.datetime.strptime(string, fmt)
def str2float(string):
return float(string.replace(',', '.'))
'testing'
def main(filename):
"""testing"""
parser = MT940()
parser.parse(None, open(filename, 'r').read())
for statement in parser.statements: