| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
Replace bare `except:` with `except Exception`, there are some cases where it
can be narrowed further, but this is already an improvement over the current
situation.
This is somewhat pursuant to eliminating
[flakeheaven](https://github.com/flakeheaven/flakeheaven), as it no longer
supports the latest version of flake8
[[ref](https://github.com/flakeheaven/flakeheaven/issues/132)]. But it also is
just the right thing to do as bare exceptions can cause problems.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
Mainly so that users can use RDFLib in a safer way, and that we can make
safer changes to RDFLib in future.
There are also some accomodating type-hint related changes outside of `rdflib.util`.
This change does not have a runtime impact.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
| |
Since the names of empty graphs do not appear in the serialization, do not consider them for namespace issues.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The TriG serializer was only considering BNode references inside a single
graph and not counting the BNodes subjects as references when considering if a
BNode should be serialized as unlabeled blank nodes (i.e. `[ ]`), and as a
result it was serializing BNodes as unlabeled if they were in fact referencing
BNodes in other graphs.
One caveat of this change is that some RDF Datasets may be serialized
less succinctly in that unlabeled blank nodes would not be used nodes where it is
technically possible to use them. This can be trivially fixed, but a trivial fix
increases the computational complexity of serialization significantly.
Other changes:
- Removed the roundtrip xfail that this change fixed.
- Added another roundtrip test which has various combinations of BNode
references across graphs in a dataset, this test fails for JSON-LD
however, so while this change removes one xfail it also now adds
another.
- Set the default indent_size and style in `.editorconfig` as to avoid
relying on undefined system defaults.
|
|
|
|
|
|
|
|
|
| |
This file provides a single function `serialize_in_chunks()` which can serialize a
Graph into a number of NT files with a maximum number of triples or maximum file size.
There is an option to preserve any prefixes declared for the original graph in the first
file, which will be a Turtle file.
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
|
|
|
|
|
|
| |
Remove the extra newline generated by the N-Triples serializer and add
a unit test to verify that N-Triples output does not end in two
consecutive newlines.
Closes #1998
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch primarily adds more type hints for `rdflib.graph`, but also
adds type hints to some related modules in order to work with the new
type hints for `rdflib.graph`.
I'm mainly doing this as a baseline for adding type hints to
`rdflib.store`.
I have created type aliases to make it easier to type everything
consistently and to make type hints easier easier to change in the
future. The type aliases are private however (i.e. `_`-prefixed) and
should be kept as such for now.
This patch only contains typing changes and does not change runtime
behavior.
Broken off from https://github.com/RDFLib/rdflib/pull/1850
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
sonarcloud detected a bug: “Remove 1 unexpected arguments; 'join' expects 1 positional arguments.” in xmlwriter:
```py
return ":".join(pre, uri[len(ns) :])
```
Added containing brackets apparently omitted by original author.
```py
return ":".join([pre, uri[len(ns) :]])
```
Added test for surety, took the opportunity of adding two tests to take coverage of `xmlwriter` to 100%.
|
|
|
|
|
| |
invalid "+" operation between incompatible types (str and type) - [sonarcloud-reported bug](https://sonarcloud.io/project/issues?issues=AYDHhHV9L8VDMGmTmRtc&open=AYDHhHV9L8VDMGmTmRtc&id=RDFLib_rdflib)
Changed exception string construction to use `f""` format
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes two issues with the N3 serializer:
- The N3 serializer incorrectly considered a subject as already
serialized if it has been serialized inside a quoted graph.
- The N3 serializer does not consider that the predicate of
a triple can also be a graph.
Other changes included in this patch:
- Changed `test.testutils.GraphHelper` to support nested/quoted graphs.
- Moved the tests from `test/test_n3_formula.py` into
`test/test_serializers/test_serializer_n3.py`.
- Include positive syntax tests from the N3 test suite that is smaller
than 1024KB and that is not using new N3 syntax into round trip tests.
This is mainly to check that there is no regressions after the changes
made.
Fixes:
- https://github.com/RDFLib/rdflib/issues/1807
- https://github.com/RDFLib/rdflib/issues/1701
|
|
|
|
| |
for more information, see https://pre-commit.ci
|
|\
| |
| |
| |
| |
| |
| | |
ajnelson-nist/apply_identified_node_to_graph_iterators
Apply IdentifiedNode to Graph iterators
Merging with only one review as this just add type hints with one minor exception that involves well tested code.
|
| |
| |
| |
| | |
for more information, see https://pre-commit.ci
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Type checking passes now.
I also included some changes which reduces
the footprint of this change so that it becomes almost entirely just
change of type annotations.
This may be a bit on the pendatic side, and I would be fine if you keep
the changes as they were, but I would rather keep refactoring seperate from
changes to add typing.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This resolves type signature issues raised in the prior patch, but might
require a follow-on patch depending on `Path` discussion.
References:
* https://github.com/RDFLib/rdflib/issues/1696
Signed-off-by: Alex Nelson <alexander.nelson@nist.gov>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Brackets in pnames will now be escaped in output.
This fix is based on a suggestion by Niklas Lindström (@niklasl).
This is somewhat of a stopgap fix, there are some problems being
masked and various cases that could still result in questionable Turtle being
written out, however these can be addressed seperately.
|
|\ \
| | |
| | | |
Merging as fix is trivial and PR has one review.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Previously if `rdf:type` occurred in subject or object of a triple then
turtle would have not added a prefix for rdf as it considered `rdf:type`
to be a keyword regardless of where in the triple it occurred.
This changeset ensures that rdf:type is only considered a keyword if it
occurs as the predicate of a triple.
|
|\ \ \
| |_|/
|/| | |
Merging pull request as it contains only type changes and has one review.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This adds as much typing as possible to `rdflib.term`.
Other changes:
- Added back `warn_unused_ignores`. I actually thought this was enabled
but I forgot I disabled it because of some issue on python 3.10.
- Disabled `warn_unused_ignores` only for `rdflib.plugin`. There is an
ignore in this module which is not needed on python 3.10, this is the
most targetted way to avoid having that fail the type checking that I
can think of for now.
- Removed unused type ignores.
This changeset includes no runtime changes.
|
|/
|
|
| |
$ black --config black.toml .
|
|
|
| |
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
|
|
| |
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
| |
|
|\
| |
| | |
Add Py 3.10 to testing envs
|
| | |
|
|/ |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
hext format
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
This commit only adds type hints and comments and does not make any changes that
should affect runtime.
The type hints added here derive from work done for #1418.
|
| |
|