MCPcopy Index your code
hub / github.com/tickmao/Novel / sort_by_score

Method sort_by_score

scripts/source_selector.py:112–128  ·  view source on GitHub ↗

按评分排序 Args: sources: 书源列表 Returns: 排序后的书源列表

(self, sources: List[Dict])

Source from the content-addressed store, hash-verified

110 return score
111
112 def sort_by_score(self, sources: List[Dict]) -> List[Dict]:
113 """
114 按评分排序
115
116 Args:
117 sources: 书源列表
118
119 Returns:
120 排序后的书源列表
121 """
122 # 计算评分
123 for source in sources:
124 if 'score' not in source:
125 source['score'] = self.calculate_score(source)
126
127 # 按评分降序排序
128 return sorted(sources, key=lambda s: s.get('score', 0), reverse=True)
129
130 def select_with_domain_diversity(
131 self,

Callers 1

selectMethod · 0.95

Calls 1

calculate_scoreMethod · 0.95

Tested by

no test coverage detected