Skip to content

Commit

Permalink
Merge pull request #80 from hsolbrig/update_argparse_output
Browse files Browse the repository at this point in the history
Update argparse output
  • Loading branch information
hsolbrig authored Dec 21, 2021
2 parents 43026c4 + 507cf52 commit bebd05f
Show file tree
Hide file tree
Showing 32 changed files with 2,854 additions and 2,293 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9 ]
python-version: [ 3.7, 3.8, 3.9, "3.10" ]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9 ]
python-version: [ 3.7, 3.8, 3.9, "3.10" ]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Egon Willighagen <egon.willighagen@gmail.com>
Harold Solbrig <hsolbri1@MacBook-Pro.local>
Harold Solbrig <solbrig@earthlink.net>
Harold Solbrig <solbrig@jhu.edu>
andrawaag <andra@micelio.be>
hsolbrig <solbrig.harold@mayo.edu>
hsolbrig <solbrig@earthlink.net>
hsolbrig <solbrig@jhu.edu>
Expand Down
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
CHANGES
=======

* Import the shim into the manifest tester
* Add miscellaneous testing updates
* Requirements match Pipenv
* Address issue where the format of argparse help files changed in py3.10
* Add explicit import of chardet. Allow rdflib 5 OR 6
* Add python 3.10 to the test suite
* Fix #75
* Fix for issue #74
* Update log

v0.7.20
-------

* Remove test publish to testpypi
* Update pypi-publish.yaml

v0.7.19
Expand Down
11 changes: 6 additions & 5 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ verify_ssl = true
pbr = "*"

[packages]
rdflib = "~=5.0"
rdflib-jsonld = "~=0.5"
chardet = "*"
rdflib = ">=5.0.0"
rdflib-shim = "*"
requests = ">=2.22.0"
urllib3 = "*"
ShExJSG = ">=0.7.1"
ShExJSG = ">=0.8.1"
CFGraph = ">=0.2.1"
PyShExC = "==0.8.3"
sparqlslurper = "~=0.4"
PyShExC = "==0.9.0"
sparqlslurper = ">=0.5.1"
sparqlwrapper = ">=1.8.5"
3 changes: 3 additions & 0 deletions pyshex/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
from pyshex.prefixlib import PrefixLibrary, standard_prefixes, known_prefixes
from pyshex.shex_evaluator import ShExEvaluator

import rdflib_shim
shim_installed = rdflib_shim.RDFLIB_SHIM
17 changes: 11 additions & 6 deletions pyshex/prefixlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
from typing import Union, Optional

from pyshexc.parser_impl.generate_shexj import load_shex_file
from rdflib import Namespace, Graph, RDF, RDFS, XSD, URIRef, plugins
from rdflib.namespace import DOAP, FOAF, DC, DCTERMS, SKOS, OWL, XMLNS, _RDFNamespace
from rdflib.plugins.serializers.turtle import TurtleSerializer
from rdflib.serializer import Serializer
from rdflib import Namespace, Graph, RDF, RDFS, XSD, URIRef, __version__
from rdflib.namespace import DOAP, FOAF, DC, DCTERMS, SKOS, OWL, XMLNS
if __version__.startswith("5."):
from rdflib.namespace import _RDFNamespace
BuiltinNamespace = _RDFNamespace
else:
from rdflib.namespace import DefinedNamespaceMeta
BuiltinNamespace = DefinedNamespaceMeta


from pyshex.utils.deprecated import deprecated

Expand Down Expand Up @@ -66,7 +71,7 @@ def add_rdf(self, rdf: Union[str, Graph], format: Optional[str] = "turtle") -> "
if '\n' in rdf or '\r' in rdf or ' ' in rdf:
g.parse(data=rdf, format=format)
else:
g.load(rdf, format=format)
g.parse(rdf, format=format)
else:
g = rdf
for k, v in g.namespace_manager.namespaces():
Expand Down Expand Up @@ -99,7 +104,7 @@ def add_to_object(self, target: object, override: bool = False) -> int:
for k, v in self:
key = k.upper()
exists = hasattr(target, key)
if not exists or (override and isinstance(getattr(target, k), (Namespace, _RDFNamespace))):
if not exists or (override and isinstance(getattr(target, k), (Namespace, BuiltinNamespace))):
setattr(target, k, v)
nret += 1
else:
Expand Down
4 changes: 2 additions & 2 deletions pyshex/shex_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def sink(e: EvaluationResult) -> bool:

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

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

if not (opts.focus or opts.allsubjects or opts.sparql):
print('Error: You must specify one or more graph focus nodes, supply a SPARQL query, or use the "-A" option',
Expand Down
11 changes: 6 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
################################################################################

cfgraph>=0.2.1
pyshexc==0.8.3
rdflib-jsonld~=0.5
rdflib~=5.0
chardet
pyshexc==0.9.0
rdflib-shim
rdflib>=5.0.0
requests>=2.22.0
shexjsg>=0.7.1
sparqlslurper~=0.4
shexjsg>=0.8.1
sparqlslurper>=0.5.1
sparqlwrapper>=1.8.5
urllib3
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

from setuptools import setup

NAME = "PyShEx"

setup(
name=NAME,
setup_requires=['pbr'],
pbr=True,
)
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# True means that we skip all tests that go outside our own environment (e.g. wikidata, etc)
# You can set this to True, False or base it on the present of a file in the root directory called "tests/data/SKIP_EXTERNAL_URLS"
SKIP_EXTERNAL_URLS = None
SKIP_EXTERNAL_URLS = os.environ.get('SKIP_EXTERNAL_URLS', None)
SKIP_EXTERNAL_URLS_MSG = "External url's are not tested - set tests.__init__.py.SKIP_EXTERNAL_URLS to False to run"

datadir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))
Expand Down
Loading

0 comments on commit bebd05f

Please sign in to comment.