Skip to content

Commit

Permalink
ruff check/format
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBoi9001 committed Jan 10, 2025
1 parent b8e0fd8 commit bdfd1e9
Show file tree
Hide file tree
Showing 14 changed files with 360 additions and 310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@

logger = logging.getLogger(__name__)


def migrate_up(conn: Optional[psycopg2.extensions.connection] = None) -> None:
"""Create the poi_notifications table."""

up_sql = """
CREATE TABLE IF NOT EXISTS poi_notifications (
id SERIAL PRIMARY KEY,
Expand All @@ -20,7 +21,7 @@ def migrate_up(conn: Optional[psycopg2.extensions.connection] = None) -> None:
CREATE INDEX IF NOT EXISTS idx_poi_notifications_sent_at
ON poi_notifications(sent_at);
"""

try:
with conn.cursor() as cur:
cur.execute(up_sql)
Expand All @@ -31,13 +32,14 @@ def migrate_up(conn: Optional[psycopg2.extensions.connection] = None) -> None:
logger.error(f"Failed to create poi_notifications table: {str(e)}")
raise


def migrate_down(conn: Optional[psycopg2.extensions.connection] = None) -> None:
"""Remove the poi_notifications table."""

down_sql = """
DROP TABLE IF EXISTS poi_notifications;
"""

try:
with conn.cursor() as cur:
cur.execute(down_sql)
Expand All @@ -46,4 +48,4 @@ def migrate_down(conn: Optional[psycopg2.extensions.connection] = None) -> None:
except Exception as e:
conn.rollback()
logger.error(f"Failed to drop poi_notifications table: {str(e)}")
raise
raise
3 changes: 2 additions & 1 deletion services/poi_monitor/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pytest==8.0.0
pytest-cov==4.1.0
pytest-mock==3.12.0
pytest-mock==3.12.0
ruff==0.3.0
2 changes: 1 addition & 1 deletion services/poi_monitor/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"pyyaml",
"python-json-logger",
],
)
)
2 changes: 1 addition & 1 deletion services/poi_monitor/src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
from .monitor import main

__version__ = "0.1.0"
__all__ = ['PoiAnalyzer', 'Database', 'SlackNotifier', 'main']
__all__ = ["PoiAnalyzer", "Database", "SlackNotifier", "main"]
Loading

0 comments on commit bdfd1e9

Please sign in to comment.