예제 #1
0
 def parseAccount(cls_, chunk):
     """
     """
     curItem = Account()
     curItem.is_auto_switch = (cls_.auto_switches == 1)
     lines = chunk.splitlines()
     for line in lines:
         if not len(line) or line[0] == '\n' or line.startswith('!Account'):
             continue
         elif line[0] == 'N':
             curItem.name = line[1:]
         elif line[0] == 'D':
             curItem.description = line[1:]
         elif line[0] == 'T':
             account_type = line[1:]
             if is_obfuscated_account_type(account_type):
                 curItem.account_type = DEFAULT_ACCOUNT_TYPE
             else:
                 curItem.account_type = account_type
         elif line[0] == 'L':
             curItem.credit_limit = line[1:]
         elif line[0] == '/':
             curItem.balance_date = cls_.parseQifDateTime(line[1:])
         elif line[0] == '$':
             curItem.balance_amount = line[1:]
         elif line == '!Clear:AutoSwitch' or line == '!Option:AutoSwitch':
             pass
         else:
             print('Line of account not recognized: ' + line)
     return curItem
예제 #2
0
 def parseAccount(cls_,
                  chunk,
                  date_format=DEFAULT_DATE_FORMAT,
                  decimal_sep=DEFAULT_DECIMAL_SEP,
                  thousands_sep=DEFAULT_THOUSANDS_SEP):
     """
     """
     curItem = Account()
     lines = chunk.split('\n')
     for line in lines:
         if not len(line) or line[0] == '\n' or line.startswith('!Account'):
             continue
         elif line[0] == 'N':
             curItem.name = line[1:]
         elif line[0] == 'D':
             curItem.description = line[1:]
         elif line[0] == 'T':
             curItem.account_type = line[1:]
         elif line[0] == 'L':
             curItem.credit_limit = line[1:]
         elif line[0] == '/':
             curItem.balance_date = cls_.parseQifDateTime(
                 line[1:], date_format)
         elif line[0] == '$':
             curItem.balance_amount = line[1:]
         else:
             logger.warn('Line not recognized: %s' % line)
     return curItem
예제 #3
0
파일: parser.py 프로젝트: royer/Invtax
    def parseAccount(cls_, chunk):
        """
        """
        curItem = Account()
        lines = chunk.split('\n')

        for line in lines:
            if not len(line) or line[0] == '\n' or line.startswith('!Account'):
                continue
            elif line[0] == 'N':
                curItem.name = line[1:]
            elif line[0] == 'D':
                curItem.description = line[1:]
            elif line[0] == 'T':
                curItem.account_type = line[1:]
            elif line[0] == 'L':
                curItem.credit_limit = line[1:]
            elif line[0] == '/':
                curItem.balance_date = cls_.parseQifDateTime(line[1:])
            elif line[0] == '$':
                curItem.balance_amount = line[1:]
            elif line[0] == 'B':
                curItem.balance_amount = cls_.parseIBankAccountBalanceAmount(curItem,line[1:])
            else:
                print('Line not recognized: ' + line, file=sys.stderr)
        return curItem
예제 #4
0
파일: parser.py 프로젝트: zaccheob/qifparse
 def parseAccount(cls_, chunk,
                  date_format=DEFAULT_DATE_FORMAT,
                  decimal_sep=DEFAULT_DECIMAL_SEP,
                  thousands_sep=DEFAULT_THOUSANDS_SEP):
     """
     """
     curItem = Account()
     lines = chunk.split('\n')
     for line in lines:
         if not len(line) or line[0] == '\n' or line.startswith('!Account'):
             continue
         elif line[0] == 'N':
             curItem.name = line[1:]
         elif line[0] == 'D':
             curItem.description = line[1:]
         elif line[0] == 'T':
             curItem.account_type = line[1:]
         elif line[0] == 'L':
             curItem.credit_limit = line[1:]
         elif line[0] == '/':
             curItem.balance_date = cls_.parseQifDateTime(line[1:], date_format)
         elif line[0] == '$':
             curItem.balance_amount = line[1:]
         else:
             logger.warn('Line not recognized: %s' % line)
     return curItem
예제 #5
0
 def parseAccount(cls_, chunk):
     """
     """
     curItem = Account()
     lines = chunk.split('\n')
     for line in lines:
         if not len(line) or line[0] == '\n' or line.startswith('!Account'):
             continue
         elif line[0] == 'N':
             curItem.name = line[1:]
         elif line[0] == 'D':
             curItem.description = line[1:]
         elif line[0] == 'T':
             curItem.account_type = line[1:]
         elif line[0] == 'L':
             curItem.credit_limit = line[1:]
         elif line[0] == '/':
             curItem.balance_date = cls_.parseQifDateTime(line[1:])
         elif line[0] == '$':
             curItem.balance_amount = line[1:]
         else:
             print('Line not recognized: ' + line)
     return curItem