Closed Leyard closed 3 years ago
Yup, this is a bug. I have a fix in #217. I'm not quite sure why I was using kwargs
for this. I absolutely don't need it, especially if it can conflict with self
.
After the fix your example script runs fine:
$soupsieve git:(master) ✗ python3 bug.py
[<identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>, <identifier scheme="http://www.sec.gov/CIK">0001031235</identifier>]
Thanks for the bug report! I've tagged a new release 2.2.1. It should be available shortly.
I was using bs4/soupsieve to parse some xml files from SEC websites. Here is my MWE
It worked smoothly until I got a weird
TypeError
when I used the CSS selectorIt turned out this specific xml file contains namespaces with the key "self", which caused the
TypeError
when you unpacked the namespaces as keyword parameters in line 47 ofsoupsieve/__init__.py
Not sure if this counts as a bug of soupsieve, or should I handle this issue on my side. Feel free to suggest a solution for me.