summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Car <nicholas.car@surroundaustralia.com>2020-05-25 11:46:36 +1000
committerNicholas Car <nicholas.car@surroundaustralia.com>2020-05-25 11:46:36 +1000
commitbc213dc048454ceb2d01865a6111b0766277aa8b (patch)
treea4ed2c89e772d911da881d4bb70af43413e83636
parent2f6fca277e988462da989dfacffd41175b636832 (diff)
downloadrdflib-bc213dc048454ceb2d01865a6111b0766277aa8b.tar.gz
blacked container.py, tiny doctest fix
-rw-r--r--docs/conf.py2
-rw-r--r--rdflib/container.py31
-rw-r--r--requirements.dev.txt1
3 files changed, 15 insertions, 19 deletions
diff --git a/docs/conf.py b/docs/conf.py
index dbecc10b..dd9087c3 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -154,7 +154,7 @@ html_logo = "_static/RDFlib.png"
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
-html_favicon = "_static/logo-rdflib.ico"
+html_favicon = "_static/RDFlib.ico"
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
diff --git a/rdflib/container.py b/rdflib/container.py
index e0e83843..5960d0a7 100644
--- a/rdflib/container.py
+++ b/rdflib/container.py
@@ -12,36 +12,34 @@ class Container(object):
Basic usage, creating a ``Bag`` and adding to it::
>>> from rdflib import Graph, BNode, Literal, Bag
-
>>> g = Graph()
>>> b = Bag(g, BNode(), [Literal("One"), Literal("Two"), Literal("Three")])
-
>>> print(g.serialize(format="turtle").decode())
-
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
+ <BLANKLINE>
[] a rdf:Bag ;
rdf:_1 "One" ;
rdf:_2 "Two" ;
rdf:_3 "Three" .
+ <BLANKLINE>
+ <BLANKLINE>
- And getting an item from the ``Bag``:
-
+ >>> # print out an item using an index reference
>>> print(b[2])
-
Two
- And adding a new item:
-
+ >>> # add a new item
>>> b.append(Literal("Hello"))
-
+ >>> print(g.serialize(format="turtle").decode())
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-
+ <BLANKLINE>
[] a rdf:Bag ;
rdf:_1 "One" ;
rdf:_2 "Two" ;
- rdf:_3 "Three" .
+ rdf:_3 "Three" ;
rdf:_4 "Hello" .
+ <BLANKLINE>
+ <BLANKLINE>
"""
@@ -106,7 +104,7 @@ class Container(object):
c = self._get_container()
assert isinstance(key, int)
- elem_uri = str(RDF) + '_' + str(key)
+ elem_uri = str(RDF) + "_" + str(key)
if key <= 0 or key > len(self):
raise KeyError(key)
v = self.graph.value(c, URIRef(elem_uri))
@@ -121,7 +119,7 @@ class Container(object):
assert isinstance(key, int)
c = self._get_container()
- elem_uri = str(RDF) + '_' + str(key)
+ elem_uri = str(RDF) + "_" + str(key)
if key <= 0 or key > len(self):
raise KeyError(key)
@@ -136,7 +134,7 @@ class Container(object):
graph = self.graph
container = self.uri
- elem_uri = str(RDF) + '_' + str(key)
+ elem_uri = str(RDF) + "_" + str(key)
graph.remove((container, URIRef(elem_uri), None))
for j in range(key + 1, len(self) + 1):
elem_uri = str(RDF) + "_" + str(j)
@@ -223,7 +221,6 @@ class Bag(Container):
class Alt(Container):
-
def __init__(self, graph, uri, seq=[]):
Container.__init__(self, graph, uri, seq, "Alt")
@@ -237,7 +234,6 @@ class Alt(Container):
class Seq(Container):
-
def __init__(self, graph, uri, seq=[]):
Container.__init__(self, graph, uri, seq, "Seq")
@@ -262,7 +258,6 @@ class Seq(Container):
class NoElementException(Exception):
-
def __init__(self, message="rdf:Alt Container is empty"):
self.message = message
diff --git a/requirements.dev.txt b/requirements.dev.txt
index 58060d65..7e6aaf68 100644
--- a/requirements.dev.txt
+++ b/requirements.dev.txt
@@ -1,2 +1,3 @@
sphinx
sphinxcontrib-apidoc
+black