Use <<= instead of deprecated << in SPARQL parser by bogdan-kulynych · Pull Request #417 · RDFLib/rdflib (original) (raw)
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation3 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Allows to use newer pyparsing (>=2.0.1) without getting deprecation warnings:
pyparsing.py:3546: DeprecationWarning: Operator '<<' is deprecated, use '<<=' instead
ret << Group( Suppress(opener) + ZeroOrMore( ignoreExpr | ret | content ) + Suppress(closer) )
Addresses inveniosoftware/invenio#2077
Allows to use newer pyparsing (>=2.0.1) without getting deprecation warnings
Great! I saw they added this at some point, but I never got around to updating the sparql parser.
Any idea why the tests fail on 2.X though?
It looks like pyparsing
1.5.7 (requirements.py2.txt
), always returns None
as a result of __lshift__
:
def lshift( self, other ): if isinstance( other, basestring ): other = ParserElement.literalStringClass(other) self.expr = other self.mayReturnEmpty = other.mayReturnEmpty self.strRepr = None self.mayIndexError = self.expr.mayIndexError self.mayReturnEmpty = self.expr.mayReturnEmpty self.setWhitespaceChars( self.expr.whiteChars ) self.skipWhitespace = self.expr.skipWhitespace self.saveAsList = self.expr.saveAsList self.ignoreExprs.extend(self.expr.ignoreExprs) return None ilshift = lshift
whereas pyparsing
2.0.2 (requirements.py3.txt
) returns self
. Returning self
fixes the test failures. Should I maybe monkeypatch the __lshift__
method? :-/
we'll upgrade to pyparsing 2 for all version for v5 and merge it then.
gromgull added a commit that referenced this pull request