Replace map/filter lambda with comprehensions
List comprehensions and generator expressions are considered to be more Pythonic (and usually more readable) than map and filter with lambda. This patch replaces four usages of [map|filter](lambda ...) with the appropriate list comprehension or generator expression. TrivialFix Change-Id: Ifda9030bb8aa196cb7a5977a57ef46dfefd70fa6
This commit is contained in:
committed by
Alexander Chadin
parent
c4888fee63
commit
d218e6f107
@@ -52,8 +52,8 @@ class AuthTokenMiddleware(auth_token.AuthProtocol):
|
||||
# The information whether the API call is being performed against the
|
||||
# public API is required for some other components. Saving it to the
|
||||
# WSGI environment is reasonable thereby.
|
||||
env['is_public_api'] = any(map(lambda pattern: re.match(pattern, path),
|
||||
self.public_api_routes))
|
||||
env['is_public_api'] = any(re.match(pattern, path)
|
||||
for pattern in self.public_api_routes)
|
||||
|
||||
if env['is_public_api']:
|
||||
return self._app(env, start_response)
|
||||
|
||||
Reference in New Issue
Block a user