linted code

This commit is contained in:
Lorenzo Venerandi
2026-03-09 14:57:56 +01:00
parent 6e575c10eb
commit e814f1232a

View File

@@ -2380,7 +2380,10 @@ class DatabaseManager:
session = self.session session = self.session
sanitized_ip = sanitize_ip(ip) sanitized_ip = sanitize_ip(ip)
try: try:
return session.query(TrackedIp).filter(TrackedIp.ip == sanitized_ip).first() is not None return (
session.query(TrackedIp).filter(TrackedIp.ip == sanitized_ip).first()
is not None
)
finally: finally:
self.close_session() self.close_session()
@@ -2405,15 +2408,19 @@ class DatabaseManager:
items = [] items = []
for t in tracked_rows: for t in tracked_rows:
items.append({ items.append(
"ip": t.ip, {
"tracked_since": t.tracked_since.isoformat() if t.tracked_since else None, "ip": t.ip,
"category": t.category, "tracked_since": (
"total_requests": t.total_requests or 0, t.tracked_since.isoformat() if t.tracked_since else None
"country_code": t.country_code, ),
"city": t.city, "category": t.category,
"last_seen": t.last_seen.isoformat() if t.last_seen else None, "total_requests": t.total_requests or 0,
}) "country_code": t.country_code,
"city": t.city,
"last_seen": t.last_seen.isoformat() if t.last_seen else None,
}
)
return { return {
"tracked_ips": items, "tracked_ips": items,