Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-xmlsec for openSUSE:Factory checked in at 2022-10-19 13:17:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-xmlsec (Old) and /work/SRC/openSUSE:Factory/.python-xmlsec.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-xmlsec" Wed Oct 19 13:17:40 2022 rev:7 rq:1029789 version:1.3.13 Changes: -------- --- /work/SRC/openSUSE:Factory/python-xmlsec/python-xmlsec.changes 2022-05-12 23:00:48.528832929 +0200 +++ /work/SRC/openSUSE:Factory/.python-xmlsec.new.2275/python-xmlsec.changes 2022-10-19 13:18:11.141285358 +0200 @@ -1,0 +2,18 @@ +Tue Oct 18 13:13:45 UTC 2022 - Mark??ta Machov?? <mmach...@suse.com> + +- Update to 1.13.13 + * Add CI for Python 3.10, manylinux2 SOABI, musllinux1 SOABI and OpenSUSE Tumbleweed + * Introduce linting with pre-commit + * Rewrite PEP 484 stubs + * xmlsec workaround for gh##84 + * Resolve key loading issue on big-endian systems. + * Fix building wheel when using PYXMLSEC_STATIC_DEPS=true + * setup.py: Fix typo in PYXMLSEC_LIBXSLT_VERSION + * Switch on modern headers lxml + * use build to build wheels + * remove pkgconfig as it's only a build-system requirement + * exclude lxml 4.7 because the wheels are missing the lxml includes +- Drop merged avoid_lxml_tests_failing.patch +- Normalize the tests call + +------------------------------------------------------------------- Old: ---- avoid_lxml_tests_failing.patch xmlsec-1.3.12.tar.gz New: ---- xmlsec-1.3.13.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-xmlsec.spec ++++++ --- /var/tmp/diff_new_pack.nzAU5G/_old 2022-10-19 13:18:11.705286527 +0200 +++ /var/tmp/diff_new_pack.nzAU5G/_new 2022-10-19 13:18:11.709286535 +0200 @@ -17,21 +17,16 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} -# gh#mehcode/python-xmlsec#204 and gh#mehcode/python-xmlsec#210 -%define skip_python310 1 Name: python-xmlsec -Version: 1.3.12 +Version: 1.3.13 Release: 0 Summary: Python bindings for the XML Security Library License: MIT URL: https://github.com/mehcode/python-xmlsec Source: https://files.pythonhosted.org/packages/source/x/xmlsec/xmlsec-%{version}.tar.gz -# PATCH-FIX-UPSTREAM avoid_lxml_tests_failing.patch gh#mehcode/python-xmlsec#84 mc...@suse.com -# work around the lxml issue -Patch0: avoid_lxml_tests_failing.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module hypothesis} -BuildRequires: %{python_module lxml >= 3.0} +BuildRequires: %{python_module lxml >= 3.8.0} BuildRequires: %{python_module lxml-devel} BuildRequires: %{python_module pip} BuildRequires: %{python_module pkgconfig} @@ -49,8 +44,7 @@ BuildRequires: pkgconfig(xmlsec1) # we need at least one xmlsec backend on runtime Recommends: libxmlsec1-openssl1 -Requires: python-lxml >= 3.0 -Requires: python-pkgconfig +Requires: python-lxml >= 3.8.0 %python_subpackages %description @@ -68,16 +62,12 @@ %python_expand %fdupes %{buildroot}%{$python_sitearch} %check -# %%pytest_arch tests/ %ifarch %ix86 export skip_tests="not test_reinitialize_module" %else export skip_tests="" %endif -%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch} PYTHONDONTWRITEBYTECODE=1 -rm -rf .hypothesis/ .pytest_cache/ -$python -mpytest --ignore=_build.python39 --ignore=_build.python310 --ignore=_build.python38 -v -k "$skip_tests" tests/ -} +%pytest_arch -k "$skip_tests" tests/ %files %{python_files} %doc README.rst ++++++ xmlsec-1.3.12.tar.gz -> xmlsec-1.3.13.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/.pre-commit-config.yaml new/xmlsec-1.3.13/.pre-commit-config.yaml --- old/xmlsec-1.3.12/.pre-commit-config.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/xmlsec-1.3.13/.pre-commit-config.yaml 2022-08-20 22:42:41.000000000 +0200 @@ -0,0 +1,48 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +exclude: ".*.diff" # exclude patches +repos: +- repo: https://github.com/psf/black + rev: 22.6.0 + hooks: + - id: black + types: [] + files: ^.*.pyi?$ + exclude: ^doc/ +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: no-commit-to-branch + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-ast + - id: check-merge-conflict + - id: check-json + - id: detect-private-key + - id: mixed-line-ending + - id: pretty-format-json + args: [--autofix] +- repo: https://github.com/PyCQA/flake8 + rev: 5.0.4 + hooks: + - id: flake8 + exclude: ^setup.py$ + additional_dependencies: [flake8-docstrings, flake8-bugbear, flake8-logging-format, flake8-builtins, flake8-eradicate, flake8-fixme, pep8-naming, flake8-pep3101, flake8-annotations-complexity,flake8-pyi] +- repo: https://github.com/PyCQA/isort + rev: 5.10.1 + hooks: + - id: isort +- repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.971 + hooks: + - id: mypy + exclude: (setup.py|tests/.*.py|doc/.*) + types: [] + files: ^.*.pyi?$ + additional_dependencies: [lxml-stubs,types-docutils] +- repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.9.0 + hooks: + - id: rst-backticks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/.readthedocs.yaml new/xmlsec-1.3.13/.readthedocs.yaml --- old/xmlsec-1.3.12/.readthedocs.yaml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/.readthedocs.yaml 2022-08-20 22:42:41.000000000 +0200 @@ -1,10 +1,14 @@ version: 2 +build: + os: ubuntu-20.04 + tools: + python: '3.9' + sphinx: configuration: doc/source/conf.py python: - version: 3.8 install: - method: pip path: . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/PKG-INFO new/xmlsec-1.3.13/PKG-INFO --- old/xmlsec-1.3.12/PKG-INFO 2021-09-05 18:54:29.396132200 +0200 +++ new/xmlsec-1.3.13/PKG-INFO 2022-08-20 22:42:53.969565400 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: xmlsec -Version: 1.3.12 +Version: 1.3.13 Summary: Python bindings for the XML Security Library Home-page: https://github.com/mehcode/python-xmlsec Author: Bulat Gaifullin @@ -12,7 +12,6 @@ Project-URL: Source, https://github.com/mehcode/python-xmlsec Project-URL: Changelog, https://github.com/mehcode/python-xmlsec/releases Keywords: xmlsec -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators @@ -250,5 +249,3 @@ Unless otherwise noted, all files contained within this project are licensed under the MIT opensource license. See the included ``LICENSE`` file or visit `opensource.org <http://opensource.org/licenses/MIT>`_ for more information. - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/mypy.ini new/xmlsec-1.3.13/mypy.ini --- old/xmlsec-1.3.12/mypy.ini 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/mypy.ini 1970-01-01 01:00:00.000000000 +0100 @@ -1,16 +0,0 @@ -[mypy] -files = src -ignore_missing_imports = False -warn_unused_configs = True -disallow_subclassing_any = True -disallow_any_generics = True -disallow_untyped_calls = True -disallow_untyped_defs = True -disallow_incomplete_defs = True -check_untyped_defs = True -disallow_untyped_decorators = True -no_implicit_optional = True -warn_redundant_casts = True -warn_unused_ignores = True -warn_return_any = True -no_implicit_reexport = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/pyproject.toml new/xmlsec-1.3.13/pyproject.toml --- old/xmlsec-1.3.12/pyproject.toml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/pyproject.toml 2022-08-20 22:42:41.000000000 +0200 @@ -1,7 +1,28 @@ +[tool.mypy] +files = ['src'] +ignore_missing_imports = false +warn_unused_configs = true +disallow_subclassing_any = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_untyped_defs = true +disallow_incomplete_defs = true +check_untyped_defs = true +disallow_untyped_decorators = true +disallow_any_unimported = true +strict_optional = true +no_implicit_optional = true +warn_redundant_casts = true +warn_unused_ignores = true +warn_return_any = true +warn_no_return = true +no_implicit_reexport = true +show_error_codes = true + [tool.black] line_length = 130 skip-string-normalization = true -target_version = ['py38'] +target_version = ['py39'] include = '\.pyi?$' exclude = ''' @@ -23,4 +44,4 @@ known_third_party = ['lxml', 'pytest', '_pytest', 'hypothesis'] [build-system] -requires = ['setuptools>=42', 'wheel', 'setuptools_scm[toml]>=3.4'] +requires = ['setuptools>=42', 'wheel', 'setuptools_scm[toml]>=3.4', "pkgconfig>=1.5.1", "lxml>=3.8, !=4.7.0"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/setup.cfg new/xmlsec-1.3.13/setup.cfg --- old/xmlsec-1.3.12/setup.cfg 2021-09-05 18:54:29.396132200 +0200 +++ new/xmlsec-1.3.13/setup.cfg 2022-08-20 22:42:53.969565400 +0200 @@ -16,6 +16,9 @@ upload_dir = doc/build/html [flake8] +per-file-ignores = + *.pyi: E301, E302, E305, E501, E701, F401, F822 +exclude = .venv*,.git,*_pb2.pyi,build,dist,libs,.eggs,.direnv* max-line-length = 130 [egg_info] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/setup.py new/xmlsec-1.3.13/setup.py --- old/xmlsec-1.3.12/setup.py 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/setup.py 2022-08-20 22:42:41.000000000 +0200 @@ -1,20 +1,84 @@ +import contextlib +import html.parser import io +import json import multiprocessing import os +import re import subprocess import sys import tarfile import zipfile from distutils import log from distutils.errors import DistutilsError +from distutils.version import StrictVersion as Version from pathlib import Path -from urllib.request import urlcleanup, urljoin, urlretrieve +from urllib.request import urlcleanup, urljoin, urlopen, urlretrieve from setuptools import Extension, setup from setuptools.command.build_ext import build_ext as build_ext_orig -class build_ext(build_ext_orig, object): +class HrefCollector(html.parser.HTMLParser): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.hrefs = [] + + def handle_starttag(self, tag, attrs): + if tag == 'a': + for name, value in attrs: + if name == 'href': + self.hrefs.append(value) + + +def latest_release_from_html(url, matcher): + with contextlib.closing(urlopen(url)) as r: + charset = r.headers.get_content_charset() or 'utf-8' + content = r.read().decode(charset) + collector = HrefCollector() + collector.feed(content) + hrefs = collector.hrefs + + def comp(text): + try: + return Version(matcher.match(text).groupdict()['version']) + except (AttributeError, ValueError): + return Version('0.0') + + latest = max(hrefs, key=comp) + return '{}/{}'.format(url, latest) + + +def latest_release_from_gnome_org_cache(url, lib_name): + cache_url = '{}/cache.json'.format(url) + with contextlib.closing(urlopen(cache_url)) as r: + cache = json.load(r) + latest_version = cache[2][lib_name][-1] + latest_source = cache[1][lib_name][latest_version]['tar.xz'] + return '{}/{}'.format(url, latest_source) + + +def latest_zlib_release(): + return latest_release_from_html('https://zlib.net/fossils', re.compile('zlib-(?P<version>.*).tar.gz')) + + +def latest_libiconv_release(): + return latest_release_from_html('https://ftp.gnu.org/pub/gnu/libiconv', re.compile('libiconv-(?P<version>.*).tar.gz')) + + +def latest_libxml2_release(): + return latest_release_from_gnome_org_cache('https://download.gnome.org/sources/libxml2', 'libxml2') + + +def latest_libxslt_release(): + return latest_release_from_gnome_org_cache('https://download.gnome.org/sources/libxslt', 'libxslt') + + +def latest_xmlsec_release(): + return latest_release_from_html('https://www.aleksey.com/xmlsec/download/', re.compile('xmlsec1-(?P<version>.*).tar.gz')) + + +class build_ext(build_ext_orig): def info(self, message): self.announce(message, level=log.INFO) @@ -36,6 +100,7 @@ self.libs_dir = Path(os.environ.get('PYXMLSEC_LIBS_DIR', 'libs')) self.libs_dir.mkdir(exist_ok=True) + self.info('{:20} {}'.format('Lib sources in:', self.libs_dir.absolute())) if sys.platform == 'win32': self.prepare_static_build_win() @@ -165,71 +230,107 @@ ext.include_dirs = [str(p.absolute()) for p in includes] def prepare_static_build_linux(self): - self.openssl_version = os.environ.get('PYXMLSEC_OPENSSL_VERSION', '1.1.1g') - self.libiconv_version = os.environ.get('PYXMLSEC_LIBICONV_VERSION', '1.16') - self.libxml2_version = os.environ.get('PYXMLSEC_LIBXML2_VERSION', None) - self.libxslt_version = os.environ.get('PYXMLSEC_LIBXLST_VERSION', None) - self.zlib_version = os.environ.get('PYXMLSEC_ZLIB_VERSION', '1.2.11') - self.xmlsec1_version = os.environ.get('PYXMLSEC_XMLSEC1_VERSION', '1.2.31') - - self.info('Settings:') - self.info('{:20} {}'.format('Lib sources in:', self.libs_dir.absolute())) - self.info('{:20} {}'.format('zlib version:', self.zlib_version)) - self.info('{:20} {}'.format('libiconv version:', self.libiconv_version)) - self.info('{:20} {}'.format('libxml2 version:', self.libxml2_version or 'unset, using latest')) - self.info('{:20} {}'.format('libxslt version:', self.libxslt_version or 'unset, using latest')) - self.info('{:20} {}'.format('xmlsec1 version:', self.xmlsec1_version)) + self.openssl_version = os.environ.get('PYXMLSEC_OPENSSL_VERSION', '1.1.1q') + self.libiconv_version = os.environ.get('PYXMLSEC_LIBICONV_VERSION') + self.libxml2_version = os.environ.get('PYXMLSEC_LIBXML2_VERSION') + self.libxslt_version = os.environ.get('PYXMLSEC_LIBXSLT_VERSION') + self.zlib_version = os.environ.get('PYXMLSEC_ZLIB_VERSION') + self.xmlsec1_version = os.environ.get('PYXMLSEC_XMLSEC1_VERSION') # fetch openssl openssl_tar = next(self.libs_dir.glob('openssl*.tar.gz'), None) if openssl_tar is None: - self.info('OpenSSL source tar not found, downloading ...') + self.info('{:10}: {}'.format('OpenSSL', 'source tar not found, downloading ...')) openssl_tar = self.libs_dir / 'openssl.tar.gz' + self.info('{:10}: {} {}'.format('OpenSSL', 'version', self.openssl_version)) urlretrieve('https://www.openssl.org/source/openssl-{}.tar.gz'.format(self.openssl_version), str(openssl_tar)) # fetch zlib zlib_tar = next(self.libs_dir.glob('zlib*.tar.gz'), None) if zlib_tar is None: - self.info('zlib source tar not found, downloading ...') + self.info('{:10}: {}'.format('zlib', 'source not found, downloading ...')) zlib_tar = self.libs_dir / 'zlib.tar.gz' - urlretrieve('https://zlib.net/zlib-{}.tar.gz'.format(self.zlib_version), str(zlib_tar)) + if self.zlib_version is None: + url = latest_zlib_release() + self.info('{:10}: {}'.format('zlib', 'PYXMLSEC_ZLIB_VERSION unset, downloading latest from {}'.format(url))) + else: + url = 'https://zlib.net/fossils/zlib-{}.tar.gz'.format(self.zlib_version) + self.info( + '{:10}: {}'.format('zlib', 'PYXMLSEC_ZLIB_VERSION={}, downloading from {}'.format(self.zlib_version, url)) + ) + urlretrieve(url, str(zlib_tar)) # fetch libiconv libiconv_tar = next(self.libs_dir.glob('libiconv*.tar.gz'), None) if libiconv_tar is None: - self.info('libiconv source tar not found, downloading ...') + self.info('{:10}: {}'.format('libiconv', 'source not found, downloading ...')) libiconv_tar = self.libs_dir / 'libiconv.tar.gz' - urlretrieve( - 'https://ftp.gnu.org/pub/gnu/libiconv/libiconv-{}.tar.gz'.format(self.libiconv_version), str(libiconv_tar) - ) + if self.libiconv_version is None: + url = latest_libiconv_release() + self.info('{:10}: {}'.format('zlib', 'PYXMLSEC_LIBICONV_VERSION unset, downloading latest from {}'.format(url))) + else: + url = 'https://ftp.gnu.org/pub/gnu/libiconv/libiconv-{}.tar.gz'.format(self.libiconv_version) + self.info( + '{:10}: {}'.format( + 'zlib', 'PYXMLSEC_LIBICONV_VERSION={}, downloading from {}'.format(self.libiconv_version, url) + ) + ) + urlretrieve(url, str(libiconv_tar)) # fetch libxml2 - libxml2_tar = next(self.libs_dir.glob('libxml2*.tar.gz'), None) + libxml2_tar = next(self.libs_dir.glob('libxml2*.tar.xz'), None) if libxml2_tar is None: - self.info('Libxml2 source tar not found, downloading ...') + self.info('{:10}: {}'.format('libxml2', 'source tar not found, downloading ...')) if self.libxml2_version is None: - url = 'http://xmlsoft.org/sources/LATEST_LIBXML2' + url = latest_libxml2_release() + self.info('{:10}: {}'.format('libxml2', 'PYXMLSEC_LIBXML2_VERSION unset, downloading latest from {}'.format(url))) else: - url = 'http://xmlsoft.org/sources/libxml2-{}.tar.gz'.format(self.libxml2_version) - libxml2_tar = self.libs_dir / 'libxml2.tar.gz' + version_prefix, _ = self.libxml2_version.rsplit('.', 1) + url = 'https://download.gnome.org/sources/libxml2/{}/libxml2-{}.tar.xz'.format( + version_prefix, self.libxml2_version + ) + self.info( + '{:10}: {}'.format( + 'libxml2', 'PYXMLSEC_LIBXML2_VERSION={}, downloading from {}'.format(self.libxml2_version, url) + ) + ) + libxml2_tar = self.libs_dir / 'libxml2.tar.xz' urlretrieve(url, str(libxml2_tar)) # fetch libxslt libxslt_tar = next(self.libs_dir.glob('libxslt*.tar.gz'), None) if libxslt_tar is None: - self.info('libxslt source tar not found, downloading ...') + self.info('{:10}: {}'.format('libxslt', 'source tar not found, downloading ...')) if self.libxslt_version is None: - url = 'http://xmlsoft.org/sources/LATEST_LIBXSLT' + url = latest_libxslt_release() + self.info('{:10}: {}'.format('libxslt', 'PYXMLSEC_LIBXSLT_VERSION unset, downloading latest from {}'.format(url))) else: - url = 'http://xmlsoft.org/sources/libxslt-{}.tar.gz'.format(self.libxslt_version) + version_prefix, _ = self.libxslt_version.rsplit('.', 1) + url = 'https://download.gnome.org/sources/libxslt/{}/libxslt-{}.tar.xz'.format( + version_prefix, self.libxslt_version + ) + self.info( + '{:10}: {}'.format( + 'libxslt', 'PYXMLSEC_LIBXSLT_VERSION={}, downloading from {}'.format(self.libxslt_version, url) + ) + ) libxslt_tar = self.libs_dir / 'libxslt.tar.gz' urlretrieve(url, str(libxslt_tar)) # fetch xmlsec1 xmlsec1_tar = next(self.libs_dir.glob('xmlsec1*.tar.gz'), None) if xmlsec1_tar is None: - self.info('xmlsec1 source tar not found, downloading ...') - url = 'http://www.aleksey.com/xmlsec/download/xmlsec1-{}.tar.gz'.format(self.xmlsec1_version) + self.info('{:10}: {}'.format('xmlsec1', 'source tar not found, downloading ...')) + if self.xmlsec1_version is None: + url = latest_xmlsec_release() + self.info('{:10}: {}'.format('xmlsec1', 'PYXMLSEC_XMLSEC1_VERSION unset, downloading latest from {}'.format(url))) + else: + url = 'https://www.aleksey.com/xmlsec/download/xmlsec1-{}.tar.gz'.format(self.xmlsec1_version) + self.info( + '{:10}: {}'.format( + 'xmlsec1', 'PYXMLSEC_XMLSEC1_VERSION={}, downloading from {}'.format(self.xmlsec1_version, url) + ) + ) xmlsec1_tar = self.libs_dir / 'xmlsec1.tar.gz' urlretrieve(url, str(xmlsec1_tar)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/keys.c new/xmlsec-1.3.13/src/keys.c --- old/xmlsec-1.3.12/src/keys.c 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/src/keys.c 2022-08-20 22:42:41.000000000 +0200 @@ -142,7 +142,7 @@ Py_ssize_t data_size = 0; PYXMLSEC_DEBUG("load key from file - start"); - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OH|z:from_file", kwlist, &file, &format, &password)) { + if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OI|z:from_file", kwlist, &file, &format, &password)) { goto ON_FAIL; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/lxml.c new/xmlsec-1.3.13/src/lxml.c --- old/xmlsec-1.3.12/src/lxml.c 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/src/lxml.c 2022-08-20 22:42:41.000000000 +0200 @@ -11,7 +11,7 @@ #include "lxml.h" #include <etree_defs.h> -#include <lxml.etree_api.h> +#include <etree_api.h> #include <libxml/xmlmemory.h> #include <libxml/parser.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/lxml.h new/xmlsec-1.3.13/src/lxml.h --- old/xmlsec-1.3.12/src/lxml.h 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/src/lxml.h 2022-08-20 22:42:41.000000000 +0200 @@ -16,7 +16,7 @@ #include <libxml/valid.h> #include <lxml-version.h> -#include <lxml.etree.h> +#include <etree.h> typedef struct LxmlElement* PyXmlSec_LxmlElementPtr; typedef struct LxmlDocument* PyXmlSec_LxmlDocumentPtr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/xmlsec/__init__.pyi new/xmlsec-1.3.13/src/xmlsec/__init__.pyi --- old/xmlsec-1.3.12/src/xmlsec/__init__.pyi 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/src/xmlsec/__init__.pyi 2022-08-20 22:42:41.000000000 +0200 @@ -1,27 +1,15 @@ -import sys -from typing import ( - Any, AnyStr, Callable, IO, Iterable, Optional, Type, TypeVar, Union, - overload) +from collections.abc import Callable, Iterable +from typing import IO, Any, AnyStr, TypeVar, overload +from _typeshed import GenericPath, Self, StrOrBytesPath from lxml.etree import _Element -from xmlsec import constants, template, tree -from xmlsec.constants import __KeyData as KeyData, __Transform as Transform - -if sys.version_info >= (3, 6): - from os import PathLike - from pathlib import PurePath - - _Path = Union[str, bytes, PurePath, PathLike[str], PathLike[bytes]] -elif sys.version_info >= (3, 4): - from pathlib import PurePath - - _Path = Union[str, bytes, PurePath] -else: - _Path = Union[str, bytes] +from xmlsec import constants as constants +from xmlsec import tree as tree +from xmlsec.constants import __KeyData as KeyData +from xmlsec.constants import __Transform as Transform _E = TypeVar('_E', bound=_Element) -_K = TypeVar('_K', bound=Key) def enable_debug_trace(enabled: bool = ...) -> None: ... def init() -> None: ... @@ -29,10 +17,10 @@ def cleanup_callbacks() -> None: ... def register_default_callbacks() -> None: ... def register_callbacks( - input_match_callback: Callable[[bytes], bool], - input_open_callback: Callable[[bytes], Any], - input_read_callback: Callable[[Any, memoryview], int], - input_close_callback: Callable[[Any], None], + input_match_callback: Callable[[bytes], bool], + input_open_callback: Callable[[bytes], Any], + input_read_callback: Callable[[Any, memoryview], int], + input_close_callback: Callable[[Any], None], ) -> None: ... @overload def base64_default_line_size() -> int: ... @@ -40,8 +28,8 @@ def base64_default_line_size(size: int) -> None: ... class EncryptionContext: - key: Optional[Key] - def __init__(self, manager: Optional[KeysManager] = None) -> None: ... + key: Key | None + def __init__(self, manager: KeysManager | None = ...) -> None: ... def decrypt(self, node: _Element) -> _Element: ... def encrypt_binary(self, template: _E, data: bytes) -> _E: ... def encrypt_uri(self, template: _E, uri: str) -> _E: ... @@ -54,30 +42,30 @@ class Key: name: str @classmethod - def from_binary_data(cls: Type[_K], klass: KeyData, data: AnyStr) -> _K: ... + def from_binary_data(cls: type[Self], klass: KeyData, data: AnyStr) -> Self: ... @classmethod - def from_binary_file(cls: Type[_K], klass: KeyData, filename: _Path) -> _K: ... + def from_binary_file(cls: type[Self], klass: KeyData, filename: StrOrBytesPath) -> Self: ... @classmethod - def from_file(cls: Type[_K], file: Union[_Path, IO[AnyStr]], format: int, password: Optional[str] = ...) -> _K: ... + def from_file(cls: type[Self], file: GenericPath[AnyStr] | IO[AnyStr], format: int, password: str | None = ...) -> Self: ... @classmethod - def from_memory(cls: Type[_K], data: AnyStr, format: int, password: Optional[str] = ...) -> _K: ... + def from_memory(cls: type[Self], data: AnyStr, format: int, password: str | None = ...) -> Self: ... @classmethod - def generate(cls: Type[_K], klass: KeyData, size: int, type: int) -> _K: ... - def load_cert_from_file(self, file: Union[_Path, IO[AnyStr]], format: int) -> None: ... + def generate(cls: type[Self], klass: KeyData, size: int, type: int) -> Self: ... + def load_cert_from_file(self, file: GenericPath[AnyStr] | IO[AnyStr], format: int) -> None: ... def load_cert_from_memory(self, data: AnyStr, format: int) -> None: ... - def __copy__(self: _K) -> _K: ... - def __deepcopy__(self: _K) -> _K: ... + def __copy__(self: Self) -> Self: ... + def __deepcopy__(self: Self) -> Self: ... class KeysManager: def add_key(self, key: Key) -> None: ... - def load_cert(self, filename: _Path, format: int, type: int) -> None: ... + def load_cert(self, filename: StrOrBytesPath, format: int, type: int) -> None: ... def load_cert_from_memory(self, data: AnyStr, format: int, type: int) -> None: ... class SignatureContext: - key: Optional[Key] + key: Key | None def enable_reference_transform(self, transform: Transform) -> None: ... def enable_signature_transform(self, transform: Transform) -> None: ... - def register_id(self, node: _Element, id_attr: str = "ID", id_ns: Optional[str] = None) -> None: ... + def register_id(self, node: _Element, id_attr: str = ..., id_ns: str | None = ...) -> None: ... def set_enabled_key_data(self, keydata_list: Iterable[KeyData]) -> None: ... def sign(self, node: _Element) -> None: ... def sign_binary(self, bytes: bytes, transform: Transform) -> bytes: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/xmlsec/constants.pyi new/xmlsec-1.3.13/src/xmlsec/constants.pyi --- old/xmlsec-1.3.12/src/xmlsec/constants.pyi 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/src/xmlsec/constants.pyi 2022-08-20 22:42:41.000000000 +0200 @@ -1,5 +1,5 @@ import sys -from typing import NamedTuple, Optional +from typing import NamedTuple if sys.version_info >= (3, 8): from typing import Final @@ -7,147 +7,148 @@ from typing_extensions import Final class __KeyData(NamedTuple): # __KeyData type + href: str + name: str + +class __KeyDataNoHref(NamedTuple): # __KeyData type + href: None name: str - href: Optional[str] class __Transform(NamedTuple): # __Transform type + href: str + name: str + usage: int + +class __TransformNoHref(NamedTuple): # __Transform type + href: None name: str - href: Optional[str] usage: int -DSigNs: Final = 'http://www.w3.org/2000/09/xmldsig#' -EncNs: Final = 'http://www.w3.org/2001/04/xmlenc#' -KeyDataAes: Final = __KeyData('aes', 'http://www.aleksey.com/xmlsec/2002#AESKeyValue') -KeyDataDes: Final = __KeyData('des', 'http://www.aleksey.com/xmlsec/2002#DESKeyValue') -KeyDataDsa: Final = __KeyData('dsa', 'http://www.w3.org/2000/09/xmldsig#DSAKeyValue') -KeyDataEcdsa: Final = __KeyData('ecdsa', 'http://scap.nist.gov/specifications/tmsad/#resource-1.0') -KeyDataEncryptedKey: Final = __KeyData('enc-key', 'http://www.w3.org/2001/04/xmlenc#EncryptedKey') -KeyDataFormatBinary: Final = 1 -KeyDataFormatCertDer: Final = 8 -KeyDataFormatCertPem: Final = 7 -KeyDataFormatDer: Final = 3 -KeyDataFormatPem: Final = 2 -KeyDataFormatPkcs12: Final = 6 -KeyDataFormatPkcs8Der: Final = 5 -KeyDataFormatPkcs8Pem: Final = 4 -KeyDataFormatUnknown: Final = 0 -KeyDataHmac: Final = __KeyData('hmac', 'http://www.aleksey.com/xmlsec/2002#HMACKeyValue') -KeyDataName: Final = __KeyData('key-name', None) -KeyDataRawX509Cert: Final = __KeyData('raw-x509-cert', 'http://www.w3.org/2000/09/xmldsig#rawX509Certificate') -KeyDataRetrievalMethod: Final = __KeyData('retrieval-method', None) -KeyDataRsa: Final = __KeyData('rsa', 'http://www.w3.org/2000/09/xmldsig#RSAKeyValue') -KeyDataTypeAny: Final = 65535 -KeyDataTypeNone: Final = 0 -KeyDataTypePermanent: Final = 16 -KeyDataTypePrivate: Final = 2 -KeyDataTypePublic: Final = 1 -KeyDataTypeSession: Final = 8 -KeyDataTypeSymmetric: Final = 4 -KeyDataTypeTrusted: Final = 256 -KeyDataTypeUnknown: Final = 0 -KeyDataValue: Final = __KeyData('key-value', None) -KeyDataX509: Final = __KeyData('x509', 'http://www.w3.org/2000/09/xmldsig#X509Data') -NodeCanonicalizationMethod: Final = 'CanonicalizationMethod' -NodeCipherData: Final = 'CipherData' -NodeCipherReference: Final = 'CipherReference' -NodeCipherValue: Final = 'CipherValue' -NodeDataReference: Final = 'DataReference' -NodeDigestMethod: Final = 'DigestMethod' -NodeDigestValue: Final = 'DigestValue' -NodeEncryptedData: Final = 'EncryptedData' -NodeEncryptedKey: Final = 'EncryptedKey' -NodeEncryptionMethod: Final = 'EncryptionMethod' -NodeEncryptionProperties: Final = 'EncryptionProperties' -NodeEncryptionProperty: Final = 'EncryptionProperty' -NodeKeyInfo: Final = 'KeyInfo' -NodeKeyName: Final = 'KeyName' -NodeKeyReference: Final = 'KeyReference' -NodeKeyValue: Final = 'KeyValue' -NodeManifest: Final = 'Manifest' -NodeObject: Final = 'Object' -NodeReference: Final = 'Reference' -NodeReferenceList: Final = 'ReferenceList' -NodeSignature: Final = 'Signature' -NodeSignatureMethod: Final = 'SignatureMethod' -NodeSignatureProperties: Final = 'SignatureProperties' -NodeSignatureValue: Final = 'SignatureValue' -NodeSignedInfo: Final = 'SignedInfo' -NodeX509Data: Final = 'X509Data' -Ns: Final = 'http://www.aleksey.com/xmlsec/2002' -NsExcC14N: Final = 'http://www.w3.org/2001/10/xml-exc-c14n#' -NsExcC14NWithComments: Final = 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments' -Soap11Ns: Final = 'http://schemas.xmlsoap.org/soap/envelope/' -Soap12Ns: Final = 'http://www.w3.org/2002/06/soap-envelope' -TransformAes128Cbc: Final = __Transform('aes128-cbc', 'http://www.w3.org/2001/04/xmlenc#aes128-cbc', 16) -TransformAes128Gcm: Final = __Transform('aes128-gcm', 'http://www.w3.org/2009/xmlenc11#aes128-gcm', 16) -TransformAes192Cbc: Final = __Transform('aes192-cbc', 'http://www.w3.org/2001/04/xmlenc#aes192-cbc', 16) -TransformAes192Gcm: Final = __Transform('aes192-gcm', 'http://www.w3.org/2009/xmlenc11#aes192-gcm', 16) -TransformAes256Cbc: Final = __Transform('aes256-cbc', 'http://www.w3.org/2001/04/xmlenc#aes256-cbc', 16) -TransformAes256Gcm: Final = __Transform('aes256-gcm', 'http://www.w3.org/2009/xmlenc11#aes256-gcm', 16) -TransformDes3Cbc: Final = __Transform('tripledes-cbc', 'http://www.w3.org/2001/04/xmlenc#tripledes-cbc', 16) -TransformDsaSha1: Final = __Transform('dsa-sha1', 'http://www.w3.org/2000/09/xmldsig#dsa-sha1', 8) -TransformEcdsaSha1: Final = __Transform('ecdsa-sha1', 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1', 8) -TransformEcdsaSha224: Final = __Transform('ecdsa-sha224', 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha224', 8) -TransformEcdsaSha256: Final = __Transform('ecdsa-sha256', 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha256', 8) -TransformEcdsaSha384: Final = __Transform('ecdsa-sha384', 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha384', 8) -TransformEcdsaSha512: Final = __Transform('ecdsa-sha512', 'http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha512', 8) -TransformEnveloped: Final = __Transform('enveloped-signature', 'http://www.w3.org/2000/09/xmldsig#enveloped-signature', 1) -TransformExclC14N: Final = __Transform('exc-c14n', 'http://www.w3.org/2001/10/xml-exc-c14n#', 3) -TransformExclC14NWithComments: Final = __Transform( - 'exc-c14n-with-comments', 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments', 3 -) -TransformHmacMd5: Final = __Transform('hmac-md5', 'http://www.w3.org/2001/04/xmldsig-more#hmac-md5', 8) -TransformHmacRipemd160: Final = __Transform('hmac-ripemd160', 'http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160', 8) -TransformHmacSha1: Final = __Transform('hmac-sha1', 'http://www.w3.org/2000/09/xmldsig#hmac-sha1', 8) -TransformHmacSha224: Final = __Transform('hmac-sha224', 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha224', 8) -TransformHmacSha256: Final = __Transform('hmac-sha256', 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256', 8) -TransformHmacSha384: Final = __Transform('hmac-sha384', 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha384', 8) -TransformHmacSha512: Final = __Transform('hmac-sha512', 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha512', 8) -TransformInclC14N: Final = __Transform('c14n', 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315', 3) -TransformInclC14N11: Final = __Transform('c14n11', 'http://www.w3.org/2006/12/xml-c14n11', 3) -TransformInclC14N11WithComments: Final = __Transform( - 'c14n11-with-comments', 'http://www.w3.org/2006/12/xml-c14n11#WithComments', 3 -) -TransformInclC14NWithComments: Final = __Transform( - 'c14n-with-comments', - 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments', - 3, -) -TransformKWAes128: Final = __Transform('kw-aes128', 'http://www.w3.org/2001/04/xmlenc#kw-aes128', 16) -TransformKWAes192: Final = __Transform('kw-aes192', 'http://www.w3.org/2001/04/xmlenc#kw-aes192', 16) -TransformKWAes256: Final = __Transform('kw-aes256', 'http://www.w3.org/2001/04/xmlenc#kw-aes256', 16) -TransformKWDes3: Final = __Transform('kw-tripledes', 'http://www.w3.org/2001/04/xmlenc#kw-tripledes', 16) -TransformMd5: Final = __Transform('md5', 'http://www.w3.org/2001/04/xmldsig-more#md5', 4) -TransformRemoveXmlTagsC14N: Final = __Transform('remove-xml-tags-transform', None, 3) -TransformRipemd160: Final = __Transform('ripemd160', 'http://www.w3.org/2001/04/xmlenc#ripemd160', 4) -TransformRsaMd5: Final = __Transform('rsa-md5', 'http://www.w3.org/2001/04/xmldsig-more#rsa-md5', 8) -TransformRsaOaep: Final = __Transform('rsa-oaep-mgf1p', 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p', 16) -TransformRsaPkcs1: Final = __Transform('rsa-1_5', 'http://www.w3.org/2001/04/xmlenc#rsa-1_5', 16) -TransformRsaRipemd160: Final = __Transform('rsa-ripemd160', 'http://www.w3.org/2001/04/xmldsig-more#rsa-ripemd160', 8) -TransformRsaSha1: Final = __Transform('rsa-sha1', 'http://www.w3.org/2000/09/xmldsig#rsa-sha1', 8) -TransformRsaSha224: Final = __Transform('rsa-sha224', 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha224', 8) -TransformRsaSha256: Final = __Transform('rsa-sha256', 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256', 8) -TransformRsaSha384: Final = __Transform('rsa-sha384', 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384', 8) -TransformRsaSha512: Final = __Transform('rsa-sha512', 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha512', 8) -TransformSha1: Final = __Transform('sha1', 'http://www.w3.org/2000/09/xmldsig#sha1', 4) -TransformSha224: Final = __Transform('sha224', 'http://www.w3.org/2001/04/xmldsig-more#sha224', 4) -TransformSha256: Final = __Transform('sha256', 'http://www.w3.org/2001/04/xmlenc#sha256', 4) -TransformSha384: Final = __Transform('sha384', 'http://www.w3.org/2001/04/xmldsig-more#sha384', 4) -TransformSha512: Final = __Transform('sha512', 'http://www.w3.org/2001/04/xmlenc#sha512', 4) -TransformUsageAny: Final = 65535 -TransformUsageC14NMethod: Final = 2 -TransformUsageDSigTransform: Final = 1 -TransformUsageDigestMethod: Final = 4 -TransformUsageEncryptionMethod: Final = 16 -TransformUsageSignatureMethod: Final = 8 -TransformUsageUnknown: Final = 0 -TransformVisa3DHack: Final = __Transform('Visa3DHackTransform', None, 1) -TransformXPath: Final = __Transform('xpath', 'http://www.w3.org/TR/1999/REC-xpath-19991116', 1) -TransformXPath2: Final = __Transform('xpath2', 'http://www.w3.org/2002/06/xmldsig-filter2', 1) -TransformXPointer: Final = __Transform('xpointer', 'http://www.w3.org/2001/04/xmldsig-more/xptr', 1) -TransformXslt: Final = __Transform('xslt', 'http://www.w3.org/TR/1999/REC-xslt-19991116', 1) -TypeEncContent: Final = 'http://www.w3.org/2001/04/xmlenc#Content' -TypeEncElement: Final = 'http://www.w3.org/2001/04/xmlenc#Element' -XPath2Ns: Final = 'http://www.w3.org/2002/06/xmldsig-filter2' -XPathNs: Final = 'http://www.w3.org/TR/1999/REC-xpath-19991116' -XPointerNs: Final = 'http://www.w3.org/2001/04/xmldsig-more/xptr' +DSigNs: Final[str] +EncNs: Final[str] +KeyDataAes: Final[__KeyData] +KeyDataDes: Final[__KeyData] +KeyDataDsa: Final[__KeyData] +KeyDataEcdsa: Final[__KeyData] +KeyDataEncryptedKey: Final[__KeyData] +KeyDataFormatBinary: Final[int] +KeyDataFormatCertDer: Final[int] +KeyDataFormatCertPem: Final[int] +KeyDataFormatDer: Final[int] +KeyDataFormatPem: Final[int] +KeyDataFormatPkcs12: Final[int] +KeyDataFormatPkcs8Der: Final[int] +KeyDataFormatPkcs8Pem: Final[int] +KeyDataFormatUnknown: Final[int] +KeyDataHmac: Final[__KeyData] +KeyDataName: Final[__KeyDataNoHref] +KeyDataRawX509Cert: Final[__KeyData] +KeyDataRetrievalMethod: Final[__KeyDataNoHref] +KeyDataRsa: Final[__KeyData] +KeyDataTypeAny: Final[int] +KeyDataTypeNone: Final[int] +KeyDataTypePermanent: Final[int] +KeyDataTypePrivate: Final[int] +KeyDataTypePublic: Final[int] +KeyDataTypeSession: Final[int] +KeyDataTypeSymmetric: Final[int] +KeyDataTypeTrusted: Final[int] +KeyDataTypeUnknown: Final[int] +KeyDataValue: Final[__KeyDataNoHref] +KeyDataX509: Final[__KeyData] +NodeCanonicalizationMethod: Final[str] +NodeCipherData: Final[str] +NodeCipherReference: Final[str] +NodeCipherValue: Final[str] +NodeDataReference: Final[str] +NodeDigestMethod: Final[str] +NodeDigestValue: Final[str] +NodeEncryptedData: Final[str] +NodeEncryptedKey: Final[str] +NodeEncryptionMethod: Final[str] +NodeEncryptionProperties: Final[str] +NodeEncryptionProperty: Final[str] +NodeKeyInfo: Final[str] +NodeKeyName: Final[str] +NodeKeyReference: Final[str] +NodeKeyValue: Final[str] +NodeManifest: Final[str] +NodeObject: Final[str] +NodeReference: Final[str] +NodeReferenceList: Final[str] +NodeSignature: Final[str] +NodeSignatureMethod: Final[str] +NodeSignatureProperties: Final[str] +NodeSignatureValue: Final[str] +NodeSignedInfo: Final[str] +NodeX509Data: Final[str] +Ns: Final[str] +NsExcC14N: Final[str] +NsExcC14NWithComments: Final[str] +Soap11Ns: Final[str] +Soap12Ns: Final[str] +TransformAes128Cbc: Final[__Transform] +TransformAes128Gcm: Final[__Transform] +TransformAes192Cbc: Final[__Transform] +TransformAes192Gcm: Final[__Transform] +TransformAes256Cbc: Final[__Transform] +TransformAes256Gcm: Final[__Transform] +TransformDes3Cbc: Final[__Transform] +TransformDsaSha1: Final[__Transform] +TransformEcdsaSha1: Final[__Transform] +TransformEcdsaSha224: Final[__Transform] +TransformEcdsaSha256: Final[__Transform] +TransformEcdsaSha384: Final[__Transform] +TransformEcdsaSha512: Final[__Transform] +TransformEnveloped: Final[__Transform] +TransformExclC14N: Final[__Transform] +TransformExclC14NWithComments: Final[__Transform] +TransformHmacMd5: Final[__Transform] +TransformHmacRipemd160: Final[__Transform] +TransformHmacSha1: Final[__Transform] +TransformHmacSha224: Final[__Transform] +TransformHmacSha256: Final[__Transform] +TransformHmacSha384: Final[__Transform] +TransformHmacSha512: Final[__Transform] +TransformInclC14N: Final[__Transform] +TransformInclC14N11: Final[__Transform] +TransformInclC14N11WithComments: Final[__Transform] +TransformInclC14NWithComments: Final[__Transform] +TransformKWAes128: Final[__Transform] +TransformKWAes192: Final[__Transform] +TransformKWAes256: Final[__Transform] +TransformKWDes3: Final[__Transform] +TransformMd5: Final[__Transform] +TransformRemoveXmlTagsC14N: Final[__TransformNoHref] +TransformRipemd160: Final[__Transform] +TransformRsaMd5: Final[__Transform] +TransformRsaOaep: Final[__Transform] +TransformRsaPkcs1: Final[__Transform] +TransformRsaRipemd160: Final[__Transform] +TransformRsaSha1: Final[__Transform] +TransformRsaSha224: Final[__Transform] +TransformRsaSha256: Final[__Transform] +TransformRsaSha384: Final[__Transform] +TransformRsaSha512: Final[__Transform] +TransformSha1: Final[__Transform] +TransformSha224: Final[__Transform] +TransformSha256: Final[__Transform] +TransformSha384: Final[__Transform] +TransformSha512: Final[__Transform] +TransformUsageAny: Final[int] +TransformUsageC14NMethod: Final[int] +TransformUsageDSigTransform: Final[int] +TransformUsageDigestMethod: Final[int] +TransformUsageEncryptionMethod: Final[int] +TransformUsageSignatureMethod: Final[int] +TransformUsageUnknown: Final[int] +TransformVisa3DHack: Final[__TransformNoHref] +TransformXPath: Final[__Transform] +TransformXPath2: Final[__Transform] +TransformXPointer: Final[__Transform] +TransformXslt: Final[__Transform] +TypeEncContent: Final[str] +TypeEncElement: Final[str] +XPath2Ns: Final[str] +XPathNs: Final[str] +XPointerNs: Final[str] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/xmlsec/template.pyi new/xmlsec-1.3.13/src/xmlsec/template.pyi --- old/xmlsec-1.3.12/src/xmlsec/template.pyi 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/src/xmlsec/template.pyi 2022-08-20 22:42:41.000000000 +0200 @@ -1,16 +1,17 @@ -from typing import Any, Optional, Sequence, Union +from collections.abc import Sequence +from typing import Any from lxml.etree import _Element from xmlsec.constants import __Transform as Transform def add_encrypted_key( - node: _Element, method: Transform, id: Optional[str] = None, type: Optional[str] = None, recipient: Optional[str] = None + node: _Element, method: Transform, id: str | None = ..., type: str | None = ..., recipient: str | None = ... ) -> _Element: ... -def add_key_name(node: _Element, name: Optional[str] = ...) -> _Element: ... +def add_key_name(node: _Element, name: str | None = ...) -> _Element: ... def add_key_value(node: _Element) -> _Element: ... def add_reference( - node: _Element, digest_method: Transform, id: Optional[str] = ..., uri: Optional[str] = ..., type: Optional[str] = ... + node: _Element, digest_method: Transform, id: str | None = ..., uri: str | None = ..., type: str | None = ... ) -> _Element: ... def add_transform(node: _Element, transform: Transform) -> Any: ... def add_x509_data(node: _Element) -> _Element: ... @@ -18,20 +19,20 @@ def encrypted_data_create( node: _Element, method: Transform, - id: Optional[str] = ..., - type: Optional[str] = ..., - mime_type: Optional[str] = ..., - encoding: Optional[str] = ..., - ns: Optional[str] = ..., + id: str | None = ..., + type: str | None = ..., + mime_type: str | None = ..., + encoding: str | None = ..., + ns: str | None = ..., ) -> _Element: ... def encrypted_data_ensure_cipher_value(node: _Element) -> _Element: ... -def encrypted_data_ensure_key_info(node: _Element, id: Optional[str] = ..., ns: Optional[str] = ...) -> _Element: ... -def ensure_key_info(node: _Element, id: Optional[str] = ...) -> _Element: ... -def transform_add_c14n_inclusive_namespaces(node: _Element, prefixes: Union[str, Sequence[str]]) -> None: ... +def encrypted_data_ensure_key_info(node: _Element, id: str | None = ..., ns: str | None = ...) -> _Element: ... +def ensure_key_info(node: _Element, id: str | None = ...) -> _Element: ... +def transform_add_c14n_inclusive_namespaces(node: _Element, prefixes: str | Sequence[str]) -> None: ... def x509_data_add_certificate(node: _Element) -> _Element: ... def x509_data_add_crl(node: _Element) -> _Element: ... def x509_data_add_issuer_serial(node: _Element) -> _Element: ... def x509_data_add_ski(node: _Element) -> _Element: ... def x509_data_add_subject_name(node: _Element) -> _Element: ... -def x509_issuer_serial_add_issuer_name(node: _Element, name: Optional[str] = ...) -> _Element: ... -def x509_issuer_serial_add_serial_number(node: _Element, serial: Optional[str] = ...) -> _Element: ... +def x509_issuer_serial_add_issuer_name(node: _Element, name: str | None = ...) -> _Element: ... +def x509_issuer_serial_add_serial_number(node: _Element, serial: str | None = ...) -> _Element: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/xmlsec/tree.pyi new/xmlsec-1.3.13/src/xmlsec/tree.pyi --- old/xmlsec-1.3.12/src/xmlsec/tree.pyi 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/src/xmlsec/tree.pyi 2022-08-20 22:42:41.000000000 +0200 @@ -1,17 +1,18 @@ -from typing import Optional, overload, Sequence +from collections.abc import Sequence +from typing import overload from lxml.etree import _Element def add_ids(node: _Element, ids: Sequence[str]) -> None: ... @overload -def find_child(parent: _Element, name: str) -> Optional[_Element]: ... +def find_child(parent: _Element, name: str) -> _Element | None: ... @overload -def find_child(parent: _Element, name: str, namespace: str = ...) -> Optional[_Element]: ... +def find_child(parent: _Element, name: str, namespace: str = ...) -> _Element | None: ... @overload -def find_node(node: _Element, name: str) -> Optional[_Element]: ... +def find_node(node: _Element, name: str) -> _Element | None: ... @overload -def find_node(node: _Element, name: str, namespace: str = ...) -> Optional[_Element]: ... +def find_node(node: _Element, name: str, namespace: str = ...) -> _Element | None: ... @overload -def find_parent(node: _Element, name: str) -> Optional[_Element]: ... +def find_parent(node: _Element, name: str) -> _Element | None: ... @overload -def find_parent(node: _Element, name: str, namespace: str = ...) -> Optional[_Element]: ... +def find_parent(node: _Element, name: str, namespace: str = ...) -> _Element | None: ... diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/xmlsec.egg-info/PKG-INFO new/xmlsec-1.3.13/src/xmlsec.egg-info/PKG-INFO --- old/xmlsec-1.3.12/src/xmlsec.egg-info/PKG-INFO 2021-09-05 18:54:29.000000000 +0200 +++ new/xmlsec-1.3.13/src/xmlsec.egg-info/PKG-INFO 2022-08-20 22:42:53.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: xmlsec -Version: 1.3.12 +Version: 1.3.13 Summary: Python bindings for the XML Security Library Home-page: https://github.com/mehcode/python-xmlsec Author: Bulat Gaifullin @@ -12,7 +12,6 @@ Project-URL: Source, https://github.com/mehcode/python-xmlsec Project-URL: Changelog, https://github.com/mehcode/python-xmlsec/releases Keywords: xmlsec -Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: Intended Audience :: System Administrators @@ -250,5 +249,3 @@ Unless otherwise noted, all files contained within this project are licensed under the MIT opensource license. See the included ``LICENSE`` file or visit `opensource.org <http://opensource.org/licenses/MIT>`_ for more information. - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/src/xmlsec.egg-info/SOURCES.txt new/xmlsec-1.3.13/src/xmlsec.egg-info/SOURCES.txt --- old/xmlsec-1.3.12/src/xmlsec.egg-info/SOURCES.txt 2021-09-05 18:54:29.000000000 +0200 +++ new/xmlsec-1.3.13/src/xmlsec.egg-info/SOURCES.txt 2022-08-20 22:42:53.000000000 +0200 @@ -1,8 +1,8 @@ +.pre-commit-config.yaml .readthedocs.yaml LICENSE MANIFEST.in README.rst -mypy.ini pyproject.toml setup.cfg setup.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/base.py new/xmlsec-1.3.13/tests/base.py --- old/xmlsec-1.3.12/tests/base.py 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/base.py 2022-08-20 22:42:41.000000000 +0200 @@ -7,10 +7,6 @@ import xmlsec -if sys.version_info < (3,): - unittest.TestCase.assertRaisesRegex = unittest.TestCase.assertRaisesRegexp - - etype = type(etree.Element("test")) ns = {'dsig': xmlsec.constants.DSigNs, 'enc': xmlsec.constants.EncNs} @@ -22,7 +18,6 @@ def get_memory_usage(): return resource.getrusage(resource.RUSAGE_SELF).ru_maxrss - except ImportError: resource = None @@ -62,7 +57,7 @@ o_count = gc.get_count()[0] m_hits = 0 o_hits = 0 - for i in range(self.iterations): + for _ in range(self.iterations): super(TestMemoryLeaks, self).run(result=result) m_usage_n = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss if m_usage_n > m_usage: @@ -89,43 +84,44 @@ result.addError(self, sys.exc_info()) def path(self, name): - """returns full path for resource""" + """Return full path for resource.""" return os.path.join(self.data_dir, name) def load(self, name): - """loads resource by name""" + """Load resource by name.""" with open(self.path(name), "rb") as stream: return stream.read() def load_xml(self, name, xpath=None): - """returns xml.etree""" - root = etree.parse(self.path(name)).getroot() - if xpath is None: - return root - return root.find(xpath) + """Return xml.etree.""" + with open(self.path(name)) as f: + root = etree.parse(f).getroot() + if xpath is None: + return root + return root.find(xpath) def dump(self, root): print(etree.tostring(root)) - def assertXmlEqual(self, first, second, msg=None): - """Checks equality of etree.roots""" + def assertXmlEqual(self, first, second, msg=None): # noqa: N802 + """Check equality of etree.roots.""" msg = msg or '' if first.tag != second.tag: - self.fail('Tags do not match: %s and %s. %s' % (first.tag, second.tag, msg)) + self.fail('Tags do not match: {} and {}. {}'.format(first.tag, second.tag, msg)) for name, value in first.attrib.items(): if second.attrib.get(name) != value: - self.fail('Attributes do not match: %s=%r, %s=%r. %s' % (name, value, name, second.attrib.get(name), msg)) + self.fail('Attributes do not match: {}={!r}, {}={!r}. {}'.format(name, value, name, second.attrib.get(name), msg)) for name in second.attrib.keys(): if name not in first.attrib: - self.fail('x2 has an attribute x1 is missing: %s. %s' % (name, msg)) + self.fail('x2 has an attribute x1 is missing: {}. {}'.format(name, msg)) if not xml_text_compare(first.text, second.text): - self.fail('text: %r != %r. %s' % (first.text, second.text, msg)) + self.fail('text: {!r} != {!r}. {}'.format(first.text, second.text, msg)) if not xml_text_compare(first.tail, second.tail): - self.fail('tail: %r != %r. %s' % (first.tail, second.tail, msg)) + self.fail('tail: {!r} != {!r}. {}'.format(first.tail, second.tail, msg)) cl1 = sorted(first.getchildren(), key=lambda x: x.tag) cl2 = sorted(second.getchildren(), key=lambda x: x.tag) if len(cl1) != len(cl2): - self.fail('children length differs, %i != %i. %s' % (len(cl1), len(cl2), msg)) + self.fail('children length differs, {} != {}. {}'.format(len(cl1), len(cl2), msg)) i = 0 for c1, c2 in zip(cl1, cl2): i += 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/deskey.bin new/xmlsec-1.3.13/tests/data/deskey.bin --- old/xmlsec-1.3.12/tests/data/deskey.bin 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/deskey.bin 2022-08-20 22:42:41.000000000 +0200 @@ -1 +1 @@ -012345670123456701234567 \ No newline at end of file +012345670123456701234567 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/doc.xml new/xmlsec-1.3.13/tests/data/doc.xml --- old/xmlsec-1.3.12/tests/data/doc.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/doc.xml 2022-08-20 22:42:41.000000000 +0200 @@ -4,4 +4,4 @@ --> <Envelope> <Data>Hello, World!</Data> -</Envelope> \ No newline at end of file +</Envelope> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/enc1-in.xml new/xmlsec-1.3.13/tests/data/enc1-in.xml --- old/xmlsec-1.3.12/tests/data/enc1-in.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/enc1-in.xml 2022-08-20 22:42:41.000000000 +0200 @@ -4,4 +4,4 @@ --> <Envelope> <Data>Hello, World!</Data> -</Envelope> \ No newline at end of file +</Envelope> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/enc1-out.xml new/xmlsec-1.3.13/tests/data/enc1-out.xml --- old/xmlsec-1.3.12/tests/data/enc1-out.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/enc1-out.xml 2022-08-20 22:42:41.000000000 +0200 @@ -19,4 +19,4 @@ <xenc:CipherValue>2pb5Mxd0f+AW56Cs3MfQ9HJkUVeliSi1hVCNCVHTKeMyC2VL6lPhQ9+L01aSeTSY</xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData> -</Envelope> \ No newline at end of file +</Envelope> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/enc2-out.xml new/xmlsec-1.3.13/tests/data/enc2-out.xml --- old/xmlsec-1.3.12/tests/data/enc2-out.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/enc2-out.xml 2022-08-20 22:42:41.000000000 +0200 @@ -19,4 +19,4 @@ <xenc:CipherValue>4m5BRKEswOe8JISY7NrPGLBYv7Ay5pBV+nG6it51gz0=</xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData> -</Envelope> \ No newline at end of file +</Envelope> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/rsacert.pem new/xmlsec-1.3.13/tests/data/rsacert.pem --- old/xmlsec-1.3.12/tests/data/rsacert.pem 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/rsacert.pem 2022-08-20 22:42:41.000000000 +0200 @@ -32,13 +32,13 @@ 65:c3 Exponent: 65537 (0x10001) X509v3 extensions: - X509v3 Basic Constraints: + X509v3 Basic Constraints: CA:FALSE - Netscape Comment: + Netscape Comment: OpenSSL Generated Certificate - X509v3 Subject Key Identifier: + X509v3 Subject Key Identifier: 24:84:2C:F2:D4:59:20:62:8B:2E:5C:86:90:A3:AA:30:BA:27:1A:9C - X509v3 Authority Key Identifier: + X509v3 Authority Key Identifier: keyid:B4:B9:EF:9A:E6:97:0E:68:65:1E:98:CE:FA:55:0D:89:06:DB:4C:7C DirName:/C=US/ST=California/L=Sunnyvale/O=XML Security Library (http://www.aleksey.com/xmlsec)/OU=Root Certificate/CN=Aleksey Sanin/emailAddress=xml...@aleksey.com serial:00 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign1-in.xml new/xmlsec-1.3.13/tests/data/sign1-in.xml --- old/xmlsec-1.3.12/tests/data/sign1-in.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign1-in.xml 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- -XML Security Library example: Simple signature template file for sign1 example. +<!-- +XML Security Library example: Simple signature template file for sign1 example. --> <Envelope xmlns="urn:envelope"> <Data> @@ -24,4 +24,3 @@ </KeyInfo> </Signature> </Envelope> - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign1-out.xml new/xmlsec-1.3.13/tests/data/sign1-out.xml --- old/xmlsec-1.3.12/tests/data/sign1-out.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign1-out.xml 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- -XML Security Library example: Signed file (sign1 example). +<!-- +XML Security Library example: Signed file (sign1 example). --> <Envelope xmlns="urn:envelope"> <Data> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign2-in.xml new/xmlsec-1.3.13/tests/data/sign2-in.xml --- old/xmlsec-1.3.12/tests/data/sign2-in.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign2-in.xml 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- -XML Security Library example: Original XML doc file for sign2 example. +<!-- +XML Security Library example: Original XML doc file for sign2 example. --> <Envelope xmlns="urn:envelope"> <Data> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign2-out.xml new/xmlsec-1.3.13/tests/data/sign2-out.xml --- old/xmlsec-1.3.12/tests/data/sign2-out.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign2-out.xml 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- -XML Security Library example: Signed XML doc file (sign2 example). +<!-- +XML Security Library example: Signed XML doc file (sign2 example). --> <Envelope xmlns="urn:envelope"> <Data> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign3-in.xml new/xmlsec-1.3.13/tests/data/sign3-in.xml --- old/xmlsec-1.3.12/tests/data/sign3-in.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign3-in.xml 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- -XML Security Library example: Original XML doc file for sign3 example. +<!-- +XML Security Library example: Original XML doc file for sign3 example. --> <Envelope xmlns="urn:envelope"> <Data> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign3-out.xml new/xmlsec-1.3.13/tests/data/sign3-out.xml --- old/xmlsec-1.3.12/tests/data/sign3-out.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign3-out.xml 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- -XML Security Library example: Signed XML doc file (sign3 example). +<!-- +XML Security Library example: Signed XML doc file (sign3 example). --> <Envelope xmlns="urn:envelope"> <Data> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign4-in.xml new/xmlsec-1.3.13/tests/data/sign4-in.xml --- old/xmlsec-1.3.12/tests/data/sign4-in.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign4-in.xml 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- -XML Security Library example: Original XML doc file for sign3 example. +<!-- +XML Security Library example: Original XML doc file for sign3 example. --> <Envelope xmlns="urn:envelope" ID="ef115a20-cf73-11e5-aed1-3c15c2c2cc88"> <Data> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/data/sign4-out.xml new/xmlsec-1.3.13/tests/data/sign4-out.xml --- old/xmlsec-1.3.12/tests/data/sign4-out.xml 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/data/sign4-out.xml 2022-08-20 22:42:41.000000000 +0200 @@ -52,4 +52,4 @@ NJ2D</ds:X509Certificate> </ds:X509Data> </ds:KeyInfo> -</ds:Signature></Envelope> \ No newline at end of file +</ds:Signature></Envelope> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/test_constants.py new/xmlsec-1.3.13/tests/test_constants.py --- old/xmlsec-1.3.12/tests/test_constants.py 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/test_constants.py 2022-08-20 22:42:41.000000000 +0200 @@ -1,6 +1,6 @@ """Test constants from :mod:`xmlsec.constants` module.""" -from hypothesis import given, strategies +import pytest import xmlsec @@ -18,25 +18,25 @@ ) -@given(transform=strategies.sampled_from(_constants('__Transform'))) +@pytest.mark.parametrize('transform', _constants('__Transform'), ids=repr) def test_transform_str(transform): """Test string representation of ``xmlsec.constants.__Transform``.""" assert str(transform) == '{}, {}'.format(transform.name, transform.href) -@given(transform=strategies.sampled_from(_constants('__Transform'))) +@pytest.mark.parametrize('transform', _constants('__Transform'), ids=repr) def test_transform_repr(transform): """Test raw string representation of ``xmlsec.constants.__Transform``.""" assert repr(transform) == '__Transform({!r}, {!r}, {})'.format(transform.name, transform.href, transform.usage) -@given(keydata=strategies.sampled_from(_constants('__KeyData'))) +@pytest.mark.parametrize('keydata', _constants('__KeyData'), ids=repr) def test_keydata_str(keydata): """Test string representation of ``xmlsec.constants.__KeyData``.""" assert str(keydata) == '{}, {}'.format(keydata.name, keydata.href) -@given(keydata=strategies.sampled_from(_constants('__KeyData'))) +@pytest.mark.parametrize('keydata', _constants('__KeyData'), ids=repr) def test_keydata_repr(keydata): """Test raw string representation of ``xmlsec.constants.__KeyData``.""" assert repr(keydata) == '__KeyData({!r}, {!r})'.format(keydata.name, keydata.href) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xmlsec-1.3.12/tests/test_type_stubs.py new/xmlsec-1.3.13/tests/test_type_stubs.py --- old/xmlsec-1.3.12/tests/test_type_stubs.py 2021-09-05 18:54:21.000000000 +0200 +++ new/xmlsec-1.3.13/tests/test_type_stubs.py 2022-08-20 22:42:41.000000000 +0200 @@ -1,7 +1,6 @@ """Test type stubs for correctness where possible.""" import os -import sys import pytest @@ -10,12 +9,6 @@ black = pytest.importorskip('black') -if sys.version_info >= (3, 4): - from pathlib import Path -else: - from _pytest.pathlib import Path - - constants_stub_header = """ import sys from typing import NamedTuple @@ -25,17 +18,23 @@ else: from typing_extensions import Final - class __KeyData(NamedTuple): # __KeyData type href: str name: str +class __KeyDataNoHref(NamedTuple): # __KeyData type + href: None + name: str class __Transform(NamedTuple): # __Transform type href: str name: str usage: int +class __TransformNoHref(NamedTuple): # __Transform type + href: None + name: str + usage: int """ @@ -51,7 +50,10 @@ def process_constant(name): """Generate line in stub file for constant name.""" obj = getattr(xmlsec.constants, name) - return '{name}: Final = {obj!r}'.format(name=name, obj=obj) + type_name = type(obj).__name__ + if type_name in ('__KeyData', '__Transform') and obj.href is None: + type_name += 'NoHref' + return '{name}: Final[{type_name}]'.format(name=name, type_name=type_name) names = list(sorted(name for name in dir(xmlsec.constants) if not name.startswith('__'))) lines = [process_constant(name) for name in names] @@ -64,8 +66,7 @@ Compare it against the existing stub :file:`xmlsec/constants.pyi`. """ - rootdir = Path(str(request.config.rootdir)) - stub = rootdir / 'src' / 'xmlsec' / 'constants.pyi' - mode = black.FileMode(target_versions=[black.TargetVersion.PY38], line_length=130, is_pyi=True, string_normalization=False) + stub = request.config.rootpath / 'src' / 'xmlsec' / 'constants.pyi' + mode = black.FileMode(target_versions={black.TargetVersion.PY39}, line_length=130, is_pyi=True, string_normalization=False) formatted = black.format_file_contents(gen_constants_stub(), fast=False, mode=mode) assert formatted == stub.read_text()