def load_product_codes(self): # store ISIN codes in a dictionary with a (label: isin) fashion product_codes = {} for table in self.doc.xpath('//table/tbody'): for row in table.xpath('//tr[contains(./th/@scope,"row")]'): label = CleanText('./th[1]', default=None)(row) isin_code = CleanText('./td[1]', default=None)(row) if label and isin_code: product_codes[label.upper()] = isin_code return product_codes
def obj_ownership(self): owner = CleanText( './td//div[contains(@class, "-synthese-text") and not(starts-with(., "N°"))]', default=None)(self) if owner: if re.search( r'(m|mr|me|mme|mlle|mle|ml)\.? (.*)\bou (m|mr|me|mme|mlle|mle|ml)\b(.*)', owner, re.IGNORECASE): return AccountOwnership.CO_OWNER elif all(n in owner.upper() for n in self.env['name'].split()): return AccountOwnership.OWNER return AccountOwnership.ATTORNEY
def obj_DPE(self): value = CleanText('//DPE')(self) return getattr(ENERGY_CLASS, value.upper(), NotAvailable)