From be67c0104d32935214fe8f6f66dcf4320d3347e4 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:13:14 -0500 Subject: [PATCH 1/8] Add github action to codespell master on push and PRs --- .github/workflows/codespell.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codespell.yml 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 From 3918db213135472b2c40a46473611bd42211bca8 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:13:14 -0500 Subject: [PATCH 2/8] Add codespell config --- setup.cfg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setup.cfg b/setup.cfg index 8affa7b..15be690 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 +check-hidden = true +ignore-regex = ^\s*"image/\S+": ".* +ignore-words-list = te From 15bb0f127dbce1cff026d0251c1d8275ac463714 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:16:35 -0500 Subject: [PATCH 3/8] Temporarily allow "ancilliary" --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 15be690..cc14679 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,4 +35,4 @@ console_scripts = skip = .git*,data check-hidden = true ignore-regex = ^\s*"image/\S+": ".* -ignore-words-list = te +ignore-words-list = te,ancilliary From 69ac7524bf64c9e145971081576d435e0a18b764 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:16:39 -0500 Subject: [PATCH 4/8] [DATALAD RUNCMD] run codespell throughout fixing typos automagically (but ignoring overall fail due to ambigous ones) === Do not change lines below === { "chain": [], "cmd": "codespell -w || :", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- README.md | 2 +- ancilliary/earlreport.py | 2 +- notebooks/PrefixLib.ipynb | 2 +- notebooks/SPARQLEndpoints.ipynb | 2 +- notebooks/WikiSlurper.ipynb | 2 +- pyshex/shape_expressions_language/p5_3_shape_expressions.py | 4 ++-- pyshex/shape_expressions_language/p5_6_schema_requirements.py | 2 +- pyshex/shape_expressions_language/p5_context.py | 2 +- pyshex/shex_evaluator.py | 2 +- pyshex/utils/datatype_utils.py | 2 +- pyshex/utils/deprecated.py | 2 +- pyshex/utils/matchesEachOfEvaluator.py | 2 +- tests/test_primer/SPARQLEndpoints.py | 2 +- tests/test_pyshex_utils/test_partitions.py | 2 +- tests/test_support_libraries/local_context.py | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) 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/earlreport.py b/ancilliary/earlreport.py index 5cf25bf..84b9ee3 100644 --- a/ancilliary/earlreport.py +++ b/ancilliary/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..ebede9e 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", 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..2ae6a04 100644 --- a/pyshex/shape_expressions_language/p5_context.py +++ b/pyshex/shape_expressions_language/p5_context.py @@ -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/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_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(""" From 2eda3937ac1364be5272d2515a6d50ab3cc5c0c7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:17:17 -0500 Subject: [PATCH 5/8] [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- notebooks/PrefixLib.ipynb | 2 +- pyshex/shape_expressions_language/p5_context.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/PrefixLib.ipynb b/notebooks/PrefixLib.ipynb index ebede9e..3396c06 100644 --- a/notebooks/PrefixLib.ipynb +++ b/notebooks/PrefixLib.ipynb @@ -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/pyshex/shape_expressions_language/p5_context.py b/pyshex/shape_expressions_language/p5_context.py index 2ae6a04..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 = {} From f79b204cab9d580d2ab8894ebf348846eda28a78 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:17:40 -0500 Subject: [PATCH 6/8] Ignore notebook with many i18n words --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index cc14679..0648fd3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,7 @@ console_scripts = [codespell] # Ref: https://github.com/codespell-project/codespell#using-a-config-file # TODO: data/ actually might benefit from some typos fixed -skip = .git*,data +skip = .git*,data,WikiSlurper.ipynb check-hidden = true ignore-regex = ^\s*"image/\S+": ".* ignore-words-list = te,ancilliary From 73a2522eb8368ce65231ade87961e7e1c361eff5 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:18:41 -0500 Subject: [PATCH 7/8] Revert "Temporarily allow "ancilliary"" This reverts commit 15bb0f127dbce1cff026d0251c1d8275ac463714. --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 0648fd3..5031edd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,4 +35,4 @@ console_scripts = skip = .git*,data,WikiSlurper.ipynb check-hidden = true ignore-regex = ^\s*"image/\S+": ".* -ignore-words-list = te,ancilliary +ignore-words-list = te From e3c993286b567765585bc1528d82ccd224e39b3d Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Fri, 22 Nov 2024 09:19:26 -0500 Subject: [PATCH 8/8] [DATALAD RUNCMD] Fix (in text and rename folder) 'ancilliary' === Do not change lines below === { "chain": [], "cmd": "git mv ancilliary ancillary; codespell -w ./tests/utils/manifest_tester.py ./tests/test_shextest_validation/test_manifest_shex_shexc.py", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- {ancilliary => ancillary}/__init__.py | 0 {ancilliary => ancillary}/earlreport.py | 0 tests/test_shextest_validation/test_manifest_shex_shexc.py | 2 +- tests/utils/manifest_tester.py | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename {ancilliary => ancillary}/__init__.py (100%) rename {ancilliary => ancillary}/earlreport.py (100%) 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 100% rename from ancilliary/earlreport.py rename to ancillary/earlreport.py 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/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