diff options
author | Shubham Saini <shubham6405@gmail.com> | 2019-08-05 08:32:33 +0000 |
---|---|---|
committer | Shubham Saini <shubham6405@gmail.com> | 2019-08-05 08:32:33 +0000 |
commit | 227b2d30a8675b44918f9d9ca89b24144a938215 (patch) | |
tree | 9f8e6a28724514b6fdf463a9ab2067a7ef309b72 /venv/lib/python3.7/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py | |
parent | 842a8cfbbbdb1f92889d892e4859dbd5d40c5be8 (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.py | 29 |
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 @@ | |||
1 | from __future__ import absolute_import, division, unicode_literals | ||
2 | |||
3 | from . import base | ||
4 | |||
5 | from collections import OrderedDict | ||
6 | |||
7 | |||
8 | def _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 | |||
19 | class 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 | ||