A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/RDFLib/rdflib/commit/7df77cd below:

correct imports and `__all__` (#2340) · RDFLib/rdflib@7df77cd · GitHub

File tree Expand file treeCollapse file tree 25 files changed

+143

-72

lines changed

Filter options

Expand file treeCollapse file tree 25 files changed

+143

-72

lines changed Original file line number Diff line number Diff line change

@@ -16,8 +16,10 @@

16 16

import os

17 17

import re

18 18

import sys

19 +

from typing import Any, Dict

19 20 20 21

import sphinx

22 +

import sphinx.application

21 23 22 24

import rdflib

23 25

@@ -47,6 +49,7 @@

47 49

"sphinx.ext.autosectionlabel",

48 50

]

49 51 52 +

# https://github.com/sphinx-contrib/apidoc/blob/master/README.rst#configuration

50 53

apidoc_module_dir = "../rdflib"

51 54

apidoc_output_dir = "apidocs"

52 55

@@ -328,3 +331,50 @@ def find_version(filename):

328 331 329 332

if sys.version_info < (3, 8):

330 333

nitpick_ignore.extend([("py:class", "importlib_metadata.EntryPoint")])

334 + 335 + 336 +

def autodoc_skip_member_handler(

337 +

app: sphinx.application.Sphinx,

338 +

what: str,

339 +

name: str,

340 +

obj: Any,

341 +

skip: bool,

342 +

options: Dict[str, Any],

343 +

):

344 +

"""

345 +

This function will be called by Sphinx when it is deciding whether to skip a

346 +

member of a class or module.

347 +

"""

348 +

# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#event-autodoc-skip-member

349 +

if (

350 +

app.env.docname == "apidocs/rdflib"

351 +

and what == "module"

352 +

and type(obj).__name__.endswith("DefinedNamespaceMeta")

353 +

):

354 +

# Don't document namespaces in the `rdflib` module, they will be

355 +

# documented in the `rdflib.namespace` module instead and Sphinx does

356 +

# not like when these are documented in two places.

357 +

#

358 +

# An example of the WARNINGS that occur without this is:

359 +

#

360 +

# "WARNING: duplicate object description of rdflib.namespace._SDO.SDO,

361 +

# other instance in apidocs/rdflib, use :noindex: for one of them"

362 +

logging.info(

363 +

"Skipping %s %s in %s, it will be documented in ",

364 +

what,

365 +

name,

366 +

app.env.docname,

367 +

)

368 +

return True

369 +

return None

370 + 371 + 372 +

# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#skipping-members

373 +

def setup(app: sphinx.application.Sphinx) -> None:

374 +

"""

375 +

Setup the Sphinx application.

376 +

"""

377 + 378 +

# Register a autodoc-skip-member handler so that certain members can be

379 +

# skipped.

380 +

app.connect("autodoc-skip-member", autodoc_skip_member_handler)

Original file line number Diff line number Diff line change

@@ -150,7 +150,7 @@ Common XSD datatypes

150 150

^^^^^^^^^^^^^^^^^^^^

151 151 152 152

Most simple literals such as *string* or *integer* have XML Schema (XSD) datatypes defined for them, see the figure

153 -

below. Additionally, these XSD datatypes are listed in the :class:`XSD Namespace class <rdflib.XSD>` that

153 +

below. Additionally, these XSD datatypes are listed in the :class:`XSD Namespace class <rdflib.namespace.XSD>` that

154 154

ships with RDFLib, so many Python code editors will prompt you with autocomplete for them when using it.

155 155 156 156

Remember, you don't *have* to use XSD datatypes and can always make up your own, as GeoSPARQL does, as described above.

Original file line number Diff line number Diff line change

@@ -211,6 +211,7 @@ disallow_subclassing_any = false

211 211

warn_unreachable = true

212 212

warn_unused_ignores = true

213 213

no_implicit_optional = false

214 +

implicit_reexport = false

214 215 215 216

[[tool.mypy.overrides]]

216 217

module = "pyparsing.*"

Original file line number Diff line number Diff line change

@@ -9,18 +9,20 @@ class GEO(DefinedNamespace):

9 9

Generated from: http://schemas.opengis.net/geosparql/1.0/geosparql_vocab_all.rdf

10 10

Date: 2021-12-27 17:38:15.101187

11 11 12 -

<http://www.opengis.net/ont/geosparql> dc:creator "Open Geospatial Consortium"^^xsd:string

13 -

dc:date "2012-04-30"^^xsd:date

14 -

dc:source <http://www.opengis.net/doc/IS/geosparql/1.0>

15 -

"OGC GeoSPARQL – A Geographic Query Language for RDF Data OGC 11-052r5"^^xsd:string

16 -

rdfs:seeAlso <http://www.opengis.net/def/function/ogc-geosparql/1.0>

17 -

<http://www.opengis.net/def/rule/ogc-geosparql/1.0>

18 -

<http://www.opengis.net/doc/IS/geosparql/1.0>

19 -

owl:imports dc:

20 -

<http://www.opengis.net/ont/gml>

21 -

<http://www.opengis.net/ont/sf>

22 -

<http://www.w3.org/2004/02/skos/core>

23 -

