diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 0000000..12f226a --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within setup.cfg +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/README.md b/README.md index a448c48..d09abfd 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ At the moment, there are 1088 tests, of which: 1) (52) sht:LexicalBNode, sht:ToldBNode and sht:BNodeShapeLabel test non-blank blank nodes (`rdflib` does not preserve bnode "identity") 2) (18) sht:Import Uses ShEx 2.1 IMPORT feature -- not yet implemented (three aren't tagged) 3) (3) Uses manifest shapemap feature -- not yet implemented -4) (2) sht:relativeIRI -- this isn't a real problem, but we havent taken time to deal with this in the test harness +4) (2) sht:relativeIRI -- this isn't a real problem, but we haven't taken time to deal with this in the test harness 5) (6) `rdflib` has a parsing error when escaping single quotes. (Issue submitted, awaiting release) As mentioned above, at the moment this is as literal an implementation of the specification as was sensible. This means, in particular, that we are less than clever when it comes to partition management. diff --git a/ancilliary/__init__.py b/ancillary/__init__.py similarity index 100% rename from ancilliary/__init__.py rename to ancillary/__init__.py diff --git a/ancilliary/earlreport.py b/ancillary/earlreport.py similarity index 99% rename from ancilliary/earlreport.py rename to ancillary/earlreport.py index 5cf25bf..84b9ee3 100644 --- a/ancilliary/earlreport.py +++ b/ancillary/earlreport.py @@ -42,7 +42,7 @@ a foaf:Person, earl:Assertor; foaf:name "Harold Solbrig"; - foaf:title "Implementor"; + foaf:title "Implementer"; foaf:homepage .""" EARL = Namespace("http://www.w3.org/ns/earl#") diff --git a/notebooks/PrefixLib.ipynb b/notebooks/PrefixLib.ipynb index b746086..3396c06 100644 --- a/notebooks/PrefixLib.ipynb +++ b/notebooks/PrefixLib.ipynb @@ -47,7 +47,7 @@ "\"\"\"\n", "p = PrefixLibrary(shex, rdf=str(RDF))\n", "\n", - "# Gives us acces to the PROV, GW and RDF namespaces\n", + "# Gives us access to the PROV, GW and RDF namespaces\n", "print(p.PROV)\n", "print(p.PROV.source)\n", "print(p.GW.g117)\n", @@ -280,7 +280,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## We didn't overrite RDF because it was already defined on the import statement at the top of this document.\n", + "## We didn't overwrite RDF because it was already defined on the import statement at the top of this document.\n", "### This warning can be omitted:" ] }, diff --git a/notebooks/SPARQLEndpoints.ipynb b/notebooks/SPARQLEndpoints.ipynb index 2c0b60d..fc80486 100644 --- a/notebooks/SPARQLEndpoints.ipynb +++ b/notebooks/SPARQLEndpoints.ipynb @@ -137,7 +137,7 @@ "START=@:S1\n", "\n", ":S1 {foaf:page IRI{3} ; # one or more foaf pages\n", - " drugbank:limsDrugId xsd:string # ane exactly one drug id\n", + " drugbank:limsDrugId xsd:string # and exactly one drug id\n", "}\"\"\"\n", "\n", "\n", diff --git a/notebooks/WikiSlurper.ipynb b/notebooks/WikiSlurper.ipynb index bd7031d..a9b57d4 100644 --- a/notebooks/WikiSlurper.ipynb +++ b/notebooks/WikiSlurper.ipynb @@ -176,7 +176,7 @@ " \"erhebliche krankhafte Abweichung von der Norm im Erleben oder Verhalten\",\n", " \"lidské onemocnění\",\n", " \"mielen toiminnan poikkeama, joka aiheuttaa merkittävää kärsimystä ja toimintakyvyn laskua\",\n", - " \"ohälsa i psyket, det vill säga i personligheten, emotionerna eller kognitionen, vilka primärt har psykiska orsaker\",\n", + " \"ohälsa i psyket, det will säga i personligheten, emotionerna eller kognitionen, vilka primärt har psykiska orsaker\",\n", " \"označenie pre výrazný odklon od spôsobu vnímania a správania psychicky zdravého jedinca\",\n", " \"psigiese aandoening\",\n", " \"psihološki poremećaj ili anomalija\",\n", diff --git a/pyshex/shape_expressions_language/p5_3_shape_expressions.py b/pyshex/shape_expressions_language/p5_3_shape_expressions.py index 0d2a689..4247702 100644 --- a/pyshex/shape_expressions_language/p5_3_shape_expressions.py +++ b/pyshex/shape_expressions_language/p5_3_shape_expressions.py @@ -25,7 +25,7 @@ def satisfies(cntxt: Context, n: Node, se: ShExJ.shapeExpr) -> bool: satisfies(n, se2, G, m). * Se is a ShapeAnd and for every shape expression se2 in shapeExprs, satisfies(n, se2, G, m). * Se is a ShapeNot and for the shape expression se2 at shapeExpr, notSatisfies(n, se2, G, m). - * Se is a ShapeExternal and implementation-specific mechansims not defined in this specification + * Se is a ShapeExternal and implementation-specific mechanisms not defined in this specification indicate success. * Se is a shapeExprRef and there exists in the schema a shape expression se2 with that id and satisfies(n, se2, G, m). @@ -77,7 +77,7 @@ def satisfiesShapeNot(cntxt: Context, n: Node, se: ShExJ.ShapeNot, _: DebugConte @trace_satisfies(True) def satisfiesExternal(cntxt: Context, n: Node, se: ShExJ.ShapeExternal, c: DebugContext) -> bool: - """ Se is a ShapeExternal and implementation-specific mechansims not defined in this specification indicate + """ Se is a ShapeExternal and implementation-specific mechanisms not defined in this specification indicate success. """ if c.debug: diff --git a/pyshex/shape_expressions_language/p5_6_schema_requirements.py b/pyshex/shape_expressions_language/p5_6_schema_requirements.py index 62252ef..d0594c9 100644 --- a/pyshex/shape_expressions_language/p5_6_schema_requirements.py +++ b/pyshex/shape_expressions_language/p5_6_schema_requirements.py @@ -1,4 +1,4 @@ -""" Implemention of `5.6 Schema Requirements `_ +""" Implementation of `5.6 Schema Requirements `_ The semantics defined above assume two structural requirements beyond those imposed by the grammar of the abstract syntax. These ensure referential integrity and eliminate logical paradoxes such as those that arrise diff --git a/pyshex/shape_expressions_language/p5_context.py b/pyshex/shape_expressions_language/p5_context.py index c31a0b0..c9b4b45 100644 --- a/pyshex/shape_expressions_language/p5_context.py +++ b/pyshex/shape_expressions_language/p5_context.py @@ -199,7 +199,7 @@ def __init__(self, g: Optional[Graph], s: Schema, def reset(self) -> None: """ - Reset the context preceeding an evaluation + Reset the context preceding an evaluation """ self.evaluating = set() self.assumptions = {} @@ -363,7 +363,7 @@ def start_evaluating(self, n: Node, s: ShExJ.shapeExpr) -> Optional[bool]: :return: Assumed evaluation result. If None, evaluation must be performed """ if not s.id: - s.id = str(BNode()) # Random permanant id + s.id = str(BNode()) # Random permanent id key = (n, s.id) # We only evaluate a node once diff --git a/pyshex/shex_evaluator.py b/pyshex/shex_evaluator.py index 2b9a023..2ea3225 100644 --- a/pyshex/shex_evaluator.py +++ b/pyshex/shex_evaluator.py @@ -107,7 +107,7 @@ def rdf(self) -> str: @rdf.setter def rdf(self, rdf: Optional[Union[str, Graph]]) -> None: - """ Set the RDF DataSet to be evaulated. If ``rdf`` is a string, the presence of a return is the + """ Set the RDF DataSet to be evaluated. If ``rdf`` is a string, the presence of a return is the indicator that it is text instead of a location. :param rdf: File name, URL, representation of rdflib Graph diff --git a/pyshex/utils/datatype_utils.py b/pyshex/utils/datatype_utils.py index ededd4c..da22fc9 100644 --- a/pyshex/utils/datatype_utils.py +++ b/pyshex/utils/datatype_utils.py @@ -20,7 +20,7 @@ def can_cast_to(v: Literal, dt: str) -> bool: def total_digits(n: Literal) -> Optional[int]: - """ 5.4.5 XML Schema Numberic Facet Constraints + """ 5.4.5 XML Schema Numeric Facet Constraints totaldigits and fractiondigits constraints on values not derived from xsd:decimal fail. """ diff --git a/pyshex/utils/deprecated.py b/pyshex/utils/deprecated.py index 3a351e9..e25a45d 100644 --- a/pyshex/utils/deprecated.py +++ b/pyshex/utils/deprecated.py @@ -3,7 +3,7 @@ def deprecated(func): """This is a decorator which can be used to mark functions - as deprecated. It will result in a warning being emmitted + as deprecated. It will result in a warning being emitted when the function is used.""" # Note: copied from https://code.activestate.com/recipes/391367-deprecated/ def newFunc(*args, **kwargs): diff --git a/pyshex/utils/matchesEachOfEvaluator.py b/pyshex/utils/matchesEachOfEvaluator.py index 76379b2..f4f3cf0 100644 --- a/pyshex/utils/matchesEachOfEvaluator.py +++ b/pyshex/utils/matchesEachOfEvaluator.py @@ -19,7 +19,7 @@ def __init__(self, cntxt: Context, T: RDFGraph, expr: ShExJ.EachOf) -> None: """ # tripleExpr = Union["EachOf", "OneOf", "TripleConstraint", tripleExprLabel] # - # For each tripleExpr in expressions deteremine the set of applicable predicates and their + # For each tripleExpr in expressions determine the set of applicable predicates and their # corresponding triples. # # Case 1: predicate occurs in exactly one expression and expression references exactly one predicate diff --git a/setup.cfg b/setup.cfg index 8affa7b..5031edd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,3 +28,11 @@ packages = console_scripts = shexeval = pyshex.shex_evaluator:evaluate_cli + +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +# TODO: data/ actually might benefit from some typos fixed +skip = .git*,data,WikiSlurper.ipynb +check-hidden = true +ignore-regex = ^\s*"image/\S+": ".* +ignore-words-list = te diff --git a/tests/test_primer/SPARQLEndpoints.py b/tests/test_primer/SPARQLEndpoints.py index 893e33d..4adc006 100644 --- a/tests/test_primer/SPARQLEndpoints.py +++ b/tests/test_primer/SPARQLEndpoints.py @@ -26,7 +26,7 @@ START=@:S1 :S1 {foaf:page IRI+ ; # one or more foaf pages - drugbank:limsDrugId xsd:string # ane exactly one drug id + drugbank:limsDrugId xsd:string # and exactly one drug id }""" diff --git a/tests/test_pyshex_utils/test_partitions.py b/tests/test_pyshex_utils/test_partitions.py index f8e6046..900b190 100644 --- a/tests/test_pyshex_utils/test_partitions.py +++ b/tests/test_pyshex_utils/test_partitions.py @@ -209,7 +209,7 @@ def test_large_integer_partition(self): def test_large_filtered_integer(self): """ The purpose of this test is to make sure that the generators work all the way through. If there - is something in the pipeline that requires complet resolution, this test will never finish. """ + is something in the pipeline that requires complete resolution, this test will never finish. """ x = filtered_integer_partition(25, 20) [next(x) for _ in range(100)] self.assertEqual(( diff --git a/tests/test_shextest_validation/test_manifest_shex_shexc.py b/tests/test_shextest_validation/test_manifest_shex_shexc.py index e185877..3335e67 100644 --- a/tests/test_shextest_validation/test_manifest_shex_shexc.py +++ b/tests/test_shextest_validation/test_manifest_shex_shexc.py @@ -3,7 +3,7 @@ from rdflib import URIRef -from ancilliary.earlreport import EARLPage +from ancillary.earlreport import EARLPage from tests.utils.manifest_tester import ManifestEntryTestCase diff --git a/tests/test_support_libraries/local_context.py b/tests/test_support_libraries/local_context.py index ebee99d..8dcb4f2 100644 --- a/tests/test_support_libraries/local_context.py +++ b/tests/test_support_libraries/local_context.py @@ -2,7 +2,7 @@ from rdflib import URIRef, XSD from pyshex import PrefixLibrary -""" This module is used to test the PrefixLibrary's ability to inject namespaces directoy into the containing module +""" This module is used to test the PrefixLibrary's ability to inject namespaces directory into the containing module It is used in conjunction with test_prefixlib.test_add_to_module """ pl = PrefixLibrary(""" diff --git a/tests/utils/manifest_tester.py b/tests/utils/manifest_tester.py index 70b4899..a76d7e7 100644 --- a/tests/utils/manifest_tester.py +++ b/tests/utils/manifest_tester.py @@ -9,7 +9,7 @@ import rdflib_shim shimin = rdflib_shim.RDFLIB_SHIM -from ancilliary.earlreport import EARLPage +from ancillary.earlreport import EARLPage from pyshex.shape_expressions_language.p5_2_validation_definition import isValid from pyshex.shape_expressions_language.p5_context import Context from pyshex.shapemap_structure_and_language.p3_shapemap_structure import ShapeAssociation, FixedShapeMap, START