Skip to content

Commit

Permalink
Merge pull request #157 from lufte/lgtm-issues
Browse files Browse the repository at this point in the history
LGTM issues
  • Loading branch information
kmike committed Oct 16, 2019
2 parents ec00965 + ca33b5a commit bcfa589
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion parsel/csstranslator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from cssselect import HTMLTranslator as OriginalHTMLTranslator
from cssselect.xpath import XPathExpr as OriginalXPathExpr
from cssselect.xpath import _unicode_safe_getattr, ExpressionError
from cssselect.parser import parse, FunctionalPseudoElement
from cssselect.parser import FunctionalPseudoElement


class XPathExpr(OriginalXPathExpr):
Expand Down
11 changes: 4 additions & 7 deletions parsel/selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def re_first(self, regex, default=None, replace_entities=True):
"""
for el in iflatten(x.re(regex, replace_entities=replace_entities) for x in self):
return el
else:
return default
return default

def getall(self):
"""
Expand All @@ -144,8 +143,7 @@ def get(self, default=None):
"""
for x in self:
return x.get()
else:
return default
return default
extract_first = get

@property
Expand All @@ -155,8 +153,7 @@ def attrib(self):
"""
for x in self:
return x.attrib
else:
return {}
return {}

def remove(self):
"""
Expand Down Expand Up @@ -273,7 +270,7 @@ def css(self, query):
In the background, CSS queries are translated into XPath queries using
`cssselect`_ library and run ``.xpath()`` method.
.. _cssselect: https://pypi.python.org/pypi/cssselect/
"""
return self.xpath(self._css2xpath(query))
Expand Down

0 comments on commit bcfa589

Please sign in to comment.