Skip to content

Commit

Permalink
Fix param name to match the doc in SelectorList.xpath()
Browse files Browse the repository at this point in the history
  • Loading branch information
laggardkernel committed Jul 3, 2021
1 parent 80509e4 commit cba7a11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ Converting CSS to XPath

When you're using an API that only accepts XPath expressions, it's sometimes
useful to convert CSS to XPath. This allows you to take advantage of the
conciseness of CSS to query elements by classes and the easeness of
conciseness of CSS to query elements by classes and the easiness of
manipulating XPath expressions at the same time.

On those occasions, use the function :func:`~parsel.css2xpath`:
Expand Down
4 changes: 2 additions & 2 deletions parsel/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __getitem__(self, pos):
def __getstate__(self):
raise TypeError("can't pickle SelectorList objects")

def xpath(self, xpath, namespaces=None, **kwargs):
def xpath(self, query, namespaces=None, **kwargs):
"""
Call the ``.xpath()`` method for each element in this list and return
their results flattened as another :class:`SelectorList`.
Expand All @@ -90,7 +90,7 @@ def xpath(self, xpath, namespaces=None, **kwargs):
selector.xpath('//a[href=$url]', url="http://www.example.com")
"""
return self.__class__(flatten([x.xpath(xpath, namespaces=namespaces, **kwargs) for x in self]))
return self.__class__(flatten([x.xpath(query, namespaces=namespaces, **kwargs) for x in self]))

def css(self, query):
"""
Expand Down

0 comments on commit cba7a11

Please sign in to comment.