code linting
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -435,4 +435,3 @@ class AccessTracker:
|
||||
stats["credential_attempts"] = self.db.get_credential_attempts(limit=50)
|
||||
|
||||
return stats
|
||||
|
||||
|
||||
Reference in New Issue
Block a user