Skip to content

Commit

Permalink
UT: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jessemortenson committed Dec 14, 2024
1 parent c0dc1b1 commit 48a3242
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions scrapers/ut/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def scrape_bill(self, chamber, session, url, session_slug):
# TODO vote processing - need to see what data looks like
self.scrape_bill_details_from_api(bill, url, session_slug)
else:
yield from self.parse_bill_details_from_html(bill, bill_id, chamber, page, primary_info)
yield from self.parse_bill_details_from_html(
bill, bill_id, chamber, page, primary_info
)

yield bill

Expand Down Expand Up @@ -182,8 +184,8 @@ def parse_bill_details_from_html(self, bill, bill_id, chamber, page, primary_inf
media_type="application/pdf",
)
for related in page.xpath(
'//b[text()="Related Documents "]/following-sibling::ul/li/'
'a[contains(@class,"nlink")]'
'//b[text()="Related Documents "]/following-sibling::ul/li/'
'a[contains(@class,"nlink")]'
):
href = related.xpath("@href")[0]
if ".fn.pdf" in href:
Expand Down Expand Up @@ -226,7 +228,9 @@ def scrape_bill_details_from_api(self, bill: Bill, bill_url, session_slug: str):
)
if data["floorSponsor"]:
floor_sponsor_name = data["floorSponsorName"]
floor_sponsor_name = floor_sponsor_name.replace("Sen. ", "").replace("Rep. ", "")
floor_sponsor_name = floor_sponsor_name.replace("Sen. ", "").replace(
"Rep. ", ""
)
floor_sponsor_chamber = SPONSOR_HOUSE_TO_CHAMBER[data["floorSponsorHouse"]]
bill.add_sponsorship(
floor_sponsor_name,
Expand Down Expand Up @@ -263,13 +267,13 @@ def scrape_bill_details_from_api(self, bill: Bill, bill_url, session_slug: str):
bill.add_version_link(
doc_data["shortDesc"],
f"https://le.utah.gov{doc_data['url']}",
media_type="text/xml"
media_type="text/xml",
)
pdf_filepath = doc_data['url'].replace(".xml", ".pdf")
pdf_filepath = doc_data["url"].replace(".xml", ".pdf")
bill.add_version_link(
doc_data["shortDesc"],
f"https://le.utah.gov{pdf_filepath}",
media_type="application/pdf"
media_type="application/pdf",
)

for subject in subjects:
Expand All @@ -288,9 +292,13 @@ def scrape_bill_details_from_api(self, bill: Bill, bill_url, session_slug: str):
elif "governor" in action_data["owner"].lower():
actor = "executive"
else:
self.error(f"Found unexpected actor {action_data['owner']} at {api_url}")
self.error(
f"Found unexpected actor {action_data['owner']} at {api_url}"
)

date = datetime.datetime.strptime(action_data["actionDate"], "%m/%d/%Y").date()
date = datetime.datetime.strptime(
action_data["actionDate"], "%m/%d/%Y"
).date()
date = date.strftime("%Y-%m-%d")

bill.add_action(
Expand Down

0 comments on commit 48a3242

Please sign in to comment.