From acc15b86e775257edcfabbb00b13dde3b035e820 Mon Sep 17 00:00:00 2001 From: Minki Kim <68267535+mingi3314@users.noreply.github.com> Date: Sun, 18 Feb 2024 23:33:25 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=91=E2=80=8D=F0=9F=92=BB=20linting=20?= =?UTF-8?q?=EC=9C=84=EB=B0=98=EC=82=AC=ED=95=AD=20=EC=88=98=EC=A0=95=20(#8?= =?UTF-8?q?4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyrb/controllers/api/main.py | 4 ++-- pyrb/repositories/brokerages/base/fetcher.py | 2 -- pyrb/repositories/brokerages/base/order_manager.py | 2 -- pyrb/repositories/brokerages/base/portfolio.py | 2 -- pyrb/repositories/brokerages/ebest/client.py | 4 ++-- pyrb/repositories/brokerages/ebest/order_manager.py | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/pyrb/controllers/api/main.py b/pyrb/controllers/api/main.py index dcccba0..88a2099 100644 --- a/pyrb/controllers/api/main.py +++ b/pyrb/controllers/api/main.py @@ -16,7 +16,7 @@ class AccountResponse(BaseModel): async def get_default_account(account_service: AccountServiceDep) -> AccountResponse: try: account = account_service.get() - except InitializationError: - raise HTTPException(status_code=404, detail="No accounts registered") + except InitializationError as e: + raise HTTPException(status_code=404, detail="No accounts registered") from e return AccountResponse(account=account) diff --git a/pyrb/repositories/brokerages/base/fetcher.py b/pyrb/repositories/brokerages/base/fetcher.py index 99dceaa..a92282e 100644 --- a/pyrb/repositories/brokerages/base/fetcher.py +++ b/pyrb/repositories/brokerages/base/fetcher.py @@ -6,8 +6,6 @@ class PriceFetcher(abc.ABC): - def __init__(self) -> None: ... - @abc.abstractmethod def get_current_price(self, symbol: str) -> CurrentPrice: """특정 종목의 현재가를 조회합니다. diff --git a/pyrb/repositories/brokerages/base/order_manager.py b/pyrb/repositories/brokerages/base/order_manager.py index a76ebaa..0bab73c 100644 --- a/pyrb/repositories/brokerages/base/order_manager.py +++ b/pyrb/repositories/brokerages/base/order_manager.py @@ -4,8 +4,6 @@ class OrderManager(abc.ABC): - def __init__(self) -> None: ... - @abc.abstractmethod def place_order(self, order: Order) -> None: """ diff --git a/pyrb/repositories/brokerages/base/portfolio.py b/pyrb/repositories/brokerages/base/portfolio.py index 25c6ec9..ab436f6 100644 --- a/pyrb/repositories/brokerages/base/portfolio.py +++ b/pyrb/repositories/brokerages/base/portfolio.py @@ -6,8 +6,6 @@ class Portfolio(abc.ABC): - def __init__(self) -> None: ... - @property @abc.abstractmethod def total_value(self) -> NonNegativeFloat: diff --git a/pyrb/repositories/brokerages/ebest/client.py b/pyrb/repositories/brokerages/ebest/client.py index 9fcb710..7681865 100644 --- a/pyrb/repositories/brokerages/ebest/client.py +++ b/pyrb/repositories/brokerages/ebest/client.py @@ -57,9 +57,9 @@ def _issue_access_token(self) -> str: def _raise_for_status(self, response: Response) -> None: try: response.raise_for_status() - except requests.HTTPError: + except requests.HTTPError as e: # error_code = response.json()["rsp_cd"] # error_msg = response.json()["rsp_msg"] status_code = response.status_code print(response) - raise Exception(f"API client error: {status_code}, {response}") + raise Exception(f"API client error: {status_code}, {response}") from e diff --git a/pyrb/repositories/brokerages/ebest/order_manager.py b/pyrb/repositories/brokerages/ebest/order_manager.py index 20bc321..02d9123 100644 --- a/pyrb/repositories/brokerages/ebest/order_manager.py +++ b/pyrb/repositories/brokerages/ebest/order_manager.py @@ -45,4 +45,4 @@ def place_order(self, order: Order) -> None: if resp.get("rsp_cd") != "00040": raise OrderPlacementError(resp) except HTTPError as e: - raise OrderPlacementError(e) + raise OrderPlacementError(e) from e