mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
3782f29839
commit
ba2f5db4f0
@ -6,6 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
|
from itertools import izip_longest
|
||||||
from collections import namedtuple, OrderedDict
|
from collections import namedtuple, OrderedDict
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
@ -69,13 +70,16 @@ raw_options = (
|
|||||||
' worse overall performance when sending multiple small packets. It'
|
' worse overall performance when sending multiple small packets. It'
|
||||||
' prevents the TCP stack from aggregating multiple small TCP packets.',
|
' prevents the TCP stack from aggregating multiple small TCP packets.',
|
||||||
)
|
)
|
||||||
|
assert len(raw_options) % 4 == 0
|
||||||
|
|
||||||
options = []
|
options = []
|
||||||
|
|
||||||
i = 0
|
def grouper(n, iterable, fillvalue=None):
|
||||||
while i + 3 < len(raw_options):
|
"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
|
||||||
shortdoc, name, default, doc = raw_options[i:i+4]
|
args = [iter(iterable)] * n
|
||||||
i += 4
|
return izip_longest(*args, fillvalue=fillvalue)
|
||||||
|
|
||||||
|
for shortdoc, name, default, doc in grouper(4, raw_options):
|
||||||
choices = None
|
choices = None
|
||||||
if isinstance(default, Choices):
|
if isinstance(default, Choices):
|
||||||
choices = default
|
choices = default
|
||||||
|
Loading…
x
Reference in New Issue
Block a user