Skip to content

Commit

Permalink
style: reformat code with black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
alimghmi committed Jan 29, 2024
1 parent eebea7b commit e7e89ef
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion blob/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(
):
self.file_exts = self.__parse_file_exts(file_exts)
self.container_name = container_name
self.cnx_string = f"DefaultEndpointsProtocol=https;AccountName={account_name};AccountKey={account_key};EndpointSuffix=core.windows.net"
self.cnx_string = f"DefaultEndpointsProtocol=https;AccountName={account_name};AccountKey={account_key};EndpointSuffix=core.windows.net" # noqa: E501
self.__init_cnx()

def fetch(self) -> list:
Expand Down
2 changes: 1 addition & 1 deletion database/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .connection.mssql import MSSQLDatabaseConnection
from .inserter.pandas import PandasSQLDataInserter
from .inserter.pandas import PandasSQLDataInserter
2 changes: 1 addition & 1 deletion database/connection/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def disconnect(self):
"""Close the connection."""
if self.engine:
self.engine.dispose()
self.engine = None
self.engine = None
2 changes: 1 addition & 1 deletion database/connection/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ def __init__(
f"mssql+pyodbc://{username}:{password}@"
f"{server}/{database}?driver=ODBC+Driver+17+for+SQL+Server"
)
super().__init__(cnx_string)
super().__init__(cnx_string)
2 changes: 1 addition & 1 deletion database/inserter/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def __init__(self, db_connection: DatabaseConnection):
self.db_connection = db_connection

def insert(self, df: pd.DataFrame, table_name: str):
raise NotImplementedError("Subclasses must implement this method.")
raise NotImplementedError("Subclasses must implement this method.")
2 changes: 1 addition & 1 deletion database/inserter/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ def delete_rows(self, table_name: str) -> None:
connection.rollback()
finally:
connection.close()
cursor.close()
cursor.close()
1 change: 0 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from blob import Client
from config import logger, settings

from transformer import Agent
from utils import create_inserter_objects

Expand Down
9 changes: 4 additions & 5 deletions transformer/agent.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime

import pandas as pd
import numpy as np
import pandas as pd

from config import logger

Expand All @@ -20,21 +20,20 @@ def transform(self) -> pd.DataFrame:
logger.info("Data transformation completed successfully.")
logger.debug(f"\n{self.dataframe}")
return self.dataframe

def parse_files(self) -> None:
try:
for path in self.files:
folder, file = path.split("/")
isin = file.split("_")[-1].split(".")[0]

if isin not in self.files_per_isin:
self.files_per_isin[isin] = {}

self.files_per_isin[isin][folder] = path
except Exception as e:
logger.error(f"Failed to parse the files list. Error: {e}")
raise


def init_df(self) -> None:
try:
Expand Down

0 comments on commit e7e89ef

Please sign in to comment.