Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused compatability function #1768

Conversation

aucampia
Copy link
Member

Summary of changes

This patch removes rdflib.compat.etree_register_namespace which was
needed before xml.etree.register_namespace was added in python 3.2,
however there is no code that uses it as is, so it serves no purpose
anymore.

$ \rm -rf /var/tmp/rdflib-clean/
$ git clone --depth 1 --branch master git@github.com:RDFLib/rdflib.git /var/tmp/rdflib-clean/
Cloning into '/var/tmp/rdflib-clean'...
remote: Enumerating objects: 5392, done.
remote: Counting objects: 100% (5392/5392), done.
remote: Compressing objects: 100% (3837/3837), done.
remote: Total 5392 (delta 1213), reused 4996 (delta 1172), pack-reused 0
Receiving objects: 100% (5392/5392), 1.98 MiB | 1013.00 KiB/s, done.
Resolving deltas: 100% (1213/1213), done.
$ grep --exclude-dir={.tox,__pycache__,_build,build} -ri -e etree_register_namespace -e _namespace_map /var/tmp/rdflib-clean/
/var/tmp/rdflib-clean/rdflib/compat.py:    etree_register_namespace = etree.register_namespace
/var/tmp/rdflib-clean/rdflib/compat.py:    def etree_register_namespace(prefix, uri):
/var/tmp/rdflib-clean/rdflib/compat.py:        etreenative._namespace_map[uri] = prefix
$

I'm removing this primarily because it causes problems when running
pytype on rdflib:

$ .venv/bin/pytype rdflib
...
File "/home/iwana/sw/d/github.com/iafork/rdflib.typing/rdflib/compat.py", line 28, in etree_register_namespace: No attribute '_namespace_map' on module 'xml.etree.ElementTree' [module-attr]
...

Checklist

  • Checked that there aren't other open pull requests for
    the same change.
  • Checked that all tests and type checking passes.
  • Considered granting push permissions to the PR branch,
    so maintainers can fix minor issues and keep your PR up to date.

This patch removes `rdflib.compat.etree_register_namespace` which was
needed before `xml.etree.register_namespace` was added in python 3.2,
however there is no code that uses it as is, so it serves no purpose
anymore.

```console
$ \rm -rf /var/tmp/rdflib-clean/
$ git clone --depth 1 --branch master git@github.com:RDFLib/rdflib.git /var/tmp/rdflib-clean/
Cloning into '/var/tmp/rdflib-clean'...
remote: Enumerating objects: 5392, done.
remote: Counting objects: 100% (5392/5392), done.
remote: Compressing objects: 100% (3837/3837), done.
remote: Total 5392 (delta 1213), reused 4996 (delta 1172), pack-reused 0
Receiving objects: 100% (5392/5392), 1.98 MiB | 1013.00 KiB/s, done.
Resolving deltas: 100% (1213/1213), done.
$ grep --exclude-dir={.tox,__pycache__,_build,build} -ri -e etree_register_namespace -e _namespace_map /var/tmp/rdflib-clean/
/var/tmp/rdflib-clean/rdflib/compat.py:    etree_register_namespace = etree.register_namespace
/var/tmp/rdflib-clean/rdflib/compat.py:    def etree_register_namespace(prefix, uri):
/var/tmp/rdflib-clean/rdflib/compat.py:        etreenative._namespace_map[uri] = prefix
$
```

I'm removing this primarily because it causes problems when running
pytype on rdflib:

```console
$ .venv/bin/pytype rdflib
...
File "/home/iwana/sw/d/github.com/iafork/rdflib.typing/rdflib/compat.py", line 28, in etree_register_namespace: No attribute '_namespace_map' on module 'xml.etree.ElementTree' [module-attr]
...
```
@aucampia aucampia marked this pull request as ready for review March 20, 2022 22:02
@aucampia aucampia merged commit 6b356a4 into RDFLib:master Mar 30, 2022
@aucampia aucampia deleted the iwana-20220320T2252-remove_etree_register_namespace branch April 9, 2022 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants