public
Created

[PATCH] Add --sort=score option to reflector

  • Download Gist
Reflector.py.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
--- Reflector.py.orig 2012-03-23 17:33:39.317842672 -0500
+++ Reflector.py 2012-03-23 17:52:41.385672960 -0500
@@ -34,7 +34,8 @@
# Recognized list sort types and their descriptions.
SORT_TYPES = {'age': 'last server synchronization',
'rate': 'download rate',
- 'country': 'server\'s location'}
+ 'country': 'server\'s location',
+ 'score': 'MirrorStatus score'}
# Known repositories, i.e. those that should be on each mirror.
# Used to replace the "$repo" variable.
REPOSITORIES = [
@@ -159,6 +160,8 @@
mirrors = self.rate(mirrors)
elif by == 'country':
mirrors.sort(key=lambda m: m['country'])
+ if by == 'score':
+ mirrors.sort(key=lambda m: m['score'])
return mirrors

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.