summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemi Chateauneu <remi.chateauneu@gmail.com>2021-03-01 17:51:58 +0000
committerNatanael Arndt <arndtn@gmail.com>2021-03-03 16:01:27 +0100
commit9653eefb1a51de751c44dab3c072cf190a85844e (patch)
tree547b5fbae0a84ddd401324799c26418ed3f4b363
parenteefaa374a01dbfef45da3984699b83f75962a0cb (diff)
downloadrdflib-9653eefb1a51de751c44dab3c072cf190a85844e.tar.gz
Speedup tok.
-rwxr-xr-xrdflib/plugins/parsers/notation3.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/rdflib/plugins/parsers/notation3.py b/rdflib/plugins/parsers/notation3.py
index 4bb6b5df..3cf19ace 100755
--- a/rdflib/plugins/parsers/notation3.py
+++ b/rdflib/plugins/parsers/notation3.py
@@ -510,14 +510,13 @@ class SinkParser:
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