Skip to content

Instantly share code, notes, and snippets.

@DMBuce
Created March 23, 2012 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DMBuce/2176074 to your computer and use it in GitHub Desktop.
Save DMBuce/2176074 to your computer and use it in GitHub Desktop.
[PATCH] Add --sort=score option to reflector
--- 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