def cargarDDJJ(self): for declaration in self.declarations: dj = Declaration(self.browser, declaration) dj.parseCSV() dj.start() dj.create() dj.load()
class TestDeclaration(TestCase): def setUp(self): self.declaration1 = Declaration('Зеленський Володимир Олександрович') self.declaration2 = Declaration('Ляшко Олег Валерійович') def test_init(self): self.assertEqual((self.declaration1.name, type(self.declaration1.declaration_id), type(self.declaration1.declaration), type(self.declaration1.salary), type(self.declaration1.link)), ('Зеленський Володимир Олександрович', str, dict, int, str)) self.assertEqual((self.declaration2.name, type(self.declaration2.declaration_id), type(self.declaration2.declaration), type(self.declaration2.salary), type(self.declaration2.link)), ('Ляшко Олег Валерійович', str, dict, int, str)) def test_get_declaration(self): self.assertEqual(type(self.declaration1.get_declaration()), dict) self.assertEqual(type(self.declaration2.get_declaration()), dict) def test_get_declaration_details(self): self.assertEqual( type(self.declaration1.get_declaration_details()), dict) self.assertEqual( type(self.declaration2.get_declaration_details()), dict) def test_get_declaration_link(self): self.assertEqual(self.declaration1.get_declaration_link( ), 'https://public.nazk.gov.ua/documents/'+self.declaration1.declaration_id) self.assertEqual(self.declaration2.get_declaration_link( ), 'https://public.nazk.gov.ua/documents/'+self.declaration2.declaration_id) def test_get_salary(self): self.assertEqual(type(self.declaration1.get_salary()), int) self.assertEqual(type(self.declaration2.get_salary()), int)
def get_declarations_recherche(self, nom_recherche): cursor = self.get_connection().cursor() cursor.execute( "select * from declarations where" " nom_qr like ? OR nom_arrond like ? " "ORDER BY num_declaration", ( nom_recherche, nom_recherche, )) declarations_recherche = cursor.fetchall() if len(declarations_recherche) == 0: return None else: return (Declaration(declaration[0], declaration[1], declaration[2], declaration[3], declaration[4], declaration[5], declaration[6], declaration[7], declaration[8], declaration[9], declaration[10], declaration[11], declaration[12], declaration[13]) for declaration in declarations_recherche)
def parse(definition): """ Parse a definition and return the corresponding object. **Parameters** definition : str String describing equation, differential equation, declaration or alias """ try: return DifferentialEquation(definition) except DifferentialEquationError: pass try: return Equation(definition) except EquationError: pass try: return Declaration(definition) except DeclarationError: pass raise ValueError, \ 'Definition has not been recognized ("%s")' % definition
def get_declarations_dates(self, date_debuttrait, date_fintrait): cursor = self.get_connection().cursor() cursor.execute( "select * from declarations where" " date_debuttrait >= ? " "AND date_fintrait <= ? " "ORDER BY num_declaration", ( date_debuttrait, date_fintrait, )) declarations_dates = cursor.fetchall() if len(declarations_dates) == 0: return None else: return (Declaration(declaration[0], declaration[1], declaration[2], declaration[3], declaration[4], declaration[5], declaration[6], declaration[7], declaration[8], declaration[9], declaration[10], declaration[11], declaration[12], declaration[13]) for declaration in declarations_dates)
def setUp(self): self.declaration1 = Declaration('Зеленський Володимир Олександрович') self.declaration2 = Declaration('Ляшко Олег Валерійович')
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os import os.path import sys from declaration import Declaration import export_h import util import view_model import web_ui_view args = util.CreateArgumentParser().parse_args() declaration_path = os.path.relpath(args.declaration, args.root) destination = os.path.relpath(args.destination, args.root) os.chdir(args.root) try: declaration = Declaration(declaration_path) except Exception as e: print >> sys.stderr, e.message sys.exit(1) view_model.Gen(declaration, destination) web_ui_view.Gen(declaration, destination) export_h.Gen(declaration, destination)
first_name = mp['firstName'] last_name = mp['lastName'] club = mp['club'] representative = MP(id=id, first_name=first_name, last_name=last_name, club=club) print(id) pdf_file = f'declarations/{id:03d}.pdf' if pdf_file.split('/')[1] in os.listdir('declarations'): try: #declaration_date = representative.get_declaration() declaration = Declaration(pdf_file=pdf_file) #declaration.get_name() dob = declaration.get_dob() pob = get_city(declaration.get_pob()) position = declaration.get_position() pln_money = declaration.get_pln_money() foreign_money = declaration.get_foreign_money() api.append({ 'id': id, 'first_name': first_name, 'last_name': last_name, 'dob': dob, 'pob': pob, 'club': club, 'position': position,