scrapy / itemloaders

Library to populate items using XPath and CSS with a convenient API
BSD 3-Clause "New" or "Revised" License
44 stars 16 forks source link

*_{css,xpath} taking multiple selectors #63

Open wRAR opened 1 year ago

wRAR commented 1 year ago

When adding typing I've discovered some strange (to me) code which is covered by tests and is present since CSS/XPath were added in 2013. Quoting tests:

l.replace_css('name', ['p::text', 'div::text']) l.get_css(['p::text', 'div::text'])

Yet it was always documented that these functions take a "selector" in a form of "str".

Looks like we need to at least document this, as we will need to type these as Union[str, Iterable[str]]. We could remove it instead but I have no idea if it's used (I also have no idea about the actual use cases for this).

Gallaecio commented 1 year ago

We could deprecate it, and if no one complains and suggest a valid use case, eventually remove it.