@@ -119,25 +119,29 @@ def augment_quality(schemas, org_id_lists):
119
119
for prefix in org_id_lists :
120
120
quality = 0
121
121
quality_explained = {}
122
- for item in (prefix .get ('data' , {}).get ('availability' ) or []):
123
- value = availabilty_score .get (item )
124
- if value :
125
- quality += value
126
- quality_explained ["Availability: " + availabilty_names [item ]] = value
127
- else :
128
- print ('No availiablity type {}. Found in code {}' .format (item , prefix ['code' ]))
129
122
130
- if prefix ['data' ].get ('licenseStatus' ):
131
- quality += license_score [prefix ['data' ]['licenseStatus' ]]
132
- quality_explained ["License: " + license_names [prefix ['data' ]['licenseStatus' ]]] = license_score [prefix ['data' ]['licenseStatus' ]]
123
+ if prefix .get ("deprecated" ):
124
+ quality_explained ["Deprecated" ] = 0
125
+ else :
126
+ for item in (prefix .get ('data' , {}).get ('availability' ) or []):
127
+ value = availabilty_score .get (item )
128
+ if value :
129
+ quality += value
130
+ quality_explained ["Availability: " + availabilty_names [item ]] = value
131
+ else :
132
+ print ('No availiablity type {}. Found in code {}' .format (item , prefix ['code' ]))
133
+
134
+ if prefix ['data' ].get ('licenseStatus' ):
135
+ quality += license_score [prefix ['data' ]['licenseStatus' ]]
136
+ quality_explained ["License: " + license_names [prefix ['data' ]['licenseStatus' ]]] = license_score [prefix ['data' ]['licenseStatus' ]]
133
137
134
- if prefix .get ('listType' ):
135
- value = listtype_score .get (prefix ['listType' ])
136
- if value :
137
- quality += value
138
- quality_explained ["List type: " + listtype_names [prefix ['listType' ]]] = value
139
- else :
140
- print ('No licenseStatus for {}. Found in code {}' .format (prefix ['listType' ], prefix ['code' ]))
138
+ if prefix .get ('listType' ):
139
+ value = listtype_score .get (prefix ['listType' ])
140
+ if value :
141
+ quality += value
142
+ quality_explained ["List type: " + listtype_names [prefix ['listType' ]]] = value
143
+ else :
144
+ print ('No licenseStatus for {}. Found in code {}' .format (prefix ['listType' ], prefix ['code' ]))
141
145
142
146
prefix ['quality_explained' ] = quality_explained
143
147
prefix ['quality' ] = min (quality , 100 )
@@ -316,15 +320,18 @@ def filter_and_score_results(query,use_branch="main"):
316
320
317
321
all_results = {"suggested" : [],
318
322
"recommended" : [],
319
- "other" : []}
323
+ "other" : [],
324
+ "depreciated" : [],}
320
325
321
326
if not indexed :
322
327
return all_results
323
328
324
329
for num , value in enumerate (sorted (indexed .values (), key = lambda k : - (k ['relevance' ] * 100 + k ['quality' ]))):
325
330
add_titles (value )
326
331
327
- if (value ['relevance' ] >= RELEVANCE ["SUGGESTED_RELEVANCE_THRESHOLD" ]
332
+ if (value .get ("deprecated" )):
333
+ all_results ['depreciated' ].append (value )
334
+ elif (value ['relevance' ] >= RELEVANCE ["SUGGESTED_RELEVANCE_THRESHOLD" ]
328
335
and value ['quality' ] > RELEVANCE ["SUGGESTED_QUALITY_THRESHOLD" ]
329
336
and not all_results ['suggested' ] or (all_results ['suggested' ] and value ['relevance' ] == all_results ['suggested' ][0 ]['relevance' ])):
330
337
all_results ['suggested' ].append (value )
0 commit comments