oop-ext 2.3.2__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.github/workflows/deploy.yml +7 -6
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.github/workflows/test.yml +6 -21
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.pre-commit-config.yaml +7 -7
- {oop_ext-2.3.2 → oop_ext-2.4.0}/CHANGELOG.rst +28 -5
- {oop_ext-2.3.2 → oop_ext-2.4.0}/PKG-INFO +32 -8
- {oop_ext-2.3.2 → oop_ext-2.4.0}/setup.py +4 -2
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_cached_method.py +9 -9
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_immutable.py +16 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_types.py +2 -2
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_weak_ref.py +9 -10
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/cached_method.py +1 -1
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_callback.py +13 -15
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_priority_callback.py +2 -2
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_shortcuts.py +4 -4
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_tests/test_callback.py +2 -2
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_tests/test_typed_callback.py +18 -36
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_typed_callback.py +13 -16
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/compat.py +1 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/decorators.py +1 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/immutable.py +11 -9
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/odict.py +1 -1
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/types_.py +1 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/weak_ref.py +7 -7
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/interface/_interface.py +26 -18
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/interface/_tests/test_interface.py +71 -47
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext.egg-info/PKG-INFO +32 -8
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext.egg-info/SOURCES.txt +1 -0
- oop_ext-2.4.0/src/oop_ext.egg-info/scm_file_list.json +78 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.codecov.yml +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.editorconfig +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.gitattributes +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.github/dependabot.yml +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.gitignore +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.isort.cfg +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.project +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.pydevproject +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/.readthedocs.yml +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/CONTRIBUTING.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/LICENSE +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/README.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/api.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/callbacks.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/changelog.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/conf.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/contributing.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/img/logo.png +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/index.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/installation.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/interfaces.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/readme.rst +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/docs/requirements.txt +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/environment.devenv.yml +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/mypy.ini +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/pyproject.toml +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/setup.cfg +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/sonar-project.properties +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/__init__.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/_type_checker_fixture.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/conftest.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/__init__.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/__init__.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_decorators.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_is_frozen.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_odict.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/_tests/test_singleton.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/__init__.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_callbacks.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_tests/__init__.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_tests/test_priority_callback.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/_tests/test_single_call_callback.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/callback/single_call_callback.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/exceptions.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/is_frozen.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/foundation/singleton.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/interface/__init__.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/interface/_adaptable_interface.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/interface/_tests/__init__.py +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext/py.typed +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext.egg-info/dependency_links.txt +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext.egg-info/not-zip-safe +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext.egg-info/requires.txt +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/src/oop_ext.egg-info/top_level.txt +0 -0
- {oop_ext-2.3.2 → oop_ext-2.4.0}/tox.ini +0 -0
|
@@ -20,10 +20,10 @@ jobs:
|
|
|
20
20
|
SETUPTOOLS_SCM_PRETEND_VERSION: ${{ github.event.inputs.version }}
|
|
21
21
|
|
|
22
22
|
steps:
|
|
23
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
24
|
|
|
25
25
|
- name: Build and Check Package
|
|
26
|
-
uses: hynek/build-and-inspect-python-package@v2.
|
|
26
|
+
uses: hynek/build-and-inspect-python-package@v2.18.0
|
|
27
27
|
with:
|
|
28
28
|
attest-build-provenance-github: 'true'
|
|
29
29
|
|
|
@@ -37,21 +37,22 @@ jobs:
|
|
|
37
37
|
contents: write # For tag and release notes.
|
|
38
38
|
|
|
39
39
|
steps:
|
|
40
|
-
- uses: actions/checkout@
|
|
40
|
+
- uses: actions/checkout@v7
|
|
41
41
|
|
|
42
42
|
- name: Download Package
|
|
43
|
-
uses: actions/download-artifact@
|
|
43
|
+
uses: actions/download-artifact@v8
|
|
44
44
|
with:
|
|
45
45
|
name: Packages
|
|
46
46
|
path: dist
|
|
47
47
|
|
|
48
48
|
- name: Publish package to PyPI
|
|
49
|
-
uses: pypa/gh-action-pypi-publish@v1.
|
|
49
|
+
uses: pypa/gh-action-pypi-publish@v1.14.0
|
|
50
50
|
with:
|
|
51
51
|
attestations: true
|
|
52
52
|
|
|
53
53
|
- name: GitHub Release
|
|
54
|
-
uses: softprops/action-gh-release@
|
|
54
|
+
uses: softprops/action-gh-release@v3
|
|
55
55
|
with:
|
|
56
56
|
files: dist/*
|
|
57
57
|
tag_name: v${{ github.event.inputs.version }}
|
|
58
|
+
target_commitish: ${{ github.sha }}
|
|
@@ -20,9 +20,9 @@ jobs:
|
|
|
20
20
|
id-token: write
|
|
21
21
|
attestations: write
|
|
22
22
|
steps:
|
|
23
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@v7
|
|
24
24
|
- name: Build and Check Package
|
|
25
|
-
uses: hynek/build-and-inspect-python-package@v2.
|
|
25
|
+
uses: hynek/build-and-inspect-python-package@v2.18.0
|
|
26
26
|
with:
|
|
27
27
|
# Disabling because this is failing currently, see #466.
|
|
28
28
|
attest-build-provenance-github: 'false'
|
|
@@ -36,20 +36,20 @@ jobs:
|
|
|
36
36
|
strategy:
|
|
37
37
|
fail-fast: false
|
|
38
38
|
matrix:
|
|
39
|
-
python: ["3.
|
|
39
|
+
python: ["3.11", "3.12", "3.13", "3.14", "3.15"]
|
|
40
40
|
os: [ubuntu-latest, windows-latest]
|
|
41
41
|
|
|
42
42
|
steps:
|
|
43
|
-
- uses: actions/checkout@
|
|
43
|
+
- uses: actions/checkout@v7
|
|
44
44
|
|
|
45
45
|
- name: Download Package
|
|
46
|
-
uses: actions/download-artifact@
|
|
46
|
+
uses: actions/download-artifact@v8
|
|
47
47
|
with:
|
|
48
48
|
name: Packages
|
|
49
49
|
path: dist
|
|
50
50
|
|
|
51
51
|
- name: Set up Python
|
|
52
|
-
uses: actions/setup-python@
|
|
52
|
+
uses: actions/setup-python@v6
|
|
53
53
|
with:
|
|
54
54
|
python-version: ${{ matrix.python }}
|
|
55
55
|
|
|
@@ -62,18 +62,3 @@ jobs:
|
|
|
62
62
|
shell: bash
|
|
63
63
|
run: |
|
|
64
64
|
tox run -e py --installpkg `find dist/*.tar.gz`
|
|
65
|
-
|
|
66
|
-
sonarcloud:
|
|
67
|
-
|
|
68
|
-
runs-on: ubuntu-latest
|
|
69
|
-
|
|
70
|
-
steps:
|
|
71
|
-
- uses: actions/checkout@v4.2.2
|
|
72
|
-
with:
|
|
73
|
-
# Disabling shallow clone is recommended for improving relevancy of reporting
|
|
74
|
-
fetch-depth: 0
|
|
75
|
-
- name: SonarCloud Scan
|
|
76
|
-
uses: sonarsource/sonarcloud-github-action@master
|
|
77
|
-
env:
|
|
78
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
79
|
-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
repos:
|
|
2
|
-
- repo: https://github.com/psf/black
|
|
3
|
-
rev:
|
|
2
|
+
- repo: https://github.com/psf/black-pre-commit-mirror
|
|
3
|
+
rev: 26.10.1
|
|
4
4
|
hooks:
|
|
5
5
|
- id: black
|
|
6
6
|
args: [--safe, --quiet]
|
|
7
7
|
language_version: python3
|
|
8
8
|
- repo: https://github.com/asottile/blacken-docs
|
|
9
|
-
rev: 1.
|
|
9
|
+
rev: 1.21.0
|
|
10
10
|
hooks:
|
|
11
11
|
- id: blacken-docs
|
|
12
12
|
additional_dependencies: [black==24.10.0]
|
|
13
13
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
14
|
-
rev:
|
|
14
|
+
rev: v6.0.0
|
|
15
15
|
hooks:
|
|
16
16
|
- id: trailing-whitespace
|
|
17
17
|
- id: end-of-file-fixer
|
|
18
18
|
- id: debug-statements
|
|
19
19
|
- repo: https://github.com/pycqa/isort
|
|
20
|
-
rev:
|
|
20
|
+
rev: 10.0.0b3
|
|
21
21
|
hooks:
|
|
22
22
|
- id: isort
|
|
23
23
|
name: isort
|
|
@@ -26,12 +26,12 @@ repos:
|
|
|
26
26
|
hooks:
|
|
27
27
|
- id: rst
|
|
28
28
|
name: rst
|
|
29
|
-
entry: rst-lint
|
|
29
|
+
entry: rst-lint
|
|
30
30
|
files: ^(CHANGELOG.rst|README.rst)$
|
|
31
31
|
language: python
|
|
32
32
|
additional_dependencies: [pygments, restructuredtext_lint]
|
|
33
33
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
34
|
-
rev:
|
|
34
|
+
rev: v2.4.1
|
|
35
35
|
hooks:
|
|
36
36
|
- id: mypy
|
|
37
37
|
files: ^(src/)
|
|
@@ -1,9 +1,34 @@
|
|
|
1
|
+
2.4.0
|
|
2
|
+
-----
|
|
3
|
+
|
|
4
|
+
**Release**: 2026-11-30
|
|
5
|
+
|
|
6
|
+
* Added support for Python 3.14 and 3.15.
|
|
7
|
+
* Dropped support for Python 3.10.
|
|
8
|
+
* Fixed interface checks keeping classes created at runtime, and everything they reference, alive forever (`#202 <https://github.com/ESSS/oop-ext/issues/202>`__).
|
|
9
|
+
* Fixed import error when ``typing_extensions`` is not installed.
|
|
10
|
+
|
|
11
|
+
2.3.3
|
|
12
|
+
-----
|
|
13
|
+
|
|
14
|
+
**Release**: 2025-08-06
|
|
15
|
+
|
|
16
|
+
* Fix type annotations:
|
|
17
|
+
|
|
18
|
+
* ``oop_ext.foundation.weak_ref.IsWeakProxy``.
|
|
19
|
+
* ``oop_ext.foundation.weak_ref.IsWeakRef``.
|
|
20
|
+
* ``oop_ext.foundation.weak_ref.GetWeakProxy``.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
1
24
|
2.3.2
|
|
2
25
|
-----
|
|
3
26
|
|
|
4
27
|
**Release**: 2025-08-05
|
|
5
28
|
|
|
6
|
-
|
|
29
|
+
**Broken Release**
|
|
30
|
+
|
|
31
|
+
This version contains the incorrect patch -- nothing serious, just the ``master`` version instead of the expected patch.
|
|
7
32
|
|
|
8
33
|
|
|
9
34
|
2.3.1
|
|
@@ -11,11 +36,9 @@
|
|
|
11
36
|
|
|
12
37
|
**Release**: 2025-08-01
|
|
13
38
|
|
|
14
|
-
|
|
39
|
+
**Broken Release**
|
|
15
40
|
|
|
16
|
-
|
|
17
|
-
* ``oop_ext.foundation.weak_ref.IsWeakRef``.
|
|
18
|
-
* ``oop_ext.foundation.weak_ref.GetWeakProxy``.
|
|
41
|
+
This version contains the incorrect patch -- nothing serious, just the ``master`` version instead of the expected patch.
|
|
19
42
|
|
|
20
43
|
|
|
21
44
|
2.3.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: oop-ext
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: OOP Extensions is a set of utilities for object oriented programming not found on Python's standard library.
|
|
5
5
|
Home-page: http://github.com/ESSS/oop-ext
|
|
6
6
|
Author: ESSS
|
|
@@ -10,11 +10,12 @@ Keywords: oop_ext
|
|
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Requires-Python: >=3.11
|
|
18
19
|
Description-Content-Type: text/x-rst
|
|
19
20
|
License-File: LICENSE
|
|
20
21
|
Requires-Dist: attrs
|
|
@@ -179,12 +180,37 @@ Note that the VERSION should follow the semantic versioning as ``X.Y.Z`` (e.g. `
|
|
|
179
180
|
5. Merge the PR.
|
|
180
181
|
|
|
181
182
|
|
|
183
|
+
2.4.0
|
|
184
|
+
-----
|
|
185
|
+
|
|
186
|
+
**Release**: 2026-11-30
|
|
187
|
+
|
|
188
|
+
* Added support for Python 3.14 and 3.15.
|
|
189
|
+
* Dropped support for Python 3.10.
|
|
190
|
+
* Fixed interface checks keeping classes created at runtime, and everything they reference, alive forever (`#202 <https://github.com/ESSS/oop-ext/issues/202>`__).
|
|
191
|
+
* Fixed import error when ``typing_extensions`` is not installed.
|
|
192
|
+
|
|
193
|
+
2.3.3
|
|
194
|
+
-----
|
|
195
|
+
|
|
196
|
+
**Release**: 2025-08-06
|
|
197
|
+
|
|
198
|
+
* Fix type annotations:
|
|
199
|
+
|
|
200
|
+
* ``oop_ext.foundation.weak_ref.IsWeakProxy``.
|
|
201
|
+
* ``oop_ext.foundation.weak_ref.IsWeakRef``.
|
|
202
|
+
* ``oop_ext.foundation.weak_ref.GetWeakProxy``.
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
182
206
|
2.3.2
|
|
183
207
|
-----
|
|
184
208
|
|
|
185
209
|
**Release**: 2025-08-05
|
|
186
210
|
|
|
187
|
-
|
|
211
|
+
**Broken Release**
|
|
212
|
+
|
|
213
|
+
This version contains the incorrect patch -- nothing serious, just the ``master`` version instead of the expected patch.
|
|
188
214
|
|
|
189
215
|
|
|
190
216
|
2.3.1
|
|
@@ -192,11 +218,9 @@ Note that the VERSION should follow the semantic versioning as ``X.Y.Z`` (e.g. `
|
|
|
192
218
|
|
|
193
219
|
**Release**: 2025-08-01
|
|
194
220
|
|
|
195
|
-
|
|
221
|
+
**Broken Release**
|
|
196
222
|
|
|
197
|
-
|
|
198
|
-
* ``oop_ext.foundation.weak_ref.IsWeakRef``.
|
|
199
|
-
* ``oop_ext.foundation.weak_ref.GetWeakProxy``.
|
|
223
|
+
This version contains the incorrect patch -- nothing serious, just the ``master`` version instead of the expected patch.
|
|
200
224
|
|
|
201
225
|
|
|
202
226
|
2.3.0
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env python
|
|
2
2
|
# -*- coding: utf-8 -*-
|
|
3
3
|
"""The setup script."""
|
|
4
|
+
|
|
4
5
|
import io
|
|
5
6
|
from setuptools import find_packages
|
|
6
7
|
from setuptools import setup
|
|
@@ -31,10 +32,11 @@ setup(
|
|
|
31
32
|
"Development Status :: 5 - Production/Stable",
|
|
32
33
|
"Intended Audience :: Developers",
|
|
33
34
|
"License :: OSI Approved :: MIT License",
|
|
34
|
-
"Programming Language :: Python :: 3.10",
|
|
35
35
|
"Programming Language :: Python :: 3.11",
|
|
36
36
|
"Programming Language :: Python :: 3.12",
|
|
37
37
|
"Programming Language :: Python :: 3.13",
|
|
38
|
+
"Programming Language :: Python :: 3.14",
|
|
39
|
+
"Programming Language :: Python :: 3.15",
|
|
38
40
|
],
|
|
39
41
|
description="OOP Extensions is a set of utilities for object oriented programming not found on Python's standard library.",
|
|
40
42
|
extras_require=extras_require,
|
|
@@ -43,7 +45,7 @@ setup(
|
|
|
43
45
|
long_description_content_type="text/x-rst",
|
|
44
46
|
long_description=readme + "\n\n" + history,
|
|
45
47
|
include_package_data=True,
|
|
46
|
-
python_requires=">=3.
|
|
48
|
+
python_requires=">=3.11",
|
|
47
49
|
keywords="oop_ext",
|
|
48
50
|
name="oop-ext",
|
|
49
51
|
packages=find_packages(where="src"),
|
|
@@ -107,27 +107,27 @@ def testCacheMethodAttributeBasedCachedMethod() -> None:
|
|
|
107
107
|
return "%s %d" % (par, self.id)
|
|
108
108
|
|
|
109
109
|
alpha = TestObject()
|
|
110
|
-
alpha.Foo = AttributeBasedCachedMethod( # type:ignore[assignment]
|
|
110
|
+
alpha.Foo = AttributeBasedCachedMethod( # type: ignore[assignment]
|
|
111
111
|
alpha.Foo, "id", cache_size=3
|
|
112
112
|
)
|
|
113
|
-
alpha.Foo("test1") # type:ignore[misc]
|
|
114
|
-
alpha.Foo("test1") # type:ignore[misc]
|
|
113
|
+
alpha.Foo("test1") # type: ignore[misc]
|
|
114
|
+
alpha.Foo("test1") # type: ignore[misc]
|
|
115
115
|
|
|
116
116
|
assert alpha.n_calls == 1
|
|
117
117
|
|
|
118
|
-
alpha.Foo("test2") # type:ignore[misc]
|
|
118
|
+
alpha.Foo("test2") # type: ignore[misc]
|
|
119
119
|
assert alpha.n_calls == 2
|
|
120
|
-
assert len(alpha.Foo._results) == 2 # type:ignore[attr-defined]
|
|
120
|
+
assert len(alpha.Foo._results) == 2 # type: ignore[attr-defined]
|
|
121
121
|
|
|
122
122
|
alpha.id = 3
|
|
123
|
-
alpha.Foo("test2") # type:ignore[misc]
|
|
123
|
+
alpha.Foo("test2") # type: ignore[misc]
|
|
124
124
|
assert alpha.n_calls == 3
|
|
125
125
|
|
|
126
|
-
assert len(alpha.Foo._results) == 3 # type:ignore[attr-defined]
|
|
126
|
+
assert len(alpha.Foo._results) == 3 # type: ignore[attr-defined]
|
|
127
127
|
|
|
128
|
-
alpha.Foo("test3") # type:ignore[misc]
|
|
128
|
+
alpha.Foo("test3") # type: ignore[misc]
|
|
129
129
|
assert alpha.n_calls == 4
|
|
130
|
-
assert len(alpha.Foo._results) == 3 # type:ignore[attr-defined]
|
|
130
|
+
assert len(alpha.Foo._results) == 3 # type: ignore[attr-defined]
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
@pytest.fixture
|
|
@@ -5,6 +5,7 @@ from copy import deepcopy
|
|
|
5
5
|
from oop_ext.foundation.immutable import AsImmutable
|
|
6
6
|
from oop_ext.foundation.immutable import IdentityHashableRef
|
|
7
7
|
from oop_ext.foundation.immutable import ImmutableDict
|
|
8
|
+
from oop_ext.foundation.immutable import RegisterAsImmutable
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
def testImmutable() -> None:
|
|
@@ -106,3 +107,18 @@ def testIdentityHashableRef() -> None:
|
|
|
106
107
|
assert IdentityHashableRef(a) not in dict_b
|
|
107
108
|
assert IdentityHashableRef(b) in dict_b
|
|
108
109
|
assert dict_b[IdentityHashableRef(b)] == 7
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def testRegisterAsImmutableCopyReturnsSameInstance() -> None:
|
|
113
|
+
"""Shallow copies of registered immutable types are the original instance."""
|
|
114
|
+
|
|
115
|
+
class Point:
|
|
116
|
+
pass
|
|
117
|
+
|
|
118
|
+
RegisterAsImmutable(Point)
|
|
119
|
+
p = Point()
|
|
120
|
+
assert copy(p) is p
|
|
121
|
+
assert AsImmutable(p) is p
|
|
122
|
+
|
|
123
|
+
ref = IdentityHashableRef(p)
|
|
124
|
+
assert copy(ref) is ref
|
|
@@ -26,10 +26,10 @@ def testNull() -> None:
|
|
|
26
26
|
n.method1().attr1
|
|
27
27
|
|
|
28
28
|
n.attr1 = "value"
|
|
29
|
-
n.attr1.attr2 = "value" # type:ignore[attr-defined]
|
|
29
|
+
n.attr1.attr2 = "value" # type: ignore[attr-defined]
|
|
30
30
|
|
|
31
31
|
del n.attr1
|
|
32
|
-
del n.attr1.attr2.attr3 # type:ignore[attr-defined]
|
|
32
|
+
del n.attr1.attr2.attr3 # type: ignore[attr-defined]
|
|
33
33
|
|
|
34
34
|
# Iteration
|
|
35
35
|
for _ in n:
|
|
@@ -346,22 +346,21 @@ def testCustomAssertEqual() -> None:
|
|
|
346
346
|
def testRefcount() -> None:
|
|
347
347
|
_, c, _ = SetupTestAttributes()
|
|
348
348
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
) # 2: one in self, and one as argument to getrefcount()
|
|
349
|
+
# Relative to a baseline because Python 3.14 no longer counts the argument reference.
|
|
350
|
+
base = sys.getrefcount(c)
|
|
352
351
|
cf = c.f
|
|
353
|
-
CustomAssertEqual(sys.getrefcount(c),
|
|
352
|
+
CustomAssertEqual(sys.getrefcount(c), base + 1)
|
|
354
353
|
rf = WeakMethodRef(c.f)
|
|
355
354
|
pf = WeakMethodProxy(c.f)
|
|
356
|
-
CustomAssertEqual(sys.getrefcount(c),
|
|
355
|
+
CustomAssertEqual(sys.getrefcount(c), base + 1)
|
|
357
356
|
del cf
|
|
358
|
-
CustomAssertEqual(sys.getrefcount(c),
|
|
357
|
+
CustomAssertEqual(sys.getrefcount(c), base)
|
|
359
358
|
rf2 = WeakMethodRef(c.f)
|
|
360
|
-
CustomAssertEqual(sys.getrefcount(c),
|
|
359
|
+
CustomAssertEqual(sys.getrefcount(c), base)
|
|
361
360
|
del rf
|
|
362
361
|
del rf2
|
|
363
362
|
del pf
|
|
364
|
-
CustomAssertEqual(sys.getrefcount(c),
|
|
363
|
+
CustomAssertEqual(sys.getrefcount(c), base)
|
|
365
364
|
|
|
366
365
|
|
|
367
366
|
def testDies() -> None:
|
|
@@ -510,13 +509,13 @@ def testWeakList() -> None:
|
|
|
510
509
|
def m1() -> None:
|
|
511
510
|
"Never called"
|
|
512
511
|
|
|
513
|
-
weak_list.append(m1) # type:ignore[arg-type]
|
|
512
|
+
weak_list.append(m1) # type: ignore[arg-type]
|
|
514
513
|
assert 1 == len(weak_list[:])
|
|
515
514
|
del m1
|
|
516
515
|
assert 0 == len(weak_list[:])
|
|
517
516
|
|
|
518
517
|
s = _Stub()
|
|
519
|
-
weak_list.append(s.Method) # type:ignore[arg-type]
|
|
518
|
+
weak_list.append(s.Method) # type: ignore[arg-type]
|
|
520
519
|
assert 1 == len(weak_list[:])
|
|
521
520
|
ref_s = weakref.ref(s)
|
|
522
521
|
del s
|
|
@@ -148,7 +148,7 @@ class LastResultCachedMethod(AbstractCachedMethod, Generic[ResultType]):
|
|
|
148
148
|
def _GetCacheResult(self, key: Hashable, result: ResultType) -> ResultType:
|
|
149
149
|
# This could return None (_result is Optional), but not doing an assert
|
|
150
150
|
# here to avoid breaking code.
|
|
151
|
-
return self._result # type:ignore[return-value]
|
|
151
|
+
return self._result # type: ignore[return-value]
|
|
152
152
|
|
|
153
153
|
|
|
154
154
|
class AttributeBasedCachedMethod(CachedMethod, Generic[ResultType]):
|
|
@@ -49,12 +49,12 @@ We can unregister functions using :meth:`Unregister <Callback.Unregister>`, chec
|
|
|
49
49
|
is registered with :meth:`Contains <Callback.Contains>`, and unregister all connected functions
|
|
50
50
|
with :meth:`UnregisterAll <Callback.UnregisterAll>`.
|
|
51
51
|
"""
|
|
52
|
+
|
|
52
53
|
import types
|
|
53
54
|
from typing import Any
|
|
54
55
|
from typing import Optional
|
|
55
56
|
from typing import Tuple
|
|
56
57
|
from typing import Union
|
|
57
|
-
from typing import cast
|
|
58
58
|
|
|
59
59
|
import attr
|
|
60
60
|
import functools
|
|
@@ -188,20 +188,19 @@ class Callback:
|
|
|
188
188
|
is garbage collected, a new function may end up having the same key.
|
|
189
189
|
"""
|
|
190
190
|
if func.__class__ == _CallbackWrapper:
|
|
191
|
-
func = cast(_CallbackWrapper, func)
|
|
192
191
|
func = func.OriginalMethod()
|
|
193
192
|
|
|
194
193
|
try:
|
|
195
|
-
if func.__self__ is not None: # type:ignore[union-attr]
|
|
194
|
+
if func.__self__ is not None: # type: ignore[union-attr]
|
|
196
195
|
# bound method
|
|
197
196
|
return (
|
|
198
|
-
id(func.__self__), # type:ignore[union-attr]
|
|
199
|
-
id(func.__func__), # type:ignore[union-attr]
|
|
200
|
-
id(func.__self__.__class__), # type:ignore[union-attr]
|
|
197
|
+
id(func.__self__), # type: ignore[union-attr]
|
|
198
|
+
id(func.__func__), # type: ignore[union-attr]
|
|
199
|
+
id(func.__self__.__class__), # type: ignore[union-attr]
|
|
201
200
|
)
|
|
202
201
|
else:
|
|
203
202
|
return (
|
|
204
|
-
id(func.__func__), # type:ignore[union-attr]
|
|
203
|
+
id(func.__func__), # type: ignore[union-attr]
|
|
205
204
|
id(GetClassForUnboundMethod(func)),
|
|
206
205
|
)
|
|
207
206
|
|
|
@@ -223,7 +222,6 @@ class Callback:
|
|
|
223
222
|
# at this point, but if it's a WeakMethodProxy, register the original method (we'll make a
|
|
224
223
|
# weak reference later anyways).
|
|
225
224
|
if func.__class__ == WeakMethodProxy:
|
|
226
|
-
func = cast(WeakMethodProxy, func)
|
|
227
225
|
func = func.GetWrappedFunction()
|
|
228
226
|
|
|
229
227
|
if _IsCallableObject(func):
|
|
@@ -240,20 +238,20 @@ class Callback:
|
|
|
240
238
|
|
|
241
239
|
try:
|
|
242
240
|
if (
|
|
243
|
-
func.__self__ is not None # type:ignore[union-attr]
|
|
244
|
-
and func.__func__ is not None # type:ignore[union-attr]
|
|
241
|
+
func.__self__ is not None # type: ignore[union-attr]
|
|
242
|
+
and func.__func__ is not None # type: ignore[union-attr]
|
|
245
243
|
):
|
|
246
244
|
# bound method
|
|
247
245
|
return (
|
|
248
|
-
weakref.ref(func.__self__), # type:ignore[union-attr]
|
|
249
|
-
func.__func__, # type:ignore[union-attr]
|
|
250
|
-
func.__self__.__class__, # type:ignore[union-attr]
|
|
246
|
+
weakref.ref(func.__self__), # type: ignore[union-attr]
|
|
247
|
+
func.__func__, # type: ignore[union-attr]
|
|
248
|
+
func.__self__.__class__, # type: ignore[union-attr]
|
|
251
249
|
)
|
|
252
250
|
else:
|
|
253
251
|
# unbound method
|
|
254
252
|
return (
|
|
255
253
|
None,
|
|
256
|
-
func.__func__, # type:ignore[union-attr]
|
|
254
|
+
func.__func__, # type: ignore[union-attr]
|
|
257
255
|
GetClassForUnboundMethod(func),
|
|
258
256
|
)
|
|
259
257
|
except AttributeError:
|
|
@@ -424,7 +422,7 @@ class Callback:
|
|
|
424
422
|
if func_func == real_func:
|
|
425
423
|
return True
|
|
426
424
|
try:
|
|
427
|
-
f = real_func.__func__ # type:ignore[union-attr]
|
|
425
|
+
f = real_func.__func__ # type: ignore[union-attr]
|
|
428
426
|
except AttributeError:
|
|
429
427
|
return False
|
|
430
428
|
else:
|
|
@@ -20,7 +20,7 @@ class PriorityCallback(Callback):
|
|
|
20
20
|
INFO_POS_PRIORITY = 3
|
|
21
21
|
|
|
22
22
|
@Override(Callback._GetInfo)
|
|
23
|
-
def _GetInfo( # type:ignore[misc, override]
|
|
23
|
+
def _GetInfo( # type: ignore[misc, override]
|
|
24
24
|
self, func: Callable, priority: int
|
|
25
25
|
) -> Any:
|
|
26
26
|
"""
|
|
@@ -33,7 +33,7 @@ class PriorityCallback(Callback):
|
|
|
33
33
|
return info + (priority,)
|
|
34
34
|
|
|
35
35
|
@Override(Callback.Register)
|
|
36
|
-
def Register( # type:ignore[misc, override]
|
|
36
|
+
def Register( # type: ignore[misc, override]
|
|
37
37
|
self,
|
|
38
38
|
func: Callable,
|
|
39
39
|
extra_args: tuple[object, ...] = Callback._EXTRA_ARGS_CONSTANT,
|
|
@@ -174,7 +174,7 @@ def _GetWrapped(method: Method | _MethodWrapper | Callable) -> _MethodWrapper |
|
|
|
174
174
|
if isinstance(method, _MethodWrapper):
|
|
175
175
|
return method
|
|
176
176
|
try:
|
|
177
|
-
return method._wrapped_instance # type:ignore[attr-defined, union-attr]
|
|
177
|
+
return method._wrapped_instance # type: ignore[attr-defined, union-attr]
|
|
178
178
|
except AttributeError:
|
|
179
179
|
return None
|
|
180
180
|
|
|
@@ -194,7 +194,7 @@ def WrapForCallback(method: Method | _MethodWrapper | Callable) -> _MethodWrappe
|
|
|
194
194
|
# Note that the other way around does not work at all (i.e.: if a callback is first added
|
|
195
195
|
# to the instance, there's no way we'll find about that when adding it to the class
|
|
196
196
|
# anyways).
|
|
197
|
-
if method.__self__ is None: # type:ignore[union-attr]
|
|
197
|
+
if method.__self__ is None: # type: ignore[union-attr]
|
|
198
198
|
if wrapped._method._obj is None:
|
|
199
199
|
return wrapped
|
|
200
200
|
|
|
@@ -208,10 +208,10 @@ def WrapForCallback(method: Method | _MethodWrapper | Callable) -> _MethodWrappe
|
|
|
208
208
|
return wrapper(*args, **kwargs)
|
|
209
209
|
|
|
210
210
|
call.__name__ = method.__name__
|
|
211
|
-
call._wrapped_instance = wrapper # type:ignore[attr-defined]
|
|
211
|
+
call._wrapped_instance = wrapper # type: ignore[attr-defined]
|
|
212
212
|
|
|
213
213
|
setattr(GetClassForUnboundMethod(method), method.__name__, call)
|
|
214
214
|
else:
|
|
215
215
|
# override the instance method
|
|
216
|
-
setattr(method.__self__, method.__name__, wrapper) # type:ignore[union-attr]
|
|
216
|
+
setattr(method.__self__, method.__name__, wrapper) # type: ignore[union-attr]
|
|
217
217
|
return wrapper
|
|
@@ -53,8 +53,8 @@ def restore_test_classes() -> Generator[None, None, None]:
|
|
|
53
53
|
original_c_foo = C.foo
|
|
54
54
|
|
|
55
55
|
yield
|
|
56
|
-
Stub.call = original_stub_call # type:ignore[assignment]
|
|
57
|
-
C.foo = original_c_foo # type:ignore[assignment]
|
|
56
|
+
Stub.call = original_stub_call # type: ignore[assignment]
|
|
57
|
+
C.foo = original_c_foo # type: ignore[assignment]
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
class Test:
|