owl:versionInfo "OGC GeoSPARQL 1.0"^^xsd:string

12 +

.. code-block:: Turtle

13 + 14 +

<http://www.opengis.net/ont/geosparql> dc:creator "Open Geospatial Consortium"^^xsd:string

15 +

dc:date "2012-04-30"^^xsd:date

16 +

dc:source <http://www.opengis.net/doc/IS/geosparql/1.0>

17 +

"OGC GeoSPARQL – A Geographic Query Language for RDF Data OGC 11-052r5"^^xsd:string

18 +

rdfs:seeAlso <http://www.opengis.net/def/function/ogc-geosparql/1.0>

19 +

<http://www.opengis.net/def/rule/ogc-geosparql/1.0>

20 +

<http://www.opengis.net/doc/IS/geosparql/1.0>

21 +

owl:imports dc:

22 +

<http://www.opengis.net/ont/gml>

23 +

<http://www.opengis.net/ont/sf>

24 +

<http://www.w3.org/2004/02/skos/core>

25 +

owl:versionInfo "OGC GeoSPARQL 1.0"^^xsd:string

24 26

"""

25 27 26 28

# http://www.w3.org/2000/01/rdf-schema#Datatype

Original file line number Diff line number Diff line change

@@ -91,6 +91,34 @@

91 91

"ClosedNamespace",

92 92

"DefinedNamespace",

93 93

"NamespaceManager",

94 +

"BRICK",

95 +

"CSVW",

96 +

"DC",

97 +

"DCAM",

98 +

"DCAT",

99 +

"DCMITYPE",

100 +

"DCTERMS",

101 +

"DOAP",

102 +

"FOAF",

103 +

"GEO",

104 +

"ODRL2",

105 +

"ORG",

106 +

"OWL",

107 +

"PROF",

108 +

"PROV",

109 +

"QB",

110 +

"RDF",

111 +

"RDFS",

112 +

"SDO",

113 +

"SH",

114 +

"SKOS",

115 +

"SOSA",

116 +

"SSN",

117 +

"TIME",

118 +

"VANN",

119 +

"VOID",

120 +

"WGS",

121 +

"XSD",

94 122

]

95 123 96 124

logger = logging.getLogger(__name__)

Original file line number Diff line number Diff line change

@@ -185,3 +185,6 @@ def update(

185 185

self.update_endpoint + qsa, data=query.encode(), headers=args["headers"]

186 186

)

187 187

)

188 + 189 + 190 +

__all__ = ["SPARQLConnector", "SPARQLConnectorException"]

Original file line number Diff line number Diff line change

@@ -1011,3 +1011,6 @@ def predicate_objects(

1011 1011

"""A generator of (predicate, object) tuples for the given subject"""

1012 1012

for t, c in self.triples((subject, None, None)):

1013 1013

yield t[1], t[2]

1014 + 1015 + 1016 +

__all__ = ["SPARQLUpdateStore", "SPARQLStore"]

Original file line number Diff line number Diff line change

@@ -1,21 +1,21 @@

1 1

# -*- coding: UTF-8 -*-

2 2

import json

3 3 4 -

from rdflib import ConjunctiveGraph

4 +

from rdflib import BNode, ConjunctiveGraph

5 5

from rdflib.compare import isomorphic

6 6

from rdflib.parser import InputSource

7 7

from rdflib.plugins.parsers.jsonld import JsonLDParser, to_rdf

8 8 9 9

# monkey-patch N-Quads parser via it's underlying W3CNTriplesParser to keep source bnode id:s ..

10 -

from rdflib.plugins.parsers.ntriples import W3CNTriplesParser, bNode, r_nodeid

10 +

from rdflib.plugins.parsers.ntriples import W3CNTriplesParser, r_nodeid

11 11

from rdflib.plugins.serializers.jsonld import from_rdf

12 12

from rdflib.plugins.shared.jsonld.keys import CONTEXT, GRAPH

13 13 14 14 15 15

def _preserving_nodeid(self, bnode_context=None):

16 16

if not self.peek("_"):

17 17

return False

18 -

return bNode(self.eat(r_nodeid).group(1))

18 +

return BNode(self.eat(r_nodeid).group(1))

19 19 20 20 21 21

DEFAULT_PARSER_VERSION = 1.0

Original file line number Diff line number Diff line change

@@ -1,5 +1,7 @@

1 1

# -*- coding: UTF-8 -*-

2 -

from rdflib.plugin import Parser, Serializer, register

2 +

from rdflib.parser import Parser

3 +

from rdflib.plugin import register

4 +

from rdflib.serializer import Serializer

3 5 4 6

register("json-ld", Parser, "rdflib.plugins.parsers.jsonld", "JsonLDParser")

5 7

register("json-ld", Serializer, "rdflib.plugins.serializers.jsonld", "JsonLDSerializer")

Original file line number Diff line number Diff line change

@@ -7,7 +7,8 @@

7 7

import pytest

8 8 9 9

from rdflib import Graph

10 -

from rdflib.plugin import Serializer, register

10 +

from rdflib.plugin import register

11 +

from rdflib.serializer import Serializer

11 12 12 13

register("json-ld", Serializer, "rdflib.plugins.serializers.jsonld", "JsonLDSerializer")

13 14

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4