Ruff fix x3 final fix

pull/1389/head
墨梓柒 2025-11-29 14:43:22 +08:00
parent 163d527f3c
commit ed68f969c1
No known key found for this signature in database
GPG Key ID: 4A65B9DBA35F7635
4 changed files with 7 additions and 7 deletions

View File

@ -97,7 +97,7 @@ def _compute_weights(population: List[Dict]) -> List[float]:
# 如果checked权重乘以3 # 如果checked权重乘以3
weights = [] weights = []
for base_weight, checked in zip(base_weights, checked_flags): for base_weight, checked in zip(base_weights, checked_flags, strict=False):
if checked: if checked:
weights.append(base_weight * 3.0) weights.append(base_weight * 3.0)
else: else:

View File

@ -83,7 +83,7 @@ class ExpressionReflector:
try: try:
logger.info("[Expression Reflection] 查询未检查且未拒绝的表达") logger.info("[Expression Reflection] 查询未检查且未拒绝的表达")
expressions = ( expressions = (
Expression.select().where((Expression.checked == False) & (Expression.rejected == False)).limit(50) Expression.select().where((~Expression.checked) & (~Expression.rejected)).limit(50)
) )
expr_list = list(expressions) expr_list = list(expressions)

View File

@ -128,7 +128,7 @@ class ExpressionSelector:
# 优化一次性查询所有相关chat_id的表达方式排除 rejected=1 的表达 # 优化一次性查询所有相关chat_id的表达方式排除 rejected=1 的表达
style_query = Expression.select().where( style_query = Expression.select().where(
(Expression.chat_id.in_(related_chat_ids)) & (Expression.rejected == False) (Expression.chat_id.in_(related_chat_ids)) & (~Expression.rejected)
) )
style_exprs = [ style_exprs = [

View File

@ -83,19 +83,19 @@ class ConfigField:
return self.input_type return self.input_type
# 根据 type 和 choices 自动推断 # 根据 type 和 choices 自动推断
if self.type == bool: if self.type is bool:
return "switch" return "switch"
elif self.type in (int, float): elif self.type in (int, float):
if self.min is not None and self.max is not None: if self.min is not None and self.max is not None:
return "slider" return "slider"
return "number" return "number"
elif self.type == str: elif self.type is str:
if self.choices: if self.choices:
return "select" return "select"
return "text" return "text"
elif self.type == list: elif self.type is list:
return "list" return "list"
elif self.type == dict: elif self.type is dict:
return "json" return "json"
else: else:
return "text" return "text"