Skip to content

Commit

Permalink
Use all instead of reduce (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed May 7, 2020
1 parent 049d149 commit 2da2133
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions baseframe/views.py
Expand Up @@ -3,7 +3,6 @@
from six.moves.urllib.parse import urljoin, urlparse

from datetime import timedelta
from functools import reduce
import os

from flask import abort, current_app, render_template, request, send_from_directory
Expand Down Expand Up @@ -58,9 +57,8 @@ def gen_assets_url(assets):
except ValueError:
abort(400)

# TODO: replace reduce() with something simpler
is_js = reduce(lambda status, name: status and name.endswith('.js'), names, True)
is_css = reduce(lambda status, name: status and name.endswith('.css'), names, True)
is_js = all(name.endswith('.js') for name in names)
is_css = all(name.endswith('.css') for name in names)
output_name = asset_key(assets)
gendir = os.path.join(current_app.static_folder, 'gen')
if not os.path.exists(gendir):
Expand Down

0 comments on commit 2da2133

Please sign in to comment.