From 9eab23744755fb52f36f5d72d57fd5ca73347bc1 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 17:35:12 +0000 Subject: [PATCH] style: format code with Black and isort This commit fixes the style issues introduced in 3159a90 according to the output from Black and isort. Details: None --- vanguard/order.py | 26 ++++++++++++-------------- vanguard/urls.py | 1 - 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/vanguard/order.py b/vanguard/order.py index ab3df03..67b5c2e 100644 --- a/vanguard/order.py +++ b/vanguard/order.py @@ -2,7 +2,8 @@ from enum import Enum from time import sleep -from playwright.sync_api import expect, TimeoutError as PlaywrightTimeoutError +from playwright.sync_api import TimeoutError as PlaywrightTimeoutError +from playwright.sync_api import expect from .session import VanguardSession from .urls import order_page @@ -142,7 +143,9 @@ def place_order( except PlaywrightTimeoutError: pass if order_type == "BUY": - buy_btn = self.session.page.wait_for_selector("xpath=//label/span[text()='Buy']") + buy_btn = self.session.page.wait_for_selector( + "xpath=//label/span[text()='Buy']" + ) buy_btn.click() elif order_type == "SELL": sell_btn = self.session.page.wait_for_selector( @@ -167,8 +170,7 @@ def place_order( ) return order_messages self.session.page.wait_for_selector( - "//label/span[text()='Limit']", - timeout=3000 + "//label/span[text()='Limit']", timeout=3000 ).click() elif price_type == "STOP": if duration not in ["DAY", "GOOD_TILL_CANCELLED"]: @@ -177,8 +179,7 @@ def place_order( ) return order_messages self.session.page.wait_for_selector( - "//label/span[text()='Stop']", - timeout=3000 + "//label/span[text()='Stop']", timeout=3000 ).click() elif price_type == "STOP_LIMIT": if duration not in ["DAY", "GOOD_TILL_CANCELLED"]: @@ -187,8 +188,7 @@ def place_order( ) return order_messages self.session.page.wait_for_selector( - "//label/span[text()='Stop Limit']", - timeout=3000 + "//label/span[text()='Stop Limit']", timeout=3000 ).click() if price_type in ["LIMIT", "STOP_LIMIT"]: self.session.page.fill("#limitPrice", str(limit_price)) @@ -223,10 +223,10 @@ def place_order( warning_items_locator = self.session.page.get_by_role("main") warning_items = warning_items_locator.locator("li").all() warning_text = {warning_header: []} - for i,item in enumerate(warning_items): + for i, item in enumerate(warning_items): if i == 0: - warning_text[warning_header].append(item.text_content()) - if warning_text[warning_header][i-1] != item.text_content(): + warning_text[warning_header].append(item.text_content()) + if warning_text[warning_header][i - 1] != item.text_content(): warning_text[warning_header].append(item.text_content()) order_messages["ORDER INVALID"] = warning_text return order_messages @@ -240,9 +240,7 @@ def place_order( pass if after_hours: try: - after_button = self.session.page.get_by_role( - "button", name="Continue" - ) + after_button = self.session.page.get_by_role("button", name="Continue") expect(after_button).to_be_visible(timeout=3000) after_button.click() except (AssertionError, PlaywrightTimeoutError): diff --git a/vanguard/urls.py b/vanguard/urls.py index 996dcdf..d807d2e 100644 --- a/vanguard/urls.py +++ b/vanguard/urls.py @@ -17,4 +17,3 @@ def holdings_page(): def order_page(): return "https://etfs-stocks.web.vanguard.com/c/trade/ticket" -