text stringlengths 0 828 |
|---|
if not parse_next_works and travaux_prep_already and nth_dos_in_page: |
continue |
# Senat 1ère lecture, CMP, ... |
if '<font color=""#000099"" size=""2"" face=""Arial"">' in line: |
text = line_text() |
last_section = None |
if 'Dossier en ligne sur le site du Sénat' in text: |
data['url_dossier_senat'] = clean_url(parse_line().select( |
'a')[-1].attrs['href']) |
text = text.replace( |
'(Dossier en ligne sur le site du Sénat)', '') |
if 'Sénat' in text: |
curr_institution = 'senat' |
elif 'Assemblée nationale' in text: |
curr_institution = 'assemblee' |
elif 'Commission Mixte Paritaire' in text or 'Lecture texte CMP' in text: |
curr_institution = 'CMP' |
curr_stage = 'CMP' |
elif 'Conseil Constitutionnel' in text: |
curr_institution = 'conseil constitutionnel' |
curr_stage = 'constitutionnalité' |
elif 'Congrès du Parlement' in text: |
curr_institution = 'congrès' |
curr_stage = 'congrès' |
if '1ère lecture' in text: |
curr_stage = '1ère lecture' |
elif '2e lecture' in text: |
curr_stage = '2ème lecture' |
elif 'Nouvelle lecture' in text: |
curr_stage = 'nouv. lect.' |
elif 'Lecture définitive' in text: |
curr_stage = 'l. définitive' |
if not curr_stage: |
curr_stage = text.split('-')[-1].strip().lower() |
if curr_stage == ""création de la commission d'enquête"": |
log_warning('COMMISSION D\'ENQUETE') |
return None |
if '>Proposition de résolution européenne<' in line: |
log_warning('PROPOSITION DE RESOLUTION EUROPEENE') |
return None |
if '>Accès aux Travaux préparatoires' in line and not previous_works: |
previous_works = clean_url(urljoin(url_an, parse_line().find('a').attrs['href'])) |
curr_step = None |
# conseil. consti. has no step but we should get the link |
no_step_but_good_link = False |
if 'Rapport portant également sur les propositions' in line: |
continue |
elif re.search(r'<a[^>]* href=[^>]*>(projet de loi|proposition de loi|proposition de résolution)', line, re.I): |
curr_step = 'depot' |
if curr_stage == 'CMP': |
continue |
elif "">Texte de la commission"" in line or '/ta-commission/' in line: |
curr_step = 'commission' |
elif '/ta/' in line or '/leg/tas' in line: |
if get_last_step().get('stage') != curr_stage: |
curr_step = 'depot' |
if curr_stage == 'CMP': |
curr_step = 'commission' |
else: |
curr_step = 'hemicycle' |
elif ('/rapports/' in line or '/rap/' in line) and last_section and 'commissions' in last_section: |
if get_last_step().get('step') == 'commission': |
# log_warning('DOUBLE COMMISSION LINE: %s' % line) |
continue |
curr_step = 'commission' |
elif 'www.conseil-constitutionnel.fr/decision/' in line: |
no_step_but_good_link = True |
# no commissions for l. définitive |
if curr_stage == 'l. définitive' and curr_step == 'commission': |
continue |
if curr_step or no_step_but_good_link: |
# if same step previously, replace or not the url |
if get_last_step().get('step') == curr_step: |
# log_warning('DOUBLE STEP: %s' % line) |
# remove last step since we prefer text links instead of reports links |
# TODO: add report link as bonus_url |
last_url = get_last_step().get('source_url') |
if not last_url or ('/rapports/' in last_url or '/rap/' in last_url): |
data['steps'] = data['steps'][:-1] |
# looks like the last url was already a text, let's assume it's a multi-depot |
else: |
# multi-depot if not CMP |
# TODO: re-order multi depot |
if curr_institution == 'senat' and curr_stage != 'CMP': |
curr_step = 'depot' |
links = [a.attrs.get('href') for a in parse_line().select('a')] |
links = [ |
href for href in links if href and 'fiches_id' not in href and '/senateur/' not in href and 'javascript:' not in href] |
if not links: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.