MCPcopy Create free account
hub / github.com/kurtmckee/feedparser / normalize_attrs

Method normalize_attrs

feedparser/html.py:160–177  ·  view source on GitHub ↗

:type attrs: List[Tuple[str, str]] :rtype: List[Tuple[str, str]]

(attrs)

Source from the content-addressed store, hash-verified

158
159 @staticmethod
160 def normalize_attrs(attrs):
161 """
162 :type attrs: List[Tuple[str, str]]
163 :rtype: List[Tuple[str, str]]
164 """
165
166 if not attrs:
167 return attrs
168 # utility method to be called by descendants
169 # Collapse any duplicate attribute names and values by converting
170 # *attrs* into a dictionary, then convert it back to a list.
171 attrs_d = {k.lower(): v for k, v in attrs}
172 attrs = [
173 (k, k in ('rel', 'type') and v.lower() or v)
174 for k, v in attrs_d.items()
175 ]
176 attrs.sort()
177 return attrs
178
179 def unknown_starttag(self, tag, attrs):
180 """

Callers 2

unknown_starttagMethod · 0.80
unknown_starttagMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected