Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f871d83

Browse files
committed
Remove some lambdas.
1 parent a617271 commit f871d83

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/cgi.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
# Imports
3535
# =======
3636

37+
from operator import attrgetter
3738
import sys
3839
import os
3940
import urllib
@@ -331,7 +332,7 @@ def parse_header(line):
331332
Return the main content-type and a dictionary of options.
332333
333334
"""
334-
plist = map(lambda x: x.strip(), line.split(';'))
335+
plist = [x.strip() for x in line.split(';')]
335336
key = plist.pop(0).lower()
336337
pdict = {}
337338
for p in plist:
@@ -570,7 +571,7 @@ def getvalue(self, key, default=None):
570571
if key in self:
571572
value = self[key]
572573
if type(value) is type([]):
573-
return map(lambda v: v.value, value)
574+
return map(attrgetter('value'), value)
574575
else:
575576
return value.value
576577
else:
@@ -592,7 +593,7 @@ def getlist(self, key):
592593
if key in self:
593594
value = self[key]
594595
if type(value) is type([]):
595-
return map(lambda v: v.value, value)
596+
return map(attrgetter('value'), value)
596597
else:
597598
return [value.value]
598599
else:

0 commit comments

Comments
 (0)