Skip to content

Commit

Permalink
style: add typing
Browse files Browse the repository at this point in the history
  • Loading branch information
alimghmi committed Oct 23, 2023
1 parent 2d76167 commit 888cdfb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scraper/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __init__(self, url, max_retries, backoff_factor) -> None:
self.url = url
self.request = Request(max_retries=max_retries, backoff_factor=backoff_factor)

def fetch(self, content=None) -> pd.DataFrame:
def fetch(self, content: str = None) -> pd.DataFrame:
logger.debug(f"Attempting to fetch content from {self.url}.")
if not content:
content = self.get_content()
Expand Down
10 changes: 5 additions & 5 deletions transformer/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def transform(self) -> pd.DataFrame:
logger.debug(f"\n{self.dataframe}")
return self.dataframe

def parse_date(self):
def parse_date(self) -> None:
try:
self.dataframe["Clearing Date"] = pd.to_datetime(
self.dataframe["Clearing Date"], format="%Y-%m-%d"
Expand All @@ -53,26 +53,26 @@ def parse_date(self):
logger.error(f"Failed to parse dates. Error: {e}")
raise

def add_timestamp(self):
def add_timestamp(self) -> None:
try:
self.dataframe["timestamp_created_utc"] = datetime.datetime.utcnow()
except Exception as e:
logger.error(f"Failed to add timestamps. Error: {e}")
raise

def rename_columns(self):
def rename_columns(self) -> None:
try:
self.dataframe.rename(columns=self.COLUMNS_NAME, inplace=True)
except Exception as e:
logger.error(f"Failed to rename columns. Error: {e}")
raise

def brakedown_instrument_name(self):
def brakedown_instrument_name(self) -> None:
try:
df_split = self.dataframe["Instrument Name"].str.split(
".", n=5, expand=True
)
print(df_split)
logger.debug(f"\n{df_split}")
df_split.columns = [
"Ticker",
"Tier",
Expand Down

0 comments on commit 888cdfb

Please sign in to comment.