From 6ff258799df5c125f5c3ccc92c4692cca9220eb2 Mon Sep 17 00:00:00 2001 From: Redume Date: Mon, 16 Dec 2024 22:24:26 +0300 Subject: [PATCH] chore(chart): I put pylint ignore where it's needed. Fixed an error with arguments, paths of imports of local modules --- chart/routes/get_chart.py | 21 ++++++--------------- chart/routes/get_chart_period.py | 1 + chart/utils/load_config.py | 3 +-- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/chart/routes/get_chart.py b/chart/routes/get_chart.py index 268fd37..e1009ad 100644 --- a/chart/routes/get_chart.py +++ b/chart/routes/get_chart.py @@ -3,31 +3,22 @@ This module contains the route for retrieving a chart based on a given currency It defines the `/api/getChart/` endpoint that processes requests for generating charts. """ from fastapi import APIRouter, status, Request, Response -from pydantic import BaseModel from function.create_chart import create_chart from .get_chart_period import prepare_chart_response +# pylint: disable=duplicate-code router = APIRouter() -class ChartRequestParams(BaseModel): - """ - A Pydantic model that represents the request parameters for generating a chart. - This model is used to validate and group the request parameters: from_currency, conv_currency, start_date, and end_date. - """ - from_currency: str - conv_currency: str - start_date: str - end_date: str - +# pylint: disable=too-many-arguments, too-many-positional-arguments @router.get("/api/getChart/", status_code=status.HTTP_201_CREATED) async def get_chart( response: Response, request: Request, - from_currency: str, - conv_currency: str, - start_date: str, - end_date: str + from_currency: str = None, + conv_currency: str = None, + start_date: str = None, + end_date: str = None, ): """ Fetches a chart for a given currency pair and date range. diff --git a/chart/routes/get_chart_period.py b/chart/routes/get_chart_period.py index c15a72f..265364e 100644 --- a/chart/routes/get_chart_period.py +++ b/chart/routes/get_chart_period.py @@ -12,6 +12,7 @@ from fastapi import APIRouter, status, Request, Response from function.create_chart import create_chart +# pylint: disable=duplicate-code router = APIRouter() @router.get("/api/getChart/{period}", status_code=status.HTTP_201_CREATED) diff --git a/chart/utils/load_config.py b/chart/utils/load_config.py index 0cca814..c6f2bbd 100644 --- a/chart/utils/load_config.py +++ b/chart/utils/load_config.py @@ -1,3 +1,4 @@ +# pylint: disable=R0801 """ This module provides a function for loading a YAML configuration file. The function reads the file content and returns it as a Python dictionary. @@ -17,5 +18,3 @@ def load_config(file_path: str) -> dict: """ with open(file_path, 'r', encoding='utf-8') as file: return yaml.safe_load(file) - -config = load_config('config.yaml')