There were multiple issues identified with the code of SelectorList itself, Selector.selectorlist_cls and their typing. Ideally:
SelectorList should only be able to contain Selector objects
SelectorList subclasses made to work with Selector subclasses should only able to contain those
Selector subclasses shouldn't need to set selectorlist_cls to a respective SelectorList subclass manually
all of this should be properly typed without need for casts and other overrides
This may require changing Selector and/or SelectorList base classes, but I think we will need to keep the API compatibility? It's also non-trivial because the API for subclassing them doesn't seem to be documented, the only reference is SelectorTestCase.test_extending_selector() (the related code was also changed when adding typing, not sure if it changed the interface).
There were multiple issues identified with the code of
SelectorList
itself,Selector.selectorlist_cls
and their typing. Ideally:SelectorList
should only be able to containSelector
objectsSelectorList
subclasses made to work withSelector
subclasses should only able to contain thoseSelector
subclasses shouldn't need to setselectorlist_cls
to a respectiveSelectorList
subclass manuallyThis may require changing
Selector
and/orSelectorList
base classes, but I think we will need to keep the API compatibility? It's also non-trivial because the API for subclassing them doesn't seem to be documented, the only reference isSelectorTestCase.test_extending_selector()
(the related code was also changed when adding typing, not sure if it changed the interface).