[devscripts] 02/04: wrap-and-sort: Use operator.itemgetter instead of lambda
Benjamin Drung
bdrung at moszumanska.debian.org
Tue Jan 12 23:12:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
bdrung pushed a commit to branch master
in repository devscripts.
commit 75e26f138ee732cdc6d797bf82ab77cc85a338cd
Author: Benjamin Drung <bdrung at debian.org>
Date: Tue Jan 12 23:46:41 2016 +0100
wrap-and-sort: Use operator.itemgetter instead of lambda
pep8 complains about the lambda expression assignment for the key
sorting function. Use the operator.itemgetter() function to avoid
defining a simple function.
Signed-off-by: Benjamin Drung <bdrung at debian.org>
---
scripts/wrap-and-sort | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/wrap-and-sort b/scripts/wrap-and-sort
index f9e6e0e..c587c4d 100755
--- a/scripts/wrap-and-sort
+++ b/scripts/wrap-and-sort
@@ -16,6 +16,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
import glob
+import operator
import optparse
import os
import re
@@ -87,8 +88,7 @@ class WrapAndSortControl(Control):
if sort_paragraphs:
first = self.paragraphs[:1 + int(keep_first)]
sortable = self.paragraphs[1 + int(keep_first):]
- key = lambda x: x.get("Package")
- self.paragraphs = first + sorted(sortable, key=key)
+ self.paragraphs = first + sorted(sortable, key=operator.itemgetter("Package"))
def _wrap_field(self, control, entry, wrap_always, short_indent,
trailing_comma, sort=True):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list