Skip to content

Commit

Permalink
Speedup tok.
Browse files Browse the repository at this point in the history
  • Loading branch information
rchateauneu authored and white-gecko committed Mar 3, 2021
1 parent eefaa37 commit 9653eef
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions rdflib/plugins/parsers/notation3.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,13 @@ def tok(self, tok, argstr, i, colon=False):
if tok not in self.keywords:
return -1 # No, this has neither keywords declaration nor "@"

len_tok = len(tok)
i_plus_len_tok = i + len(tok)
if (
argstr[i : i + len_tok] == tok
and (argstr[i + len_tok] in _notKeywordsChars)
or (colon and argstr[i + len_tok] == ":")
argstr[i : i_plus_len_tok] == tok
and (argstr[i_plus_len_tok] in _notKeywordsChars)
or (colon and argstr[i_plus_len_tok] == ":")
):
i += len_tok
return i
return i_plus_len_tok
else:
return -1

Expand Down

0 comments on commit 9653eef

Please sign in to comment.