Skip to content

Commit

Permalink
fix: linter issues!
Browse files Browse the repository at this point in the history
  • Loading branch information
amindadgar committed Feb 28, 2024
1 parent 3d64764 commit 73dc718
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
Empty file removed __init__.py
Empty file.
11 changes: 3 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import logging
from datetime import datetime
from pandas.api.types import (
is_categorical_dtype,
is_datetime64_any_dtype,
is_numeric_dtype,
is_object_dtype,
)

import pandas as pd
import streamlit as st
import logging

from utils.mongo import MongoSingleton
from utils.process_guild_data import process_guild_data
Expand Down Expand Up @@ -43,6 +38,6 @@ def load_guilds_latest_date_df():
logging.basicConfig(level=logging.INFO)

st.subheader("MongoDB data Analytics")
df = load_guilds_latest_date_df()
load_guilds_latest_date_df()
# df = process_df(df)
# st.dataframe(df, use_container_width=True, hide_index=True)
2 changes: 1 addition & 1 deletion tests/unit/test_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

class TestSample(TestCase):
def test_sample(self):
self.assertEqual(True, True)
self.assertEqual(True, True)
3 changes: 2 additions & 1 deletion utils/creds.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dotenv import load_dotenv
import os

from dotenv import load_dotenv


def get_mongo_credentials():
"""
Expand Down
1 change: 0 additions & 1 deletion utils/mongo_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def get_guild_members_count(self) -> int:
def get_latest_document(
self, db_name: str, collection_name: str, date_field: str, **kwargs
) -> dict[str, Any]:

filters = kwargs.get("filters", None)
client = MongoSingleton.get_instance().client
if filters is None:
Expand Down
9 changes: 5 additions & 4 deletions utils/mongo_utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from datetime import datetime

from utils.mongo_base import MongoBase


class MongoUtils(MongoBase):
def __init__(self, guild_id: str) -> None:
super().__init__(guild_id)

def get_latest_discord_raw_info_date(self) -> datetime:
def get_latest_discord_raw_info_date(self) -> datetime | None:
date_field = "createdDate"
latest_document = self.get_latest_document(
db_name=self.guild_id, collection_name="rawinfos", date_field=date_field
Expand All @@ -20,18 +21,18 @@ def get_latest_memberactivities_date(self) -> str:
collection_name="memberactivities",
date_field=date_field,
)
return self.get_latest_date(latest_document, date_field)
return self.get_latest_date(latest_document, date_field) # type: ignore

def get_latest_heatmaps_date(self) -> str:
date_field = "date"
latest_document = self.get_latest_document(
db_name=self.guild_id, collection_name="heatmaps", date_field=date_field
)
return self.get_latest_date(latest_document, date_field)
return self.get_latest_date(latest_document, date_field) # type: ignore

def get_latest_fired_saga(
self, guild_id: str | None = None, platform_id: str | None = None
) -> datetime:
) -> datetime | None:
date_field = "createdAt"
if platform_id:
latest_document = self.get_latest_document(
Expand Down

0 comments on commit 73dc718

Please sign in to comment.