Merge pull request #219 from dezren39/patch-1

Resolve 3 typos in util.py
This commit is contained in:
Nick Sweeting 2019-04-20 14:15:29 -04:00 committed by GitHub
commit 6eff6f43c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,7 +66,7 @@ HTML_TITLE_REGEX = re.compile(
re.IGNORECASE | re.MULTILINE | re.DOTALL | re.UNICODE, re.IGNORECASE | re.MULTILINE | re.DOTALL | re.UNICODE,
) )
STATICFILE_EXTENSIONS = { STATICFILE_EXTENSIONS = {
# 99.999% of the time, URLs ending in these extentions are static files # 99.999% of the time, URLs ending in these extensions are static files
# that can be downloaded as-is, not html pages that need to be rendered # that can be downloaded as-is, not html pages that need to be rendered
'gif', 'jpeg', 'jpg', 'png', 'tif', 'tiff', 'wbmp', 'ico', 'jng', 'bmp', 'gif', 'jpeg', 'jpg', 'png', 'tif', 'tiff', 'wbmp', 'ico', 'jng', 'bmp',
'svg', 'svgz', 'webp', 'ps', 'eps', 'ai', 'svg', 'svgz', 'webp', 'ps', 'eps', 'ai',
@ -82,7 +82,7 @@ STATICFILE_EXTENSIONS = {
# pl pm, prc pdb, rar, rpm, sea, sit, tcl tk, der, pem, crt, xpi, xspf, # pl pm, prc pdb, rar, rpm, sea, sit, tcl tk, der, pem, crt, xpi, xspf,
# ra, mng, asx, asf, 3gpp, 3gp, mid, midi, kar, jad, wml, htc, mml # ra, mng, asx, asf, 3gpp, 3gp, mid, midi, kar, jad, wml, htc, mml
# Thse are always treated as pages, not as static files, never add them: # These are always treated as pages, not as static files, never add them:
# html, htm, shtml, xhtml, xml, aspx, php, cgi # html, htm, shtml, xhtml, xml, aspx, php, cgi
} }
@ -293,7 +293,7 @@ def str_between(string, start, end=None):
### Link Helpers ### Link Helpers
def merge_links(a, b): def merge_links(a, b):
"""deterministially merge two links, favoring longer field values over shorter, """deterministically merge two links, favoring longer field values over shorter,
and "cleaner" values over worse ones. and "cleaner" values over worse ones.
""" """
longer = lambda key: (a[key] if len(a[key]) > len(b[key]) else b[key]) if (a[key] and b[key]) else (a[key] or b[key]) longer = lambda key: (a[key] if len(a[key]) > len(b[key]) else b[key]) if (a[key] and b[key]) else (a[key] or b[key])