<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/rdflib.git/test/test_graph, branch main</title>
<subtitle>github.com: rdflib/rdflib.git
</subtitle>
<link rel='alternate' type='text/html' href='http://git.baserock.org/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://git.baserock.org/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://git.baserock.org/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://git.baserock.org/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://git.baserock.org/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://git.baserock.org/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: 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://git.baserock.org/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: IRI to URI conversion (#2304)</title>
<updated>2023-03-23T17:48:14+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-03-23T17:48:14+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/rdflib.git/commit/?id=dfa40545adc3e701bc36d2f8cc4dba1d81a906c4'/>
<id>dfa40545adc3e701bc36d2f8cc4dba1d81a906c4</id>
<content type='text'>
The URI to IRI conversion was percentage-quoting characters that should not have
been quoted, like equals in the query string. It was also not quoting things
that should have been quoted, like the username and password components of a
URI.

This change improves the conversion by only quoting characters that are not
allowed in specific parts of the URI and quoting previously unquoted components.
The safe characters for each segment are taken from
[RFC3986](https://datatracker.ietf.org/doc/html/rfc3986).

The new behavior is heavily inspired by
[`werkzeug.urls.iri_to_uri`](https://github.com/pallets/werkzeug/blob/92c6380248c7272ee668e1f8bbd80447027ccce2/src/werkzeug/urls.py#L926-L931)
though there are some differences.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2120&gt;.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The URI to IRI conversion was percentage-quoting characters that should not have
been quoted, like equals in the query string. It was also not quoting things
that should have been quoted, like the username and password components of a
URI.

This change improves the conversion by only quoting characters that are not
allowed in specific parts of the URI and quoting previously unquoted components.
The safe characters for each segment are taken from
[RFC3986](https://datatracker.ietf.org/doc/html/rfc3986).

The new behavior is heavily inspired by
[`werkzeug.urls.iri_to_uri`](https://github.com/pallets/werkzeug/blob/92c6380248c7272ee668e1f8bbd80447027ccce2/src/werkzeug/urls.py#L926-L931)
though there are some differences.

- Closes &lt;https://github.com/RDFLib/rdflib/issues/2120&gt;.</pre>
</div>
</content>
</entry>
<entry>
<title>build(deps-dev): bump mypy from 1.0.1 to 1.1.1 (#2274)</title>
<updated>2023-03-19T15:16:04+00:00</updated>
<author>
<name>dependabot[bot]</name>
<email>49699333+dependabot[bot]@users.noreply.github.com</email>
</author>
<published>2023-03-19T15:16:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/rdflib.git/commit/?id=192e6d11147963a3066faec43323991c9b73f7b5'/>
<id>192e6d11147963a3066faec43323991c9b73f7b5</id>
<content type='text'>
build(deps-dev): bump mypy from 1.0.1 to 1.1.1

Bumps [mypy](https://github.com/python/mypy) from 1.0.1 to 1.1.1.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v1.0.1...v1.1.1)

updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor

Also added type ignores for newly detected type errors.

Signed-off-by: dependabot[bot] &lt;support@github.com&gt;
Co-authored-by: dependabot[bot] &lt;49699333+dependabot[bot]@users.noreply.github.com&gt;
Co-authored-by: Iwan Aucamp &lt;aucampia@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
build(deps-dev): bump mypy from 1.0.1 to 1.1.1

Bumps [mypy](https://github.com/python/mypy) from 1.0.1 to 1.1.1.
- [Release notes](https://github.com/python/mypy/releases)
- [Commits](https://github.com/python/mypy/compare/v1.0.1...v1.1.1)

updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:development
  update-type: version-update:semver-minor

Also added type ignores for newly detected type errors.

Signed-off-by: dependabot[bot] &lt;support@github.com&gt;
Co-authored-by: dependabot[bot] &lt;49699333+dependabot[bot]@users.noreply.github.com&gt;
Co-authored-by: Iwan Aucamp &lt;aucampia@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>build(deps-dev): bump black from 22.12.0 to 23.1.0 (#2248)</title>
<updated>2023-03-11T12:40:15+00:00</updated>
<author>
<name>dependabot[bot]</name>
<email>49699333+dependabot[bot]@users.noreply.github.com</email>
</author>
<published>2023-03-11T12:40:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/rdflib.git/commit/?id=fcfa4950426719ef62e231147f5fa098f58272c6'/>
<id>fcfa4950426719ef62e231147f5fa098f58272c6</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fix: small InputSource related issues (#2255)</title>
<updated>2023-03-10T23:19:42+00:00</updated>
<author>
<name>Iwan Aucamp</name>
<email>aucampia@gmail.com</email>
</author>
<published>2023-03-10T23:19:42+00:00</published>
<link rel='alternate' type='text/html' href='http://git.baserock.org/cgit/delta/python-packages/rdflib.git/commit/?id=2b98507cf9c7d362e37776bda7e1ea79b63d01e4'/>
<id>2b98507cf9c7d362e37776bda7e1ea79b63d01e4</id>
<content type='text'>
I have added a bunch of tests for `InputSource` handling, checking
most kinds of input source with most parsers. During this, I detected
the following issues that I fixed:

- `rdflib.util._iri2uri()` was URL quoting the `netloc` parameter, but
  this is wrong and the `idna` encoding already takes care of special
  characters. I removed the URL quoting of `netloc`.

- HexTuple parsing was handling the input source in a way that would
  only work for some input sources, and not raising errors for other
  input sources. I changed the input source handling to be more generic.

- `rdflib.parser.create_input_source()` incorrectly used `file.buffer`
  instead of `source.buffer` when dealing with IO stream sources.

Other changes with no runtime impact include:

- Changed the HTTP mocking stuff in test slightly to accommodate
  serving arbitrary files, as I used this in the `InputSource` tests.
- Don't use Google in tests, as we keep getting
  `urllib.error.HTTPError: HTTP Error 429: Too Many Requests`
  from it.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I have added a bunch of tests for `InputSource` handling, checking
most kinds of input source with most parsers. During this, I detected
the following issues that I fixed:

- `rdflib.util._iri2uri()` was URL quoting the `netloc` parameter, but
  this is wrong and the `idna` encoding already takes care of special
  characters. I removed the URL quoting of `netloc`.

- HexTuple parsing was handling the input source in a way that would
  only work for some input sources, and not raising errors for other
  input sources. I changed the input source handling to be more generic.

- `rdflib.parser.create_input_source()` incorrectly used `file.buffer`
  instead of `source.buffer` when dealing with IO stream sources.

Other changes with no runtime impact include:

- Changed the HTTP mocking stuff in test slightly to accommodate
  serving arbitrary files, as I used this in the `InputSource` tests.
- Don't use Google in tests, as we keep getting
  `urllib.error.HTTPError: HTTP Error 429: Too Many Requests`
  from it.</pre>
</div>
</content>
</entry>
</feed>
