ruff fix但指定了--unsafe-fixes
This commit is contained in:
@@ -154,7 +154,7 @@ def interactive_menu() -> None:
|
||||
total = len(expressions)
|
||||
|
||||
# Get unique chat_ids and their names
|
||||
chat_ids = list(set(expr.chat_id for expr in expressions))
|
||||
chat_ids = list({expr.chat_id for expr in expressions})
|
||||
chat_info = [(chat_id, get_chat_name(chat_id)) for chat_id in chat_ids]
|
||||
chat_info.sort(key=lambda x: x[1]) # Sort by chat name
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class LogIndex:
|
||||
text_indices.add(i)
|
||||
candidate_indices &= text_indices
|
||||
|
||||
self.filtered_indices = sorted(list(candidate_indices))
|
||||
self.filtered_indices = sorted(candidate_indices)
|
||||
return self.filtered_indices
|
||||
|
||||
def get_filtered_count(self):
|
||||
@@ -211,7 +211,7 @@ class LogFormatter:
|
||||
extras = []
|
||||
for key, value in log_entry.items():
|
||||
if key not in ("timestamp", "level", "logger_name", "event"):
|
||||
if isinstance(value, (dict, list)):
|
||||
if isinstance(value, dict | list):
|
||||
try:
|
||||
value_str = orjson.dumps(value).decode("utf-8")
|
||||
except (TypeError, ValueError):
|
||||
|
||||
@@ -370,7 +370,7 @@ class MongoToSQLiteMigrator:
|
||||
return datetime.now()
|
||||
|
||||
if field_type in ["CharField", "TextField"]:
|
||||
if isinstance(value, (list, dict)):
|
||||
if isinstance(value, list | dict):
|
||||
return orjson.dumps(value, ensure_ascii=False)
|
||||
return str(value) if value is not None else ""
|
||||
|
||||
@@ -392,7 +392,7 @@ class MongoToSQLiteMigrator:
|
||||
return bool(value)
|
||||
|
||||
elif field_type == "DateTimeField":
|
||||
if isinstance(value, (int, float)):
|
||||
if isinstance(value, int | float):
|
||||
return datetime.fromtimestamp(value)
|
||||
elif isinstance(value, str):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user