| 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.
|
|
|
|
|
|
|
|
| |
Disable
[`implicit_reexport`](https://mypy.readthedocs.io/en/stable/config_file.html#confval-implicit_reexport)
and eliminate all errors reported by mypy after this.
This helps ensure that import statements import from the right module and that
the `__all__` variable is correct.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
`XMLNS` was seen as unused in `rdflib/__init__.py` but this change adds it to
`__all__` in that module so that it is not unused.
This change also removes actual unused imports in
`rdflib/namespace/__init__.py`.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The namespaces bound by default by `rdflib.graph.Graph` and
`rdflib.namespace.NamespaceManager` was reduced in version 6.2.0 of RDFLib,
however, this also would cause code that worked with 6.1.1 to break, so this
constituted a breaking change. This change restores the previous behaviour,
binding the same namespaces as was bound in 6.1.1.
To bind a reduced set of namespaces, the `bind_namespaces` parameter of
`rdflib.graph.Graph` or `rdflib.namespace.NamespaceManager` can be used.
- Closes <https://github.com/RDFLib/rdflib/issues/2103>.
|
|
|
|
|
|
|
| |
The default prefix for `https://schema.org/` registered with
`rdflib.namespace.NamespaceManager` was inadvertently changed to `sdo` in 6.2.0,
this however constitutes a breaking change, as code that was using the `schema`
prefix would no longer have the same behaviour. This change changes the prefix
back to `schema`.
|
|
|
|
|
|
| |
<https://github.com/RDFLib/rdflib/pull/1686> inadvertently removed the `wgs` prefix.
This change adds it back.
- Closes <https://github.com/RDFLib/rdflib/issues/2196>.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* compute_qname handle case where name could be unbound
In NamespaceManager.compute_qname it is possible for the variable name
to be unbound when a namespace is used as a predicate e.g. ns2: and
the namespace itself cannot be split any further.
Fixing this usually just kicks the can down the road because the only
reason to hit this condition is that you are trying to serialize a
predicate that has no valid NCName form into an xml format that
requires one, making it impossible to complete the conversion.
That said, this fix should make it easier to understand what is going
on by unmasking the real issue.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* test_roundtrip.py and n3roundtrip suite add unbound name test
The new test graph will produce the UnboundLocalError with the old
code that is missing the name = '' assignment. The new code correctly
produces the xfail ValueError when trying to convert to xml.
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
|
|
| |
The standard prefix for DCTERMS is incorrectly cdterms but it should be dcterms. This is most likely a typo I made some time ago... Fixing now.
|
|
|
|
|
|
| |
New mypy version is reporting new errors.
In the long run we need to switch to poetry so we can better control
this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If `Store.bind` raises a `TypeError`, and the string conversion of this
TypeError contains `override`, then log a warning and call `Store.bind`
without an override.
This is done so that stores that do not accept `override` on
`Store.bind` still work, but at the cost of still having the bug that
was fixed by introducing the `override` parameter.
Also added a private flag which can be used to disable the fix entirely
and never use `override` when calling `Store.bind`.
- Fixes https://github.com/RDFLib/rdflib/issues/1880
|
|
|
|
| |
for more information, see https://pre-commit.ci
|
| |
|
|
|
|
| |
objects/messages.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently rdflib is relying on sphinx-autodoc's built in handling for type
hints, this however has some deficiencies as it does not handle stuff
inside `if TYPE_CHECKING:` and thus only work in cases where there are no
potential for circular dependencies.
This patch changes sphinx to use sphinx-autodoc-typehints instead, the
documentation generated by this plugin looks slightly different but as a
positive it correctly works with things defined inside `if TYPE_CHECKING:`
guards.
Also:
- moved the `_NamespaceSetString` type alias to `rdflib._type_checking`
This is so that `sphinx-autodoc-typehints` recognizes it up, as it
does not handle type aliases that are defined inside
`if TYPE_CHECKING:` guards in imported files.
- remove sphinx requirements from requirements.dev.txt and
replaced it with -r docs/sphinx-requirements.txt to reduce redundancy.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes `NamespaceManager.__init__` to raise a `ValueError`
when it receives an unsupported value for `bind_namespaces`.
Other changes:
- Added a Literal type for valid `bind_namespaces` values, with this
type checkers will raise an error if an invalid string is supplied as
an argument.
- Rename some variables/properties to have a underscore in front to make
it clear they are not part of the RDFLib public API.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch changes `DefinedNamespace` to always raise `AttributeError` for
the name `_NS` and other "control attributes" from `__getattr__`, and to
also not consider them as part of the `__dir__`.
Without doign this `inspect.signature` recurses
infinitely when inspecting `rdflib.namespace.DefinedNamespace` and `dir`
results in an `AttributeError`.
One situation in which this occurs is when sphinx autodoc is generating
documentation from type hints:
```
WARNING: error while formatting signature for rdflib.namespace.DefinedNamespace: Handler <function record_typehints at 0x7fbf2696dd40> for event 'autodoc-process-signature' threw an exception (exception: maximum recursion depth exceeded while calling a Python object)
```
Also:
- Changed `DefinedNamespace.__repr__` to use repr for formatting
the URI string instead of quoting by hand. This probably has no real effect,
as the namespace shoudl not have a double or single quote in it, but
it is still correct to use repr.
The main reason for this patch is to eliminate a warning for sphinx
which is blocking the build since `sphinx.fail_on_warning` was enabled.
There is also two cases in `DefinedNamespaceMeta` where an undefined
method is being called, these were causing type errors before, but I
added notes now to indicate they are real bugs, because if they are
reached they just result in `AttributeError` exceptions. This should be
fixed sometime, not sure what the reasoning behind it was.
|
|
|
|
| |
for more information, see https://pre-commit.ci
|
|\ |
|
| |
| |
| |
| | |
for more information, see https://pre-commit.ci
|
|\ \
| |/ |
|
| |\
| | |
| | | |
Generate JSON-LD context from a DefinedNamespace
|
| | | |
|
| | |\ |
|
| | | |
| | | |
| | | | |
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
| | | | |
|
| | | |
| | | |
| | | | |
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
| | | | |
|
| | | |
| | | |
| | | | |
Co-authored-by: Iwan Aucamp <aucampia@gmail.com>
|
| | | |
| | | |
| | | |
| | | | |
for more information, see https://pre-commit.ci
|
|\ \ \ \
| |/ / / |
|
| | |/
| |/| |
|
| | |
| | |
| | |
| | |
| | |
| | | |
replace and override handling is now correct as far as I can tell.
Also added some tests.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|