Skip to content

Commit bebd05f

Browse files
authored
Merge pull request #80 from hsolbrig/update_argparse_output
Update argparse output
2 parents 43026c4 + 507cf52 commit bebd05f

32 files changed

+2854
-2293
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
strategy:
3636
matrix:
37-
python-version: [ 3.7, 3.8, 3.9 ]
37+
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
3838

3939
steps:
4040
- uses: actions/checkout@v2

.github/workflows/pr-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [ 3.7, 3.8, 3.9 ]
14+
python-version: [ 3.7, 3.8, 3.9, "3.10" ]
1515

1616
steps:
1717
- uses: actions/checkout@v2

.github/workflows/pypi-publish.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-python@v2
14-
with:
15-
python-version: 3.7
1614

1715
- name: Install dependencies
1816
run: |

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Egon Willighagen <[email protected]>
33
Harold Solbrig <[email protected]>
44
Harold Solbrig <[email protected]>
55
Harold Solbrig <[email protected]>
6+
andrawaag <[email protected]>
67
78
89

ChangeLog

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
CHANGES
22
=======
33

4+
* Import the shim into the manifest tester
5+
* Add miscellaneous testing updates
6+
* Requirements match Pipenv
7+
* Address issue where the format of argparse help files changed in py3.10
8+
* Add explicit import of chardet. Allow rdflib 5 OR 6
9+
* Add python 3.10 to the test suite
10+
* Fix #75
11+
* Fix for issue #74
12+
* Update log
13+
14+
v0.7.20
15+
-------
16+
17+
* Remove test publish to testpypi
418
* Update pypi-publish.yaml
519

620
v0.7.19

Pipfile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ verify_ssl = true
77
pbr = "*"
88

99
[packages]
10-
rdflib = "~=5.0"
11-
rdflib-jsonld = "~=0.5"
10+
chardet = "*"
11+
rdflib = ">=5.0.0"
12+
rdflib-shim = "*"
1213
requests = ">=2.22.0"
1314
urllib3 = "*"
14-
ShExJSG = ">=0.7.1"
15+
ShExJSG = ">=0.8.1"
1516
CFGraph = ">=0.2.1"
16-
PyShExC = "==0.8.3"
17-
sparqlslurper = "~=0.4"
17+
PyShExC = "==0.9.0"
18+
sparqlslurper = ">=0.5.1"
1819
sparqlwrapper = ">=1.8.5"

pyshex/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
from pyshex.prefixlib import PrefixLibrary, standard_prefixes, known_prefixes
22
from pyshex.shex_evaluator import ShExEvaluator
3+
4+
import rdflib_shim
5+
shim_installed = rdflib_shim.RDFLIB_SHIM

pyshex/prefixlib.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
from typing import Union, Optional
33

44
from pyshexc.parser_impl.generate_shexj import load_shex_file
5-
from rdflib import Namespace, Graph, RDF, RDFS, XSD, URIRef, plugins
6-
from rdflib.namespace import DOAP, FOAF, DC, DCTERMS, SKOS, OWL, XMLNS, _RDFNamespace
7-
from rdflib.plugins.serializers.turtle import TurtleSerializer
8-
from rdflib.serializer import Serializer
5+
from rdflib import Namespace, Graph, RDF, RDFS, XSD, URIRef, __version__
6+
from rdflib.namespace import DOAP, FOAF, DC, DCTERMS, SKOS, OWL, XMLNS
7+
if __version__.startswith("5."):
8+
from rdflib.namespace import _RDFNamespace
9+
BuiltinNamespace = _RDFNamespace
10+
else:
11+
from rdflib.namespace import DefinedNamespaceMeta
12+
BuiltinNamespace = DefinedNamespaceMeta
13+
914

1015
from pyshex.utils.deprecated import deprecated
1116

@@ -66,7 +71,7 @@ def add_rdf(self, rdf: Union[str, Graph], format: Optional[str] = "turtle") -> "
6671
if '\n' in rdf or '\r' in rdf or ' ' in rdf:
6772
g.parse(data=rdf, format=format)
6873
else:
69-
g.load(rdf, format=format)
74+
g.parse(rdf, format=format)
7075
else:
7176
g = rdf
7277
for k, v in g.namespace_manager.namespaces():
@@ -99,7 +104,7 @@ def add_to_object(self, target: object, override: bool = False) -> int:
99104
for k, v in self:
100105
key = k.upper()
101106
exists = hasattr(target, key)
102-
if not exists or (override and isinstance(getattr(target, k), (Namespace, _RDFNamespace))):
107+
if not exists or (override and isinstance(getattr(target, k), (Namespace, BuiltinNamespace))):
103108
setattr(target, k, v)
104109
nret += 1
105110
else:

pyshex/shex_evaluator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def sink(e: EvaluationResult) -> bool:
226226

227227
# Experimental -- xfer all ShEx namespaces to g
228228
if self.pfx and evaluator.g is not None:
229-
self.pfx.add_bindings(evaluator.g)
229+
self.pfx.add_bindings_to(evaluator.g)
230230

231231
cntxt = Context(evaluator.g, evaluator._schema)
232232
cntxt.debug_context.debug = debug if debug is not None else self.debug
@@ -328,7 +328,7 @@ def evaluate_cli(argv: Optional[Union[str, List[str]]] = None, prog: Optional[st
328328
if '\n' in opts.rdf or '\r' in opts.rdf:
329329
g.parse(data=opts.rdf, format=opts.format)
330330
else:
331-
g.load(opts.rdf, format=opts.format)
331+
g.parse(opts.rdf, format=opts.format)
332332

333333
if not (opts.focus or opts.allsubjects or opts.sparql):
334334
print('Error: You must specify one or more graph focus nodes, supply a SPARQL query, or use the "-A" option',

requirements.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
################################################################################
1212

1313
cfgraph>=0.2.1
14-
pyshexc==0.8.3
15-
rdflib-jsonld~=0.5
16-
rdflib~=5.0
14+
chardet
15+
pyshexc==0.9.0
16+
rdflib-shim
17+
rdflib>=5.0.0
1718
requests>=2.22.0
18-
shexjsg>=0.7.1
19-
sparqlslurper~=0.4
19+
shexjsg>=0.8.1
20+
sparqlslurper>=0.5.1
2021
sparqlwrapper>=1.8.5
2122
urllib3

0 commit comments

Comments
 (0)