summaryrefslogtreecommitdiff
path: root/rdflib/plugins/sparql/parserutils.py
Commit message (Collapse)AuthorAgeFilesLines
* refactor: eliminate inheritance from object (#2339)Iwan Aucamp2023-04-101-1/+1
| | | | | This change removes the redundant inheritance from `object` (i.e. `class Foo(object): pass`) that is no longer needed in Python 3 and is a relic from Python 2.
* refactor: narrow imports (#2338)Iwan Aucamp2023-04-101-2/+1
| | | | | | | This change narrows import so that things are imported from the Python module where they are defined instead of importing them from a module that re-exports them, e.g. change import of `Graph` to import from the `rdflib.graph` module instead of from the `rdflib` module. This helps avoid problems with circular imports.
* feat: more type hints for `rdflib.plugins.sparql` (#2268)Iwan Aucamp2023-03-131-20/+50
| | | | | | | | | | | | | | | | | | | A bit of a roundabout reason why this matters now, but basically: I want to add examples for securing RDFLib with `sys.addaudithook` and `urllib.request.install_opener`. I also want to be sure examples are actually valid, and runnable, so I was adding static analysis and simple execution of examples to our CI. During this, I noticed that examples use `initBindings` with `Dict[str,...]`, which was not valid according to mypy, but then after some investigation I realized the type hints in some places were too strict. So the main impetus for this is actually to relax the type hints in `rdflib.graph`, but to ensure this is valid I'm adding a bunch of type hints I had saved up to `rdflib.plugins.sparql`. Even though this PR looks big, it has no runtime changes.
* fix: add more type-hinting for SPARQL plugin (#2265)Jeffrey C. Lerman2023-03-121-13/+22
| | | | | | | | | | | | | | Here, adding type-hints to some of the SPARQL parser plugin code. Includes a couple of small consequent changes: 1. Minor refactor of `prettify_parsetree()`, separating the public-facing callable from the internal code that does not need to be public-facing. That allows the public-facing callable to have more informative and restrictive type-hints for its arguments. 2. Added some test-coverage for `expandUnicodeEscapes()` - initially for my own understanding, but seems useful to leave it in place since I didn't see test-coverage for that function. There should be no backwards-incompatible changes in this PR - at least, not intentionally. --------- Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
* refactor: remove redundant class (#2143)Veyndan Stuart2022-11-191-7/+1
| | | `rdflib.plugins.sparql.parserutils.plist` has no good purpose.
* Add more typing for SPARQL (#1965)Iwan Aucamp2022-05-261-3/+17
| | | | | | | | | This adds typing to `rdflib/plugins/sparql/algebra.py` and `rdflib/plugins/sparql/parserutils.py`. This is mainly being done to help detect issues in the new PRs that were recently opened that relate to SPARQL. This patch contain no runtime changes.
* style: fix/ignore flake8 errors in `rdflib/plugins/sparql/` (#1964)Iwan Aucamp2022-05-211-1/+1
| | | | | | | These will eventually come up once `flakeheaven` baseline expires. The actual problems should be fixed in conjunction with tests. Only fixes are related to unused imports.
* Remove testing and debug code from rdflibIwan Aucamp2022-04-191-14/+0
| | | | | | | | | | | | | | This patch removes code from `rdflib/` that does not seem like it belongs in `rdflib/`, most of it is related to doctest, some of it belongs in `test/` and was moved to `test/test_misc/test_collection.py`, and yet more of it seems to just be there for debugging purposes, though it would possibly be better to put that in a separate place if it is needed again or to debug using tests if possible. Other changes: - Removed an invocation of `rdflib.util.test` from `test_util.py`. This seems like an attempt to invoke doctest however pytest takes care of that so this is not needed.
* [pre-commit.ci] auto fixes from pre-commit.com hookspre-commit-ci[bot]2022-04-151-5/+5
| | | | for more information, see https://pre-commit.ci
* Fix typos discovered by codespellChristian Clauss2021-10-141-2/+2
|
* Use setName on TokenConverter to set the name propertyIwan Aucamp2021-09-111-7/+2
| | | | | | This works for both pyparsing 2 and 3. Fixes #1370
* small cleanupsFlorian Ludwig2020-10-231-1/+1
|
* changes for flake8Nicholas Car2020-05-171-2/+2
|
* blacked all python filesNicholas Car2020-05-161-12/+12
|
* run service querymarqh2019-12-021-2/+9
|
* a slightly opinionated autopep8 runGunnar Aastrand Grimnes2018-10-301-23/+25
| | | | | | | | opinions is mainly: no to long lines, but not at any cost. notation3.py crashses autopep :D Also rdflib/__init__.py gets completely broken
* converted sparql engineGunnar Aastrand Grimnes2017-01-301-3/+3
|
* removed compat code for supporting legacy python versionsGunnar Aastrand Grimnes2017-01-271-1/+1
|
* prettify parsetreeJoern Hees2017-01-181-0/+25
| | | | helper method to actually look at parsetrees containing CompValues, dicts and lists
* Fix initBindings handling. Fixes #294initbindings-fixGunnar Aastrand Grimnes2015-11-281-0/+3
| | | | | | | | This changes initBinding handling from adding values in the context object, to actually changing the query algebra and inserting a values clause in the right place. This also adds a bunch of tests.
* Immigrate rdflib-sparql (plus some prefiguring changes)Graham Higgins2013-03-211-0/+255