diff options
| author | nicholascar <nicholas.car@surroundaustralia.com> | 2021-12-07 18:34:21 +1000 |
|---|---|---|
| committer | nicholascar <nicholas.car@surroundaustralia.com> | 2021-12-07 18:34:21 +1000 |
| commit | 2de6cf2aa3e4610613a10648f7c2d05629c8a37a (patch) | |
| tree | 9ed525e292f5a7cc1118e7fd8069a18862d57024 | |
| parent | de1e07763854c10eaa1ecdad699f0c15dcbd2843 (diff) | |
| download | rdflib-2de6cf2aa3e4610613a10648f7c2d05629c8a37a.tar.gz | |
backing all files
| -rw-r--r-- | rdflib/__init__.py | 2 | ||||
| -rw-r--r-- | rdflib/compare.py | 2 | ||||
| -rw-r--r-- | rdflib/namespace/__init__.py | 4 | ||||
| -rwxr-xr-x | rdflib/plugins/parsers/notation3.py | 38 | ||||
| -rw-r--r-- | rdflib/plugins/parsers/ntriples.py | 8 | ||||
| -rw-r--r-- | rdflib/plugins/parsers/trig.py | 6 | ||||
| -rw-r--r-- | rdflib/plugins/serializers/nt.py | 2 | ||||
| -rw-r--r-- | rdflib/plugins/shared/jsonld/context.py | 2 | ||||
| -rw-r--r-- | rdflib/plugins/shared/jsonld/util.py | 2 | ||||
| -rw-r--r-- | rdflib/plugins/stores/sparqlstore.py | 4 | ||||
| -rw-r--r-- | rdflib/term.py | 2 | ||||
| -rw-r--r-- | rdflib/util.py | 4 |
12 files changed, 38 insertions, 38 deletions
diff --git a/rdflib/__init__.py b/rdflib/__init__.py index 9b8daeb0..10541861 100644 --- a/rdflib/__init__.py +++ b/rdflib/__init__.py @@ -45,7 +45,7 @@ A tiny example: __docformat__ = "restructuredtext en" # The format of the __version__ line is matched by a regex in setup.py -__version__ = "6.03a" +__version__ = "6.0.3" __date__ = "2021-10-10" __all__ = [ diff --git a/rdflib/compare.py b/rdflib/compare.py index 2d97fac3..f8256439 100644 --- a/rdflib/compare.py +++ b/rdflib/compare.py @@ -366,7 +366,7 @@ class _TripleCanonicalizer(object): coloring.extend(colors) try: si = sequence.index(c) - sequence = sequence[:si] + colors + sequence[si + 1:] + sequence = sequence[:si] + colors + sequence[si + 1 :] except ValueError: sequence = colors[1:] + sequence combined_colors: List[Color] = [] diff --git a/rdflib/namespace/__init__.py b/rdflib/namespace/__init__.py index 68bc1726..0739e372 100644 --- a/rdflib/namespace/__init__.py +++ b/rdflib/namespace/__init__.py @@ -219,7 +219,7 @@ class DefinedNamespaceMeta(type): if item_str.startswith("__"): return super().__contains__(item) if item_str.startswith(str(cls._NS)): - item_str = item_str[len(str(cls._NS)):] + item_str = item_str[len(str(cls._NS)) :] return any( item_str in c.__annotations__ or item_str in c._extras @@ -418,7 +418,7 @@ class NamespaceManager(object): pl_namespace = get_longest_namespace(self.__strie[namespace], uri) if pl_namespace is not None: namespace = pl_namespace - name = uri[len(namespace):] + name = uri[len(namespace) :] namespace = URIRef(namespace) prefix = self.store.prefix(namespace) # warning multiple prefixes problem diff --git a/rdflib/plugins/parsers/notation3.py b/rdflib/plugins/parsers/notation3.py index 9d39e970..31b20036 100755 --- a/rdflib/plugins/parsers/notation3.py +++ b/rdflib/plugins/parsers/notation3.py @@ -142,7 +142,7 @@ def join(here, there): "colon - with relative '%s'." % (here, there) ) - if here[bcolonl + 1: bcolonl + 3] == "//": + if here[bcolonl + 1 : bcolonl + 3] == "//": bpath = here.find("/", bcolonl + 3) else: bpath = bcolonl + 1 @@ -529,7 +529,7 @@ class SinkParser: assert tok[0] not in _notNameChars # not for punctuation len_tok = len(tok) - if argstr[i: i + len_tok].lower() == tok.lower() and ( + if argstr[i : i + len_tok].lower() == tok.lower() and ( argstr[i + len_tok] in _notQNameChars ): i += len_tok @@ -794,7 +794,7 @@ class SinkParser: res.append(("->", RDF_type)) return j - if argstr[i: i + 2] == "<=": + if argstr[i : i + 2] == "<=": if self.turtle: self.BadSyntax(argstr, i, "Found '<=' in Turtle mode. ") @@ -810,7 +810,7 @@ class SinkParser: res.append(("->", DAML_sameAs)) return i + 1 - if argstr[i: i + 2] == ":=": + if argstr[i : i + 2] == ":=": if self.turtle: self.BadSyntax(argstr, i, "Found ':=' in Turtle mode") @@ -823,7 +823,7 @@ class SinkParser: res.append(("->", r[0])) return j - if argstr[i: i + 2] == ">-" or argstr[i: i + 2] == "<-": + if argstr[i : i + 2] == ">-" or argstr[i : i + 2] == "<-": self.BadSyntax(argstr, j, ">- ... -> syntax is obsolete.") return -1 @@ -941,7 +941,7 @@ class SinkParser: i = self.skipSpace(argstr, j) if i < 0: self.BadSyntax(argstr, i, "needed '$}', found end.") - if argstr[i: i + 2] == "$}": + if argstr[i : i + 2] == "$}": j = i + 2 break @@ -1064,7 +1064,7 @@ class SinkParser: break i = j + 1 - if argstr[j: j + 2] == ":-": + if argstr[j : j + 2] == ":-": if self.turtle: self.BadSyntax(argstr, j, "Found in ':-' in Turtle mode") i = j + 2 @@ -1424,7 +1424,7 @@ class SinkParser: ch = argstr[i] if ch in self.string_delimiters: ch_three = ch * 3 - if argstr[i: i + 3] == ch_three: + if argstr[i : i + 3] == ch_three: delim = ch_three i += 3 else: @@ -1474,7 +1474,7 @@ class SinkParser: ch_three = ch * 3 if ch in self.string_delimiters: - if argstr[i: i + 3] == ch_three: + if argstr[i : i + 3] == ch_three: delim = ch_three i += 3 else: @@ -1495,9 +1495,9 @@ class SinkParser: "Bad language code syntax on string " + "literal, after @", ) i = m.end() - lang = argstr[j + 1: i] + lang = argstr[j + 1 : i] j = i - if argstr[j: j + 2] == "^^": + if argstr[j : j + 2] == "^^": res2 = [] j = self.uri_ref2(argstr, j + 2, res2) # Read datatype URI dt = res2[0] @@ -1531,15 +1531,15 @@ class SinkParser: if ( delim == delim3 ): # done when delim is """ or ''' and, respectively ... - if argstr[j: j + 5] == delim5: # ... we have "" or '' before + if argstr[j : j + 5] == delim5: # ... we have "" or '' before i = j + 5 ustr += delim2 return i, ustr - if argstr[j: j + 4] == delim4: # ... we have " or ' before + if argstr[j : j + 4] == delim4: # ... we have " or ' before i = j + 4 ustr += delim1 return i, ustr - if argstr[j: j + 3] == delim3: # current " or ' is part of delim + if argstr[j : j + 3] == delim3: # current " or ' is part of delim i = j + 3 return i, ustr @@ -1551,8 +1551,8 @@ class SinkParser: m = interesting.search(argstr, j) # was argstr[j:]. # Note for pos param to work, MUST be compiled ... re bug? assert m, "Quote expected in string at ^ in %s^%s" % ( - argstr[j - 20: j], - argstr[j: j + 20], + argstr[j - 20 : j], + argstr[j : j + 20], ) # at least need a quote i = m.start() @@ -1629,14 +1629,14 @@ class SinkParser: self._thisDoc, startline, argstr, i, "unterminated string literal(3)" ) try: - return i + n, reg.sub(unicodeExpand, "\\" + prefix + argstr[i: i + n]) + return i + n, reg.sub(unicodeExpand, "\\" + prefix + argstr[i : i + n]) except: raise BadSyntax( self._thisDoc, startline, argstr, i, - "bad string literal hex escape: " + argstr[i: i + n], + "bad string literal hex escape: " + argstr[i : i + n], ) def uEscape(self, argstr, i, startline): @@ -1681,7 +1681,7 @@ class BadSyntax(SyntaxError): self._why, pre, argstr[st:i], - argstr[i: i + 60], + argstr[i : i + 60], post, ) diff --git a/rdflib/plugins/parsers/ntriples.py b/rdflib/plugins/parsers/ntriples.py index a5858bc2..5e9ab7c8 100644 --- a/rdflib/plugins/parsers/ntriples.py +++ b/rdflib/plugins/parsers/ntriples.py @@ -65,7 +65,7 @@ def unquote(s): while s: m = r_safe.match(s) if m: - s = s[m.end():] + s = s[m.end() :] result.append(m.group(1)) continue @@ -77,7 +77,7 @@ def unquote(s): m = r_uniquot.match(s) if m: - s = s[m.end():] + s = s[m.end() :] u, U = m.groups() codepoint = int(u or U, 16) if codepoint > 0x10FFFF: @@ -186,7 +186,7 @@ class W3CNTriplesParser(object): while True: m = r_line.match(self.buffer) if m: # the more likely prospect - self.buffer = self.buffer[m.end():] + self.buffer = self.buffer[m.end() :] return m.group(1) else: buffer = self.file.read(bufsiz) @@ -224,7 +224,7 @@ class W3CNTriplesParser(object): # print(dir(pattern)) # print repr(self.line), type(self.line) raise ParseError("Failed to eat %s at %s" % (pattern.pattern, self.line)) - self.line = self.line[m.end():] + self.line = self.line[m.end() :] return m def subject(self, bnode_context=None): diff --git a/rdflib/plugins/parsers/trig.py b/rdflib/plugins/parsers/trig.py index 1addb747..9caa0662 100644 --- a/rdflib/plugins/parsers/trig.py +++ b/rdflib/plugins/parsers/trig.py @@ -80,7 +80,7 @@ class TrigSinkParser(SinkParser): if j < 0: self.BadSyntax(argstr, i, "EOF found when expected graph") - if argstr[j: j + 1] == "=": # optional = for legacy support + if argstr[j : j + 1] == "=": # optional = for legacy support i = self.skipSpace(argstr, j + 1) if i < 0: @@ -88,7 +88,7 @@ class TrigSinkParser(SinkParser): else: i = j - if argstr[i: i + 1] != "{": + if argstr[i : i + 1] != "{": return -1 # the node wasn't part of a graph j = i + 1 @@ -104,7 +104,7 @@ class TrigSinkParser(SinkParser): if i < 0: self.BadSyntax(argstr, i, "needed '}', found end.") - if argstr[i: i + 1] == "}": + if argstr[i : i + 1] == "}": j = i + 1 break diff --git a/rdflib/plugins/serializers/nt.py b/rdflib/plugins/serializers/nt.py index e1b60e43..34ecc959 100644 --- a/rdflib/plugins/serializers/nt.py +++ b/rdflib/plugins/serializers/nt.py @@ -95,7 +95,7 @@ def _nt_unicode_error_resolver(err): fmt = "\\u%04X" if c <= 0xFFFF else "\\U%08X" return fmt % c - string = err.object[err.start: err.end] + string = err.object[err.start : err.end] return "".join(_replace_single(c) for c in string), err.end diff --git a/rdflib/plugins/shared/jsonld/context.py b/rdflib/plugins/shared/jsonld/context.py index e11bb447..30bb02ea 100644 --- a/rdflib/plugins/shared/jsonld/context.py +++ b/rdflib/plugins/shared/jsonld/context.py @@ -329,7 +329,7 @@ class Context(object): if str(iri) == self._base: return "" elif iri.startswith(self._basedomain): - return iri[len(self._basedomain):] + return iri[len(self._basedomain) :] return iri def to_symbol(self, iri): diff --git a/rdflib/plugins/shared/jsonld/util.py b/rdflib/plugins/shared/jsonld/util.py index 707b9ce2..cf71742f 100644 --- a/rdflib/plugins/shared/jsonld/util.py +++ b/rdflib/plugins/shared/jsonld/util.py @@ -88,4 +88,4 @@ def context_from_urlinputsource(source): if ' rel="http://www.w3.org/ns/json-ld#context"' in link: i, j = link.index("<"), link.index(">") if i > -1 and j > -1: - return urljoin(source.url, link[i + 1: j]) + return urljoin(source.url, link[i + 1 : j]) diff --git a/rdflib/plugins/stores/sparqlstore.py b/rdflib/plugins/stores/sparqlstore.py index 56636049..aed43088 100644 --- a/rdflib/plugins/stores/sparqlstore.py +++ b/rdflib/plugins/stores/sparqlstore.py @@ -782,12 +782,12 @@ class SPARQLUpdateStore(SPARQLStore): if match.group("block_start") is not None: level += 1 if level == 1: - modified_query.append(query[pos: match.end()]) + modified_query.append(query[pos : match.end()]) modified_query.append(graph_block_open) pos = match.end() elif match.group("block_end") is not None: if level == 1: - since_previous_pos = query[pos: match.start()] + since_previous_pos = query[pos : match.start()] if modified_query[-1] is graph_block_open and ( since_previous_pos == "" or since_previous_pos.isspace() ): diff --git a/rdflib/term.py b/rdflib/term.py index fb7acd63..796a76b3 100644 --- a/rdflib/term.py +++ b/rdflib/term.py @@ -315,7 +315,7 @@ class URIRef(Identifier): """ if isinstance(self, RDFLibGenid): parsed_uri = urlparse("%s" % self) - return BNode(value=parsed_uri.path[len(rdflib_skolem_genid):]) + return BNode(value=parsed_uri.path[len(rdflib_skolem_genid) :]) elif isinstance(self, Genid): bnode_id = "%s" % self if bnode_id in skolems: diff --git a/rdflib/util.py b/rdflib/util.py index 15c37288..182c1fe3 100644 --- a/rdflib/util.py +++ b/rdflib/util.py @@ -176,7 +176,7 @@ def from_n3(s: str, default=None, backend=None, nsm=None): else: quotes = '"' value, rest = s.rsplit(quotes, 1) - value = value[len(quotes):] # strip leading quotes + value = value[len(quotes) :] # strip leading quotes datatype = None language = None @@ -187,7 +187,7 @@ def from_n3(s: str, default=None, backend=None, nsm=None): # datatype has to come after lang-tag so ignore everything before # see: http://www.w3.org/TR/2011/WD-turtle-20110809/ # #prod-turtle2-RDFLiteral - datatype = from_n3(rest[dtoffset + 2:], default, backend, nsm) + datatype = from_n3(rest[dtoffset + 2 :], default, backend, nsm) else: if rest.startswith("@"): language = rest[1:] # strip leading at sign |
