Created
March 23, 2012 22:56
-
-
Save DMBuce/2176074 to your computer and use it in GitHub Desktop.
[PATCH] Add --sort=score option to reflector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- 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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment