Skip to content

Commit

Permalink
Cleaned up files (requirements.txt was modified by pre-commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
samJMA committed Nov 6, 2024
1 parent e2d1b39 commit c9d708c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ci:
autoupdate_schedule: quarterly
skip: [pip-compile]
default_language_version:
python: python3.10
python: python3.11
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
Expand Down
21 changes: 6 additions & 15 deletions ca_qc_sainte_anne_de_bellevue/people.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import re

from utils import CanadianPerson as Person
from utils import CanadianScraper

COUNCIL_PAGE = "https://www.ville.sainte-anne-de-bellevue.qc.ca/fr/199/elus-municipaux"


class SainteAnneDeBellevuePersonScraper(CanadianScraper):
def scrape(self):
def decode_email(e):
Expand All @@ -20,8 +19,8 @@ def decode_email(e):

councillors = page.xpath('//div[@class="col-md-12"]')[0]
assert len(councillors), "No councillors found"
roles_and_districts = councillors.xpath('.//h2/text()')

roles_and_districts = councillors.xpath(".//h2/text()")
roles = []
districts = []
names = []
Expand All @@ -32,30 +31,22 @@ def decode_email(e):
role_and_district = role.split()

roles.append(role_and_district[0])

if len(role_and_district) == 1:
districts.append("Sainte-Anne-de-Bellevue")
else:
districts.append("District " + role_and_district[2])

# Fill in contact info via p tags.
contact_info = councillors.xpath('.//p[a[contains(@href, "@")]]')
for contact in contact_info:
contact = contact.text_content().split()
print(contact)
input()
name = " ".join(contact[:2])
names.append(name)

email = contact[3]
email = email.replace("Président", "")
emails.append(email)

print(roles)
print(districts)
print(names)
print(emails)
input()

assert len(roles) == len(districts) == len(names) == len(emails), "Lists are not of equal length"
for i in range(len(roles)):
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ sqlparse==0.5.1
# via django
text-unidecode==1.3
# via python-slugify
typing-extensions==4.12.2
# via asgiref
unidecode==0.4.14
# via -r requirements.in
urllib3==1.26.20
Expand Down

0 comments on commit c9d708c

Please sign in to comment.