Esempio n. 1
0
    def obj_type(self):
        types = {'comptes? bancaires?': Account.TYPE_CHECKING,
                 'livrets?': Account.TYPE_SAVINGS,
                 'epargnes? logement': Account.TYPE_SAVINGS,
                 "autres produits d'epargne": Account.TYPE_SAVINGS,
                 'comptes? titres? et pea': Account.TYPE_MARKET,
                 'compte-titres': Account.TYPE_MARKET,
                 'assurances? vie et retraite': Account.TYPE_LIFE_INSURANCE,
                 u'prêt': Account.TYPE_LOAN,
                 u'crédits?': Account.TYPE_LOAN,
                 'plan d\'epargne en actions': Account.TYPE_PEA
                 }

        # first trying to match with label
        label = Field('label')(self)
        for atypetxt, atype in types.items():
            if re.findall(atypetxt, label.lower()):  # match with/without plurial in type
                return atype
        # then by type
        type = Regexp(CleanText('../../preceding-sibling::div[@class="avoirs"][1]/span[1]'), r'(\d+) (.*)', '\\2')(self)
        for atypetxt, atype in types.items():
            if re.findall(atypetxt, type.lower()):  # match with/without plurial in type
                return atype

        return Account.TYPE_UNKNOWN
Esempio n. 2
0
            def obj_date(self):
                actual_day = Eval(int,
                                  Regexp(CleanText('./div/h4'),
                                         '\w{3} (\d+)'))(self)
                actual_month_str = Regexp(CleanText('./div/h4'), '(\w+)')(self)
                actual_month = 0

                base_date = date.today()
                month_dict = {
                    'JAN': 1,
                    'FEB': 2,
                    'MAR': 3,
                    'APR': 4,
                    'MAI': 5,
                    'JUN': 6,
                    'JUL': 7,
                    'AUG': 8,
                    'SEP': 9,
                    'OCT': 10,
                    'NOV': 11,
                    'DEC': 12
                }

                for key, value in month_dict.items():
                    if actual_month_str.lower() == key.lower():
                        actual_month = value

                base_date = base_date.replace(day=actual_day)
                base_date = base_date.replace(month=actual_month)
                return base_date
Esempio n. 3
0
    def obj_type(self):
        types = {
            'comptes? bancaires?': Account.TYPE_CHECKING,
            'livrets?': Account.TYPE_SAVINGS,
            'epargnes? logement': Account.TYPE_SAVINGS,
            'comptes? titres? et pea': Account.TYPE_MARKET,
            'assurances? vie et retraite': Account.TYPE_LIFE_INSURANCE,
            u'prêt': Account.TYPE_LOAN,
            u'crédits?': Account.TYPE_LOAN,
            'plan d\'epargne en actions': Account.TYPE_PEA
        }

        # first trying to match with label
        label = Field('label')(self)
        for atypetxt, atype in types.items():
            if re.findall(atypetxt,
                          label.lower()):  # match with/without plurial in type
                return atype
        # then by type
        type = Regexp(
            CleanText(
                '../../preceding-sibling::div[@class="avoirs"][1]/span[1]'),
            r'(\d+) (.*)', '\\2')(self)
        for atypetxt, atype in types.items():
            if re.findall(atypetxt,
                          type.lower()):  # match with/without plurial in type
                return atype

        return Account.TYPE_UNKNOWN