mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Update bleach-4.1.0
This commit is contained in:
parent
4086529906
commit
a4130d6c56
51 changed files with 17071 additions and 568 deletions
21
lib/bleach/utils.py
Normal file
21
lib/bleach/utils.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from collections import OrderedDict
|
||||
|
||||
|
||||
def _attr_key(attr):
|
||||
"""Returns appropriate key for sorting attribute names
|
||||
|
||||
Attribute names are a tuple of ``(namespace, name)`` where namespace can be
|
||||
``None`` or a string. These can't be compared in Python 3, so we conver the
|
||||
``None`` to an empty string.
|
||||
|
||||
"""
|
||||
key = (attr[0][0] or ""), attr[0][1]
|
||||
return key
|
||||
|
||||
|
||||
def alphabetize_attributes(attrs):
|
||||
"""Takes a dict of attributes (or None) and returns them alphabetized"""
|
||||
if not attrs:
|
||||
return attrs
|
||||
|
||||
return OrderedDict([(k, v) for k, v in sorted(attrs.items(), key=_attr_key)])
|
Loading…
Add table
Add a link
Reference in a new issue