summaryrefslogtreecommitdiff
path: root/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py
diff options
context:
space:
mode:
authorShubham Saini <shubham6405@gmail.com>2019-08-05 08:32:33 +0000
committerShubham Saini <shubham6405@gmail.com>2019-08-05 08:32:33 +0000
commit227b2d30a8675b44918f9d9ca89b24144a938215 (patch)
tree9f8e6a28724514b6fdf463a9ab2067a7ef309b72 /venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py
parent842a8cfbbbdb1f92889d892e4859dbd5d40c5be8 (diff)
removing venv files
Diffstat (limited to 'venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py')
-rw-r--r--venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py29
1 files changed, 0 insertions, 29 deletions
diff --git a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py b/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py
deleted file mode 100644
index d9e234a..0000000
--- a/venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py
+++ /dev/null
@@ -1,29 +0,0 @@
1from __future__ import absolute_import, division, unicode_literals
2
3from . import base
4
5from collections import OrderedDict
6
7
8def _attr_key(attr):
9 """Return an appropriate key for an attribute for sorting
10
11 Attributes have a namespace that can be either ``None`` or a string. We
12 can't compare the two because they're different types, so we convert
13 ``None`` to an empty string first.
14
15 """
16 return (attr[0][0] or ''), attr[0][1]
17
18
19class Filter(base.Filter):
20 """Alphabetizes attributes for elements"""
21 def __iter__(self):
22 for token in base.Filter.__iter__(self):
23 if token["type"] in ("StartTag", "EmptyTag"):
24 attrs = OrderedDict()
25 for name, value in sorted(token["data"].items(),
26 key=_attr_key):
27 attrs[name] = value
28 token["data"] = attrs
29 yield token