From 48a3242a854a64d854e752b02dfe33312a0d8234 Mon Sep 17 00:00:00 2001 From: Jesse Mortenson Date: Fri, 13 Dec 2024 19:26:43 -0600 Subject: [PATCH] UT: fix linting --- scrapers/ut/bills.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/scrapers/ut/bills.py b/scrapers/ut/bills.py index d883a93a61..9e541ac174 100644 --- a/scrapers/ut/bills.py +++ b/scrapers/ut/bills.py @@ -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 @@ -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: @@ -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, @@ -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: @@ -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(