Move the parse_range function to the only app that uses it, documents app

This commit is contained in:
Roberto Rosario
2015-04-07 16:06:04 -04:00
parent 9084c3c651
commit 87216eb444
3 changed files with 12 additions and 10 deletions
+10
View File
@@ -0,0 +1,10 @@
from __future__ import unicode_literals
def parse_range(astr):
# http://stackoverflow.com/questions/4248399/page-range-for-printing-algorithm
result = set()
for part in astr.split(','):
x = part.split('-')
result.update(range(int(x[0]), int(x[-1]) + 1))
return sorted(result)