<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/rdflib.git/test, branch main</title>
<subtitle>github.com: rdflib/rdflib.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/'/>
<entry>
<title>fix: HTTP 308 Permanent Redirect status code handling (#2389)</title>
<updated>2023-05-17T16:51:55+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-05-17T16:51:55+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=e0b3152a799e7bb04770fcddf010b22c0b05379e'/>
<id>e0b3152a799e7bb04770fcddf010b22c0b05379e</id>
<content type='text'>
Change the handling of HTTP status code 308 to behave more like
`urllib.request.HTTPRedirectHandler`, most critically, the new 308 handling will
create a new `urllib.request.Request` object with the new URL, which will
prevent state from being carried over from the original request.

One case where this is important is when the domain name changes, for example,
when the original URL is `http://www.w3.org/ns/adms.ttl` and the redirect URL is
`https://uri.semic.eu/w3c/ns/adms.ttl`. With the previous behaviour, the redirect
would contain a `Host` header with the value `www.w3.org` instead of
`uri.semic.eu` because the `Host` header is placed in
`Request.unredirected_hdrs` and takes precedence over the `Host` header in
`Request.headers`.

Other changes:
- Only handle HTTP status code 308 on Python versions before 3.11 as Python 3.11
  will handle 308 by default [[ref](https://docs.python.org/3.11/whatsnew/changelog.html#id128)].
- Move code which uses `http://www.w3.org/ns/adms.ttl` and
  `http://www.w3.org/ns/adms.rdf` out of `test_guess_format_for_parse` into a
  separate parameterized test, which instead uses the embedded http server.

  This allows the test to fully control the `Content-Type` header in the
  response instead of relying on the value that the server is sending.

  This is needed because the server is sending `Content-Type: text/plain` for
  the `adms.ttl` file, which is not a valid RDF format, and the test is
  expecting `Content-Type: text/turtle`.

Fixes:
- &lt;https://github.com/RDFLib/rdflib/issues/2382&gt;.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change the handling of HTTP status code 308 to behave more like
`urllib.request.HTTPRedirectHandler`, most critically, the new 308 handling will
create a new `urllib.request.Request` object with the new URL, which will
prevent state from being carried over from the original request.

One case where this is important is when the domain name changes, for example,
when the original URL is `http://www.w3.org/ns/adms.ttl` and the redirect URL is
`https://uri.semic.eu/w3c/ns/adms.ttl`. With the previous behaviour, the redirect
would contain a `Host` header with the value `www.w3.org` instead of
`uri.semic.eu` because the `Host` header is placed in
`Request.unredirected_hdrs` and takes precedence over the `Host` header in
`Request.headers`.

Other changes:
- Only handle HTTP status code 308 on Python versions before 3.11 as Python 3.11
  will handle 308 by default [[ref](https://docs.python.org/3.11/whatsnew/changelog.html#id128)].
- Move code which uses `http://www.w3.org/ns/adms.ttl` and
  `http://www.w3.org/ns/adms.rdf` out of `test_guess_format_for_parse` into a
  separate parameterized test, which instead uses the embedded http server.

  This allows the test to fully control the `Content-Type` header in the
  response instead of relying on the value that the server is sending.

  This is needed because the server is sending `Content-Type: text/plain` for
  the `adms.ttl` file, which is not a valid RDF format, and the test is
  expecting `Content-Type: text/turtle`.

Fixes:
- &lt;https://github.com/RDFLib/rdflib/issues/2382&gt;.</pre>
</div>
</content>
</entry>
<entry>
<title>test: Eliminate flake8 errors in tests (#2353)</title>
<updated>2023-04-14T19:26:10+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-04-14T19:26:10+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=cbd61510ec581aee262bc2bb8ad95d94f7784842'/>
<id>cbd61510ec581aee262bc2bb8ad95d94f7784842</id>
<content type='text'>
Eliminate some occurrences of the following flake8 errors in tests:

* E265 block comment should start with '# '
* E266 too many leading '#' for block comment
* E402 module level import not at top of file
* E712 comparison to False should be 'if cond is False:' or 'if not cond:'
* E712 comparison to True should be 'if cond is True:' or 'if cond:'
* E722 do not use bare 'except'
* F401 ... imported but unused
* F403 ... used; unable to detect undefined names
* F405 ... may be undefined, or defined from star imports: ...
* F541 f-string is missing placeholders
* F841 local variable 'result' is assigned to but never used
* N806 variable 'TEST_DIR' in function should be lowercase

This is 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)].</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Eliminate some occurrences of the following flake8 errors in tests:

* E265 block comment should start with '# '
* E266 too many leading '#' for block comment
* E402 module level import not at top of file
* E712 comparison to False should be 'if cond is False:' or 'if not cond:'
* E712 comparison to True should be 'if cond is True:' or 'if cond:'
* E722 do not use bare 'except'
* F401 ... imported but unused
* F403 ... used; unable to detect undefined names
* F405 ... may be undefined, or defined from star imports: ...
* F541 f-string is missing placeholders
* F841 local variable 'result' is assigned to but never used
* N806 variable 'TEST_DIR' in function should be lowercase

This is 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)].</pre>
</div>
</content>
</entry>
<entry>
<title>fix: correct imports and `__all__` (#2340)</title>
<updated>2023-04-12T20:10:43+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-04-12T20:10:43+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=7df77cd3fa0381ae2b309981230eaa0d42e90b79'/>
<id>7df77cd3fa0381ae2b309981230eaa0d42e90b79</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>feat: add optional `target_graph` argument to `Graph.cbd` and use it  for DESCRIBE queries (#2322)</title>
<updated>2023-04-11T21:12:27+00:00</updated>
<author>
<name>Matt Goldberg</name>
<email>59745812+mgberg@users.noreply.github.com</email>
</author>
<published>2023-04-11T21:12:27+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=81d13d432b7e49b557b5de11691bdeaed31a9b06'/>
<id>81d13d432b7e49b557b5de11691bdeaed31a9b06</id>
<content type='text'>
Add optional keyword only `target_graph` argument to `rdflib.graph.Graph.cbd` and use this new argument in `evalDescribeQuery`.

This makes it possible to compute a concise bounded description without creating a new graph to hold the result, and also without potentially having to copy it to another final graph.

Co-authored-by: Iwan Aucamp &lt;aucampia@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add optional keyword only `target_graph` argument to `rdflib.graph.Graph.cbd` and use this new argument in `evalDescribeQuery`.

This makes it possible to compute a concise bounded description without creating a new graph to hold the result, and also without potentially having to copy it to another final graph.

Co-authored-by: Iwan Aucamp &lt;aucampia@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>refactor: eliminate inheritance from object (#2339)</title>
<updated>2023-04-10T10:08:55+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-04-10T10:08:55+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=20f1235d5f3b639a47cad59967fe93ed9e41dd90'/>
<id>20f1235d5f3b639a47cad59967fe93ed9e41dd90</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>fix: `ROUND`, `ENCODE_FOR_URI` and `SECONDS` SPARQL functions (#2314)</title>
<updated>2023-03-26T10:55:44+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-03-26T10:55:44+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=af179169a8bdf7270613e92ff7a92adf5b844681'/>
<id>af179169a8bdf7270613e92ff7a92adf5b844681</id>
<content type='text'>
`ROUND` was not correctly rounding negative numbers towards positive infinity,
`ENCODE_FOR_URI` incorrectly treated `/` as safe, and `SECONDS` did not include
fractional seconds.

This change corrects these issues.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2151&gt;.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`ROUND` was not correctly rounding negative numbers towards positive infinity,
`ENCODE_FOR_URI` incorrectly treated `/` as safe, and `SECONDS` did not include
fractional seconds.

This change corrects these issues.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2151&gt;.</pre>
</div>
</content>
</entry>
<entry>
<title>fix: restore the 6.1.1 default bound namespaces (#2313)</title>
<updated>2023-03-26T10:53:29+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-03-26T10:53:29+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=57bb42886b57a37f1ba93a4d1b52651d978d049c'/>
<id>57bb42886b57a37f1ba93a4d1b52651d978d049c</id>
<content type='text'>
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 &lt;https://github.com/RDFLib/rdflib/issues/2103&gt;.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;https://github.com/RDFLib/rdflib/issues/2103&gt;.</pre>
</div>
</content>
</entry>
<entry>
<title>fix: reference to global inside `get_target_namespace_elements` (#2311)</title>
<updated>2023-03-25T17:47:59+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-03-25T17:47:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=4da67f9a17ffe8fa128afcdd2259e337bccafaa3'/>
<id>4da67f9a17ffe8fa128afcdd2259e337bccafaa3</id>
<content type='text'>
`get_target_namespace_elements` references the `args` global, which is not
defined if the function is called from outside the module. This commit fixes
that instead referencing the argument passed to the function.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2072&gt;.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`get_target_namespace_elements` references the `args` global, which is not
defined if the function is called from outside the module. This commit fixes
that instead referencing the argument passed to the function.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2072&gt;.</pre>
</div>
</content>
</entry>
<entry>
<title>fix: Add `to_dict` method to the JSON-LD `Context` class. (#2310)</title>
<updated>2023-03-25T17:47:20+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-03-25T17:47:20+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=d7883eb494673d0fb09efa3bced983ebb48b6961'/>
<id>d7883eb494673d0fb09efa3bced983ebb48b6961</id>
<content type='text'>
`Context.to_dict` is used in JSON-LD serialization, but it was not implemented.
This change adds the method.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2138&gt;.

---------

Co-authored-by: Marc-Antoine Parent &lt;maparent@acm.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
`Context.to_dict` is used in JSON-LD serialization, but it was not implemented.
This change adds the method.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2138&gt;.

---------

Co-authored-by: Marc-Antoine Parent &lt;maparent@acm.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>fix: change the prefix for `https://schema.org/` back to `schema` (#2312)</title>
<updated>2023-03-25T17:46:05+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-03-25T17:46:05+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/rdflib.git/commit/?id=3faa01bf169166afa68be8084f16b537d850a070'/>
<id>3faa01bf169166afa68be8084f16b537d850a070</id>
<content type='text'>
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`.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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`.</pre>
</div>
</content>
</entry>
</feed>
