Skip to content
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 and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use <<= instead of deprecated << in SPARQL parser #417

Closed
wants to merge 1 commit into from

Conversation

bogdan-kulynych
Copy link

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
@gromgull
Copy link
Member

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?

@bogdan-kulynych
Copy link
Author

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? :-/

@gromgull gromgull added this to the rdflib 5.0.0 milestone Jan 12, 2017
@gromgull
Copy link
Member

we'll upgrade to pyparsing 2 for all version for v5 and merge it then.

gromgull added a commit that referenced this pull request Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants