code linting

This commit is contained in:
Lorenzo Venerandi
2026-02-22 16:27:59 +01:00
parent 57fa0ae5a3
commit b500b22041
4 changed files with 7 additions and 14 deletions

View File

@@ -358,9 +358,7 @@ class DatabaseManager:
session = self.session
try:
sanitized_ip = sanitize_ip(ip)
ip_stats = (
session.query(IpStats).filter(IpStats.ip == sanitized_ip).first()
)
ip_stats = session.query(IpStats).filter(IpStats.ip == sanitized_ip).first()
if not ip_stats:
now = datetime.now()
@@ -406,9 +404,7 @@ class DatabaseManager:
session = self.session
try:
sanitized_ip = sanitize_ip(ip)
ip_stats = (
session.query(IpStats).filter(IpStats.ip == sanitized_ip).first()
)
ip_stats = session.query(IpStats).filter(IpStats.ip == sanitized_ip).first()
if not ip_stats or ip_stats.ban_timestamp is None:
return False
@@ -445,9 +441,7 @@ class DatabaseManager:
session = self.session
try:
sanitized_ip = sanitize_ip(ip)
ip_stats = (
session.query(IpStats).filter(IpStats.ip == sanitized_ip).first()
)
ip_stats = session.query(IpStats).filter(IpStats.ip == sanitized_ip).first()
if not ip_stats:
return {

View File

@@ -59,9 +59,7 @@ def _migrate_ban_state_columns(cursor) -> List[str]:
}
for col_name, col_type in columns.items():
if not _column_exists(cursor, "ip_stats", col_name):
cursor.execute(
f"ALTER TABLE ip_stats ADD COLUMN {col_name} {col_type}"
)
cursor.execute(f"ALTER TABLE ip_stats ADD COLUMN {col_name} {col_type}")
added.append(col_name)
return added

View File

@@ -98,7 +98,9 @@ def main():
ips_to_analyze = set(db_manager.get_ips_needing_reevaluation())
if not ips_to_analyze:
app_logger.debug("[Background Task] analyze-ips: No IPs need reevaluation, skipping")
app_logger.debug(
"[Background Task] analyze-ips: No IPs need reevaluation, skipping"
)
return
for ip in ips_to_analyze:

View File

@@ -435,4 +435,3 @@ class AccessTracker:
stats["credential_attempts"] = self.db.get_credential_attempts(limit=50)
return stats