-
-
Save merrillcook0/7a97c2d1939900dc67e83e362a5dbdaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _get_valid_attrs(item): | |
key_attrs = {'class', 'style'} | |
attrs = { | |
k: v if v != [] else '' for k, v in item.attrs.items() if k in key_attrs | |
} | |
for attr in key_attrs: | |
if attr not in attrs: | |
attrs[attr] = '' | |
return attrs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment