diff --git a/__init__.py b/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/app.py b/app.py index a5f67f2..0d99fa7 100644 --- a/app.py +++ b/app.py @@ -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 @@ -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) diff --git a/tests/unit/test_sample.py b/tests/unit/test_sample.py index 26a96e6..4b2d323 100644 --- a/tests/unit/test_sample.py +++ b/tests/unit/test_sample.py @@ -3,4 +3,4 @@ class TestSample(TestCase): def test_sample(self): - self.assertEqual(True, True) \ No newline at end of file + self.assertEqual(True, True) diff --git a/utils/creds.py b/utils/creds.py index 6f6d3a2..eebade7 100644 --- a/utils/creds.py +++ b/utils/creds.py @@ -1,6 +1,7 @@ -from dotenv import load_dotenv import os +from dotenv import load_dotenv + def get_mongo_credentials(): """ diff --git a/utils/mongo_base.py b/utils/mongo_base.py index ab3fe25..214993b 100644 --- a/utils/mongo_base.py +++ b/utils/mongo_base.py @@ -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: diff --git a/utils/mongo_utils.py b/utils/mongo_utils.py index 9dcb8e4..6421881 100644 --- a/utils/mongo_utils.py +++ b/utils/mongo_utils.py @@ -1,4 +1,5 @@ from datetime import datetime + from utils.mongo_base import MongoBase @@ -6,7 +7,7 @@ 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 @@ -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(