summaryrefslogtreecommitdiff
path: root/rdflib/extras
Commit message (Collapse)AuthorAgeFilesLines
* refactor: eliminate inheritance from object (#2339)Iwan Aucamp2023-04-102-4/+4
| | | | | 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-3/+2
| | | | | | | 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: diverse type hints (#2264)Iwan Aucamp2023-03-121-12/+18
| | | | | | | Add some small diverse type hints. Type hints make RDFLib safer to use and change, as changes and usage can be validated using static analysers like mypy. This change does not have a runtime impact.
* build(deps-dev): bump black from 22.12.0 to 23.1.0 (#2248)dependabot[bot]2023-03-111-1/+1
|
* docs: fix sphinx nitpicky issues (#2036)Iwan Aucamp2022-07-182-10/+10
| | | | | | | | | | | | | Enable nitpicky mode for Sphinx and fix all warnings and errors that occur when running with nitpicky enabled. Other changes: - Add a tox environment for building docs (-docs). This is so we can test building docs on various versions of python as there seems to be some differences in warnings between different versions. This tox environment is enabled for linux CI builds. - Change readthedocs to use python 3.9 as earlier versions do not handle `@typing.overload` with type aliases. - Fixes https://github.com/RDFLib/rdflib/issues/1878
* fix: InfixOWL: eliminate use of mutable data structures in args (#2033)Graham Higgins2022-07-181-17/+19
| | | | | | | | | | | | | | | Maintenance-positive changes recommended by [flake8-bugbear](https://pypi.org/project/flake8-bugbear/), mostly explicitly indicating unused loop variables with a prefixing underscore (it identified one case where _none_ of the loop variables were being used) and a couple of don't-use-mutable-objects-as-args instances. 1. Added leading underscore to unused loop variables, removed mutable objects from args, (replacing with None and then performing an explicit “if None” assignment in the body of the method). 2. Swapped out an excessively weak, coverage-motivated length test of __hash__() (which was causing intermittent test failures) for an equality test of two runs, fixes issue #2030
* fix: InfixOWL fixes and cleanup (#2024)Graham Higgins2022-07-171-65/+155
| | | | | | | | | | | | | | | | | | | | | - InfixOWL fixes and cleanup. [PR #2024](https://github.com/RDFLib/rdflib/pull/2024). - `rdflib.extras.infixowl.Restriction.__init__` will now raise a `ValueError` if there is no restriction value instead of an `AssertionError`. - Fixed numerous issues with `rdflib.extras.infixowl.Restriction.restrictionKind` which was essentially not working at all. - Fixed how `rdflib.extras.infixowl.Property.__repr__` uses `rdflib.namespace.OWL`. - Removed `rdflib.extras.infixowl.Infix.__ror__` and `rdflib.extras.infixowl.Infix.__or__` as they were broken. - Removed unused `rdflib.extras.infixowl.termDeletionDecorator`. - Added `rdflib.extras.infixowl.MalformedClassError` which will replace `rdflib.extras.infixowl.MalformedClass` (which is an exception) in the next major version. Final stage of update to InfixOWL, removing unused code, tidying, adding some docu-comments, minor improvements in robustness, updating previously-failing tests, adding more tests. Expanded documentation to follow. Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
* Continuation of infixowl update and coverage improvement (#2001)Graham Higgins2022-07-131-288/+278
| | | Update of infixowl including a couple of minor run-time changes to avoid exceptions currently xfailing.
* Infixowl cleanup (#1996)Graham Higgins2022-06-231-7/+7
| | | Whitespace gardening for `rdflb/extras/infixowl.py` and additional tests.
* Add line-specific # noqa, remove exclusion from pyproject.toml (#1994)Graham Higgins2022-06-181-174/+216
| | | Preparation for further work.
* fix outmoded `x and x or y` idiom in `infixowl.py` (#1943)Graham Higgins2022-05-251-9/+9
| | | | Change `x and x or y` idiom for modern, clearer `y if x is None else x`, as suggested by sonarcloud analysis
* Remove testing and debug code from rdflibIwan Aucamp2022-04-191-10/+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-3/+3
| | | | for more information, see https://pre-commit.ci
* Add isort (#1689)eggplants2022-02-212-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | * add: isort configure file * fix: isort $ isort . * add: isort to dev deps * add: isort to CI * fix: move .isort.cfg into setup.cfg * fix: re-formatted * fix: isort target path * Use pre-commit to check isort pre-commit CI can auto fix this, and this way we can idenpendently evaluate the formatting of the code from the validity of the code. Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
* Merge branch 'RDFLib:master' into fix-for-issue1453-and-owlinfixGraham Higgins2021-12-291-2/+2
|\
| * re-do, including changes from aucampia's PRGraham Higgins2021-12-151-2/+2
| |
* | shift delimiters gobbled up by SPARQL*, sighGraham Higgins2021-12-281-0/+6
| |
* | Fix for issue 1453 and 944Graham Higgins2021-12-251-41/+42
|/ | | | Tranlate/transcribe doctests as pytests in separate file as a foundation for developing some unit tests, unskip doctests
* Merge pull request #1452 from iafork/iwana-20211018T2122-pytestNicholas Car2021-11-191-11/+0
|\ | | | | Migrate from nosetest to pytest
| * Migrate from nosetest to pytestIwan Aucamp2021-10-241-11/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replace all uses of nose with pytest. It also includes a pytest plugin for creating EARL reports for tests with a `rdf_test_uri` parameter. Some caveats: - HTML report directory is now htmlcov instead of coverage - There is some warning related to the EARL reporting plugin which I can't quite figure out: ``` .venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676 /home/iwana/sw/d/github.com/iafork/rdflib/.venv/lib64/python3.7/site-packages/_pytest/config/__init__.py:676: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: test.earl self.import_plugin(import_spec) ``` This is not causing any problems as far as I can tell, but still annoying. - python setup.py test won't work anymore, I can make it work but this is not advised by pytest: https://github.com/pytest-dev/pytest-runner/#deprecation-notice - run_test.py is still there but it's not really referenced anymore from anywhere and the options it accepts are completely different as it's options were based on nose. I would say it should be removed entirely but for now it is basically just a wrapper around pytest that basically does nothing. - Removed references to test attributes as currently they are not being used anywhere anyway, I guess we can add them back if there is some use for them later. - A lot of tests are still marked to skip when really they should be marked with xfail. This is also affecting the RDFT test manifests and result in reports saying tests are skipped when really we know they will fail and they are only skipped for this reason. But there is no change here from before, and pytest makes it easier to dynamically do expected failures. Special thanks to Wes Turner for his advice and inputs on this process.
* | Stringify OWL Namespace object where a string is required.Graham Higgins2021-11-151-3/+3
|/
* Fix mypy type errors and add mypy to .drone.ymlIwan Aucamp2021-09-101-3/+0
| | | | | | | | | | | | | | | | | | | | | Fixes #1311 Add `mypy` to .drone.yml and fix type errors that come up. Not type checking examples or tests. Other changes: - fix return value for `Graph.serialize` (refs #1394) - remove default value for `rdflib.plugins.sparql.algebra.translateAlgebra` (refs #1322) - add .dockerignore to reduce context size and make docker quicker to run. - add .flake8 config to ignore line length as black is managing formatting. - add mypy to docker-compose, makefile and tox.ini - fix the way csv2rdf is invoked to ensure that the right code gets executed.
* blacked everything6.0.0Nicholas Car2021-07-202-19/+14
|
* fix docc build warningsNicholas Car2021-07-152-225/+225
|
* Add mypy to CI pipelines and fix errors it raisesIwan Aucamp2021-05-301-3/+3
|
* re-run blackAshley Sommer2020-08-271-20/+20
|
* Merge remote-tracking branch 'origin/master' into t0b3_masterAshley Sommer2020-08-271-1/+1
|\ | | | | | | | | | | | | | | | | # Conflicts: # rdflib/namespace.py # rdflib/parser.py # rdflib/plugins/memory.py # rdflib/plugins/parsers/ntriples.py # test/test_iomemory.py
| * improved Graph().parse()Nicholas Car2020-08-141-1/+1
| |
* | 2to3 whole sourcebaset0b32020-06-223-33/+21
|/ | | | Signed-off-by: t0b3 <thomas.bettler@gmail.com>
* changes for flake8Nicholas Car2020-05-171-3/+3
|
* blacked all python filesNicholas Car2020-05-164-541/+602
|
* removal of all uses of package sixNicholas Car2020-05-161-3/+3
|
* fix shebang typot0b32020-05-021-1/+1
| | | | Signed-off-by: t0b3 <thomas.bettler@gmail.com>
* add python 3.8, drop python 2 and 3.4t0b32020-04-261-1/+1
| | | | | | Closes: https://github.com/RDFLib/rdflib/issues/1014 Signed-off-by: t0b3 <thomas.bettler@gmail.com>
* Merge pull request #906 from tgbugs/infixowl-manchester-encodingNicholas Car2020-03-161-4/+4
|\ | | | | infixowl.manchesterSyntax do not encode strings
| * infixowl.manchesterSyntax do not encode stringsTom Gillespie2019-04-021-4/+4
| | | | | | | | | | | | | | | | | | | | | | The manchesterSyntax function in infixowl was encoding some but not all string typed objects to bytes, this commit removes the remaining cases where the encoding was being done. This caused internal errors like the one below whenever one tried to repr infixowl classes. File "rdflib/extras/infixowl.py", line 1291, in __repr__ for s in dc])) TypeError: sequence item 0: expected str instance, bytes found
* | replace foaf:surname (deprecated) with foaf:familyName in examples and testsNicholas Car2020-03-061-2/+2
| |
* | replace foaf:firstName (deprecated) with foaf:givenName in examples and testsNicholas Car2020-03-061-2/+2
|/
* a slightly opinionated autopep8 runGunnar Aastrand Grimnes2018-10-303-35/+43
| | | | | | | | opinions is mainly: no to long lines, but not at any cost. notation3.py crashses autopep :D Also rdflib/__init__.py gets completely broken
* remove format_doctest from py3compatGunnar Aastrand Grimnes2017-01-312-24/+24
| | | | replaced with doctest-ignore-unicode noseplugin
* removed most of the six import from py3compatGunnar Aastrand Grimnes2017-01-302-3/+3
| | | | now six is used throughout.
* converted last test filesGunnar Aastrand Grimnes2017-01-301-1/+1
|
* six: extras/infixowl.py: headersJoern Hees2017-01-301-5/+10
|
* six: extras/describer.py: headers, rel importsJoern Hees2017-01-301-4/+6
|
* DOC: unamed -> unnamedYaroslav Halchenko2015-12-101-1/+1
|
* make external_graph_libs tests optional (only run if ext lib is installed)Joern Hees2015-03-181-4/+5
| | | | | | | | networkx shouldn't be a dependency of rdflib just to run tests. Also graph_tool heavily depends on C libs and can't easily be installed via pip (or via apt-get on travis). Hence, the doctests are duplicated into proper tests that auto skip if networkx or graph_tool can't be imported.
* code to convert an rdflib.Graph into a graph_tool.GraphJoern Hees2015-03-151-0/+101
|
* edge attributes as callables, transformation functions and refactoringJoern Hees2015-03-101-49/+110
|
* exclude some `def main():` functions from test coverage analysisJoern Hees2015-03-091-1/+1
|
* code to convert an rdflib.Graph into networkx.((Multi)Di)GraphJoern Hees2015-03-091-0/+183
|