Skip to content

Commit

Permalink
refactor: use kwargs strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
Laerte committed May 4, 2023
1 parent d907f9e commit 7317ff1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scrapy/selector/unified.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@

from parsel import Selector as _ParselSelector

try:
from parsel.selector import _NOT_SET
except ImportError:
_NOT_SET = None

from scrapy.http import HtmlResponse, XmlResponse
from scrapy.utils.python import to_bytes
from scrapy.utils.trackref import object_ref

__all__ = ["Selector", "SelectorList"]

_NOT_SET = object()


def _st(response, st):
if st is None:
Expand Down Expand Up @@ -85,4 +82,8 @@ def __init__(self, response=None, text=None, type=None, root=_NOT_SET, **kwargs)
kwargs.setdefault("base_url", response.url)

self.response = response
super().__init__(text=text, type=st, root=root, **kwargs)

if root is not _NOT_SET:
kwargs["root"] = root

super().__init__(text=text, type=st, **kwargs)

0 comments on commit 7317ff1

Please sign in to comment.