././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.447548 frozenlist-1.5.0/0000755000175100001770000000000014706101203013313 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/.coveragerc0000644000175100001770000000053014706101176015443 0ustar00runnerdocker[paths] source = frozenlist */lib/pypy*/site-packages/frozenlist */lib/python*/site-packages/frozenlist */Lib/site-packages/frozenlist [report] skip_covered = true skip_empty = true show_missing = true [run] branch = true cover_pylib = false plugins = Cython.Coverage relative_files = true source = tests source_pkgs = frozenlist ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/CHANGES.rst0000644000175100001770000001650314706101176015133 0ustar00runnerdocker========= Changelog ========= .. You should *NOT* be adding new change log entries to this file, this file is managed by towncrier. You *may* edit previous change logs to fix problems like typo corrections or such. To add a new change log entry, please see https://pip.pypa.io/en/latest/development/contributing/#news-entries we named the news folder "changes". WARNING: Don't drop the next directive! .. towncrier release notes start 1.5.0 (2024-10-22) ================== Bug fixes --------- - An incorrect signature of the ``__class_getitem__`` class method has been fixed, adding a missing ``class_item`` argument under Python 3.8 and older. This change also improves the code coverage of this method that was previously missing -- by :user:`webknjaz`. *Related issues and pull requests on GitHub:* :issue:`567`, :issue:`571`. Improved documentation ---------------------- - Rendered issue, PR, and commit links now lead to ``frozenlist``'s repo instead of ``yarl``'s repo. *Related issues and pull requests on GitHub:* :issue:`573`. - On the :doc:`Contributing docs ` page, a link to the ``Towncrier philosophy`` has been fixed. *Related issues and pull requests on GitHub:* :issue:`574`. Packaging updates and notes for downstreams ------------------------------------------- - A name of a temporary building directory now reflects that it's related to ``frozenlist``, not ``yarl``. *Related issues and pull requests on GitHub:* :issue:`573`. - Declared Python 3.13 supported officially in the distribution package metadata. *Related issues and pull requests on GitHub:* :issue:`595`. ---- 1.4.1 (2023-12-15) ================== Packaging updates and notes for downstreams ------------------------------------------- - Declared Python 3.12 and PyPy 3.8-3.10 supported officially in the distribution package metadata. *Related issues and pull requests on GitHub:* :issue:`553`. - Replaced the packaging is replaced from an old-fashioned :file:`setup.py` to an in-tree :pep:`517` build backend -- by :user:`webknjaz`. Whenever the end-users or downstream packagers need to build ``frozenlist`` from source (a Git checkout or an sdist), they may pass a ``config_settings`` flag ``pure-python``. If this flag is not set, a C-extension will be built and included into the distribution. Here is how this can be done with ``pip``: .. code-block:: console $ python3 -m pip install . --config-settings=pure-python= This will also work with ``-e | --editable``. The same can be achieved via ``pypa/build``: .. code-block:: console $ python3 -m build --config-setting=pure-python= Adding ``-w | --wheel`` can force ``pypa/build`` produce a wheel from source directly, as opposed to building an ``sdist`` and then building from it. *Related issues and pull requests on GitHub:* :issue:`560`. Contributor-facing changes -------------------------- - It is now possible to request line tracing in Cython builds using the ``with-cython-tracing`` :pep:`517` config setting -- :user:`webknjaz`. This can be used in CI and development environment to measure coverage on Cython modules, but is not normally useful to the end-users or downstream packagers. Here's a usage example: .. code-block:: console $ python3 -Im pip install . --config-settings=with-cython-tracing=true For editable installs, this setting is on by default. Otherwise, it's off unless requested explicitly. The following produces C-files required for the Cython coverage plugin to map the measurements back to the PYX-files: .. code-block:: console $ python -Im pip install -e . Alternatively, the ``FROZENLIST_CYTHON_TRACING=1`` environment variable can be set to do the same as the :pep:`517` config setting. *Related issues and pull requests on GitHub:* :issue:`560`. - Coverage collection has been implemented for the Cython modules -- by :user:`webknjaz`. It will also be reported to Codecov from any non-release CI jobs. *Related issues and pull requests on GitHub:* :issue:`561`. - A step-by-step :doc:`Release Guide ` guide has been added, describing how to release *frozenlist* -- by :user:`webknjaz`. This is primarily targeting the maintainers. *Related issues and pull requests on GitHub:* :issue:`563`. - Detailed :doc:`Contributing Guidelines ` on authoring the changelog fragments have been published in the documentation -- by :user:`webknjaz`. *Related issues and pull requests on GitHub:* :issue:`564`. ---- 1.4.0 (2023-07-12) ================== The published source distribution package became buildable under Python 3.12. ---- Bugfixes -------- - Removed an unused :py:data:`typing.Tuple` import `#411 `_ Deprecations and Removals ------------------------- - Dropped Python 3.7 support. `#413 `_ Misc ---- - `#410 `_, `#433 `_ ---- 1.3.3 (2022-11-08) ================== - Fixed CI runs when creating a new release, where new towncrier versions fail when the current version section is already present. ---- 1.3.2 (2022-11-08) ================== Misc ---- - Updated the CI runs to better check for test results and to avoid deprecated syntax. `#327 `_ ---- 1.3.1 (2022-08-02) ================== The published source distribution package became buildable under Python 3.11. ---- 1.3.0 (2022-01-18) ================== Bugfixes -------- - Do not install C sources with binary distributions. `#250 `_ Deprecations and Removals ------------------------- - Dropped Python 3.6 support `#274 `_ ---- 1.2.0 (2021-10-16) ================== Features -------- - ``FrozenList`` now supports being used as a generic type as per PEP 585, e.g. ``frozen_int_list: FrozenList[int]`` (requires Python 3.9 or newer). `#172 `_ - Added support for Python 3.10. `#227 `_ - Started shipping platform-specific wheels with the ``musl`` tag targeting typical Alpine Linux runtimes. `#227 `_ - Started shipping platform-specific arm64 wheels for Apple Silicon. `#227 `_ ---- 1.1.1 (2020-11-14) ================== Bugfixes -------- - Provide x86 Windows wheels. `#169 `_ ---- 1.1.0 (2020-10-13) ================== Features -------- - Add support for hashing of a frozen list. `#136 `_ - Support Python 3.8 and 3.9. - Provide wheels for ``aarch64``, ``i686``, ``ppc64le``, ``s390x`` architectures on Linux as well as ``x86_64``. ---- 1.0.0 (2019-11-09) ================== Deprecations and Removals ------------------------- - Dropped support for Python 3.5; only 3.6, 3.7 and 3.8 are supported going forward. `#24 `_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/CONTRIBUTORS.txt0000644000175100001770000000021114706101176016014 0ustar00runnerdocker- Contributors - ---------------- Andrew Svetlov Edgar Ramírez-Mondragón Marcin Konowalczyk Martijn Pieters Pau Freixes Paul Colomiets ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/LICENSE0000644000175100001770000002610414706101176014334 0ustar00runnerdockerApache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright 2013-2019 Nikolay Kim and Andrew Svetlov Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/MANIFEST.in0000644000175100001770000000065414706101176015067 0ustar00runnerdockerinclude .coveragerc include pyproject.toml include pytest.ini include LICENSE include CHANGES.rst include README.rst include CONTRIBUTORS.txt graft frozenlist graft packaging graft docs graft requirements graft tests global-exclude *.pyc global-exclude *.pyd global-exclude *.so global-exclude *.lib global-exclude *.dll global-exclude *.a global-exclude *.obj exclude frozenlist/*.c exclude frozenlist/*.html prune docs/_build ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.447548 frozenlist-1.5.0/PKG-INFO0000644000175100001770000003270214706101203014414 0ustar00runnerdockerMetadata-Version: 2.1 Name: frozenlist Version: 1.5.0 Summary: A list-like structure which implements collections.abc.MutableSequence Home-page: https://github.com/aio-libs/frozenlist Maintainer: aiohttp team Maintainer-email: team@aiohttp.org License: Apache 2 Project-URL: Chat: Matrix, https://matrix.to/#/#aio-libs:matrix.org Project-URL: Chat: Matrix Space, https://matrix.to/#/#aio-libs-space:matrix.org Project-URL: CI: Github Actions, https://github.com/aio-libs/frozenlist/actions Project-URL: Code of Conduct, https://github.com/aio-libs/.github/blob/master/CODE_OF_CONDUCT.md Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/frozenlist Project-URL: Docs: Changelog, https://github.com/aio-libs/frozenlist/blob/master/CHANGES.rst#changelog Project-URL: Docs: RTD, https://frozenlist.aio-libs.org Project-URL: GitHub: issues, https://github.com/aio-libs/frozenlist/issues Project-URL: GitHub: repo, https://github.com/aio-libs/frozenlist Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Cython Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.8 Description-Content-Type: text/x-rst License-File: LICENSE frozenlist ========== .. image:: https://github.com/aio-libs/frozenlist/workflows/CI/badge.svg :target: https://github.com/aio-libs/frozenlist/actions :alt: GitHub status for master branch .. image:: https://codecov.io/gh/aio-libs/frozenlist/branch/master/graph/badge.svg :target: https://codecov.io/gh/aio-libs/frozenlist :alt: codecov.io status for master branch .. image:: https://img.shields.io/pypi/v/frozenlist.svg?logo=Python&logoColor=white :target: https://pypi.org/project/frozenlist :alt: frozenlist @ PyPI .. image:: https://readthedocs.org/projects/frozenlist/badge/?version=latest :target: https://frozenlist.aio-libs.org :alt: Read The Docs build status badge .. image:: https://img.shields.io/matrix/aio-libs:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs:matrix.org :alt: Matrix Room — #aio-libs:matrix.org .. image:: https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs-space:matrix.org :alt: Matrix Space — #aio-libs-space:matrix.org Introduction ------------ ``frozenlist.FrozenList`` is a list-like structure which implements ``collections.abc.MutableSequence``. The list is *mutable* until ``FrozenList.freeze`` is called, after which list modifications raise ``RuntimeError``: >>> from frozenlist import FrozenList >>> fl = FrozenList([17, 42]) >>> fl.append('spam') >>> fl.append('Vikings') >>> fl >>> fl.freeze() >>> fl >>> fl.frozen True >>> fl.append("Monty") Traceback (most recent call last): File "", line 1, in File "frozenlist/_frozenlist.pyx", line 97, in frozenlist._frozenlist.FrozenList.append self._check_frozen() File "frozenlist/_frozenlist.pyx", line 19, in frozenlist._frozenlist.FrozenList._check_frozen raise RuntimeError("Cannot modify frozen list.") RuntimeError: Cannot modify frozen list. FrozenList is also hashable, but only when frozen. Otherwise it also throws a RuntimeError: >>> fl = FrozenList([17, 42, 'spam']) >>> hash(fl) Traceback (most recent call last): File "", line 1, in File "frozenlist/_frozenlist.pyx", line 111, in frozenlist._frozenlist.FrozenList.__hash__ raise RuntimeError("Cannot hash unfrozen list.") RuntimeError: Cannot hash unfrozen list. >>> fl.freeze() >>> hash(fl) 3713081631934410656 >>> dictionary = {fl: 'Vikings'} # frozen fl can be a dict key >>> dictionary {: 'Vikings'} Installation ------------ :: $ pip install frozenlist The library requires Python 3.8 or newer. Documentation ------------- https://frozenlist.aio-libs.org Communication channels ---------------------- We have a *Matrix Space* `#aio-libs-space:matrix.org `_ which is also accessible via Gitter. Requirements ------------ - Python >= 3.8 License ------- ``frozenlist`` is offered under the Apache 2 license. Source code ----------- The project is hosted on GitHub_ Please file an issue in the `bug tracker `_ if you have found a bug or have some suggestions to improve the library. .. _GitHub: https://github.com/aio-libs/frozenlist ========= Changelog ========= .. You should *NOT* be adding new change log entries to this file, this file is managed by towncrier. You *may* edit previous change logs to fix problems like typo corrections or such. To add a new change log entry, please see https://pip.pypa.io/en/latest/development/contributing/#news-entries we named the news folder "changes". WARNING: Don't drop the next directive! .. towncrier release notes start 1.5.0 (2024-10-22) ================== Bug fixes --------- - An incorrect signature of the ``__class_getitem__`` class method has been fixed, adding a missing ``class_item`` argument under Python 3.8 and older. This change also improves the code coverage of this method that was previously missing -- by `@webknjaz `__. *Related issues and pull requests on GitHub:* `#567 `__, `#571 `__. Improved documentation ---------------------- - Rendered issue, PR, and commit links now lead to ``frozenlist``'s repo instead of ``yarl``'s repo. *Related issues and pull requests on GitHub:* `#573 `__. - On the ``Contributing docs`` page, a link to the ``Towncrier philosophy`` has been fixed. *Related issues and pull requests on GitHub:* `#574 `__. Packaging updates and notes for downstreams ------------------------------------------- - A name of a temporary building directory now reflects that it's related to ``frozenlist``, not ``yarl``. *Related issues and pull requests on GitHub:* `#573 `__. - Declared Python 3.13 supported officially in the distribution package metadata. *Related issues and pull requests on GitHub:* `#595 `__. ---- 1.4.1 (2023-12-15) ================== Packaging updates and notes for downstreams ------------------------------------------- - Declared Python 3.12 and PyPy 3.8-3.10 supported officially in the distribution package metadata. *Related issues and pull requests on GitHub:* `#553 `__. - Replaced the packaging is replaced from an old-fashioned ``setup.py`` to an in-tree `PEP 517 `__ build backend -- by `@webknjaz `__. Whenever the end-users or downstream packagers need to build ``frozenlist`` from source (a Git checkout or an sdist), they may pass a ``config_settings`` flag ``pure-python``. If this flag is not set, a C-extension will be built and included into the distribution. Here is how this can be done with ``pip``: .. code-block:: console $ python3 -m pip install . --config-settings=pure-python= This will also work with ``-e | --editable``. The same can be achieved via ``pypa/build``: .. code-block:: console $ python3 -m build --config-setting=pure-python= Adding ``-w | --wheel`` can force ``pypa/build`` produce a wheel from source directly, as opposed to building an ``sdist`` and then building from it. *Related issues and pull requests on GitHub:* `#560 `__. Contributor-facing changes -------------------------- - It is now possible to request line tracing in Cython builds using the ``with-cython-tracing`` `PEP 517 `__ config setting -- `@webknjaz `__. This can be used in CI and development environment to measure coverage on Cython modules, but is not normally useful to the end-users or downstream packagers. Here's a usage example: .. code-block:: console $ python3 -Im pip install . --config-settings=with-cython-tracing=true For editable installs, this setting is on by default. Otherwise, it's off unless requested explicitly. The following produces C-files required for the Cython coverage plugin to map the measurements back to the PYX-files: .. code-block:: console $ python -Im pip install -e . Alternatively, the ``FROZENLIST_CYTHON_TRACING=1`` environment variable can be set to do the same as the `PEP 517 `__ config setting. *Related issues and pull requests on GitHub:* `#560 `__. - Coverage collection has been implemented for the Cython modules -- by `@webknjaz `__. It will also be reported to Codecov from any non-release CI jobs. *Related issues and pull requests on GitHub:* `#561 `__. - A step-by-step ``Release Guide`` guide has been added, describing how to release *frozenlist* -- by `@webknjaz `__. This is primarily targeting the maintainers. *Related issues and pull requests on GitHub:* `#563 `__. - Detailed ``Contributing Guidelines`` on authoring the changelog fragments have been published in the documentation -- by `@webknjaz `__. *Related issues and pull requests on GitHub:* `#564 `__. ---- 1.4.0 (2023-07-12) ================== The published source distribution package became buildable under Python 3.12. ---- Bugfixes -------- - Removed an unused ``typing.Tuple`` import `#411 `_ Deprecations and Removals ------------------------- - Dropped Python 3.7 support. `#413 `_ Misc ---- - `#410 `_, `#433 `_ ---- 1.3.3 (2022-11-08) ================== - Fixed CI runs when creating a new release, where new towncrier versions fail when the current version section is already present. ---- 1.3.2 (2022-11-08) ================== Misc ---- - Updated the CI runs to better check for test results and to avoid deprecated syntax. `#327 `_ ---- 1.3.1 (2022-08-02) ================== The published source distribution package became buildable under Python 3.11. ---- 1.3.0 (2022-01-18) ================== Bugfixes -------- - Do not install C sources with binary distributions. `#250 `_ Deprecations and Removals ------------------------- - Dropped Python 3.6 support `#274 `_ ---- 1.2.0 (2021-10-16) ================== Features -------- - ``FrozenList`` now supports being used as a generic type as per PEP 585, e.g. ``frozen_int_list: FrozenList[int]`` (requires Python 3.9 or newer). `#172 `_ - Added support for Python 3.10. `#227 `_ - Started shipping platform-specific wheels with the ``musl`` tag targeting typical Alpine Linux runtimes. `#227 `_ - Started shipping platform-specific arm64 wheels for Apple Silicon. `#227 `_ ---- 1.1.1 (2020-11-14) ================== Bugfixes -------- - Provide x86 Windows wheels. `#169 `_ ---- 1.1.0 (2020-10-13) ================== Features -------- - Add support for hashing of a frozen list. `#136 `_ - Support Python 3.8 and 3.9. - Provide wheels for ``aarch64``, ``i686``, ``ppc64le``, ``s390x`` architectures on Linux as well as ``x86_64``. ---- 1.0.0 (2019-11-09) ================== Deprecations and Removals ------------------------- - Dropped support for Python 3.5; only 3.6, 3.7 and 3.8 are supported going forward. `#24 `_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/README.rst0000644000175100001770000000670514706101176015023 0ustar00runnerdockerfrozenlist ========== .. image:: https://github.com/aio-libs/frozenlist/workflows/CI/badge.svg :target: https://github.com/aio-libs/frozenlist/actions :alt: GitHub status for master branch .. image:: https://codecov.io/gh/aio-libs/frozenlist/branch/master/graph/badge.svg :target: https://codecov.io/gh/aio-libs/frozenlist :alt: codecov.io status for master branch .. image:: https://img.shields.io/pypi/v/frozenlist.svg?logo=Python&logoColor=white :target: https://pypi.org/project/frozenlist :alt: frozenlist @ PyPI .. image:: https://readthedocs.org/projects/frozenlist/badge/?version=latest :target: https://frozenlist.aio-libs.org :alt: Read The Docs build status badge .. image:: https://img.shields.io/matrix/aio-libs:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs:matrix.org :alt: Matrix Room — #aio-libs:matrix.org .. image:: https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs-space:matrix.org :alt: Matrix Space — #aio-libs-space:matrix.org Introduction ------------ ``frozenlist.FrozenList`` is a list-like structure which implements ``collections.abc.MutableSequence``. The list is *mutable* until ``FrozenList.freeze`` is called, after which list modifications raise ``RuntimeError``: >>> from frozenlist import FrozenList >>> fl = FrozenList([17, 42]) >>> fl.append('spam') >>> fl.append('Vikings') >>> fl >>> fl.freeze() >>> fl >>> fl.frozen True >>> fl.append("Monty") Traceback (most recent call last): File "", line 1, in File "frozenlist/_frozenlist.pyx", line 97, in frozenlist._frozenlist.FrozenList.append self._check_frozen() File "frozenlist/_frozenlist.pyx", line 19, in frozenlist._frozenlist.FrozenList._check_frozen raise RuntimeError("Cannot modify frozen list.") RuntimeError: Cannot modify frozen list. FrozenList is also hashable, but only when frozen. Otherwise it also throws a RuntimeError: >>> fl = FrozenList([17, 42, 'spam']) >>> hash(fl) Traceback (most recent call last): File "", line 1, in File "frozenlist/_frozenlist.pyx", line 111, in frozenlist._frozenlist.FrozenList.__hash__ raise RuntimeError("Cannot hash unfrozen list.") RuntimeError: Cannot hash unfrozen list. >>> fl.freeze() >>> hash(fl) 3713081631934410656 >>> dictionary = {fl: 'Vikings'} # frozen fl can be a dict key >>> dictionary {: 'Vikings'} Installation ------------ :: $ pip install frozenlist The library requires Python 3.8 or newer. Documentation ------------- https://frozenlist.aio-libs.org Communication channels ---------------------- We have a *Matrix Space* `#aio-libs-space:matrix.org `_ which is also accessible via Gitter. Requirements ------------ - Python >= 3.8 License ------- ``frozenlist`` is offered under the Apache 2 license. Source code ----------- The project is hosted on GitHub_ Please file an issue in the `bug tracker `_ if you have found a bug or have some suggestions to improve the library. .. _GitHub: https://github.com/aio-libs/frozenlist ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1729659523.4395478 frozenlist-1.5.0/docs/0000755000175100001770000000000014706101203014243 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/Makefile0000644000175100001770000001534714706101176015726 0ustar00runnerdocker# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/frozenlist.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/frozenlist.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/frozenlist" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/frozenlist" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." spelling: $(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling @echo @echo "Build finished." ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/changes.rst0000644000175100001770000000055014706101176016416 0ustar00runnerdocker.. _frozenlist_changes: ========= Changelog ========= .. only:: not is_release To be included in v\ |release| (if present) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. towncrier-draft-entries:: |release| [UNRELEASED DRAFT] Released versions ^^^^^^^^^^^^^^^^^ .. include:: ../CHANGES.rst :start-after: .. towncrier release notes start ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/conf.py0000644000175100001770000003044214706101176015556 0ustar00runnerdocker#!/usr/bin/env python3 # # frozenlist documentation build configuration file, created by # sphinx-quickstart on Wed Mar 5 12:35:35 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import os import re from contextlib import suppress from pathlib import Path PROJECT_ROOT_DIR = Path(__file__).parents[1].resolve() IS_RELEASE_ON_RTD = ( os.getenv("READTHEDOCS", "False") == "True" and os.environ["READTHEDOCS_VERSION_TYPE"] == "tag" ) if IS_RELEASE_ON_RTD: tags.add("is_release") _docs_path = Path(__file__).parent _version_path = _docs_path / ".." / "frozenlist" / "__init__.py" with _version_path.open(encoding="utf-8") as fp: try: _version_info = re.search( r'^__version__ = "' r"(?P\d+)" r"\.(?P\d+)" r"\.(?P\d+)" r'(?P.*)?"$', fp.read(), re.M, ).groupdict() except IndexError: raise RuntimeError("Unable to determine version.") # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ # stdlib-party extensions: "sphinx.ext.extlinks", "sphinx.ext.viewcode", "sphinx.ext.intersphinx", # Third-party extensions: "sphinxcontrib.towncrier.ext", # provides `towncrier-draft-entries` directive ] with suppress(ImportError): # spelling extension is optional, only add it when installed import sphinxcontrib.spelling # noqa # type: ignore extensions.append("sphinxcontrib.spelling") intersphinx_mapping = { "python": ("https://docs.python.org/3", None), "aiohttp": ("https://docs.aiohttp.org/en/stable/", None), } # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix of source filenames. source_suffix = ".rst" # The encoding of source files. # source_encoding = 'utf-8-sig' # The master toctree document. master_doc = "index" # General information about the project. github_url = "https://github.com" github_repo_org = "aio-libs" github_repo_name = "frozenlist" github_repo_slug = f"{github_repo_org}/{github_repo_name}" github_repo_url = f"{github_url}/{github_repo_slug}" github_sponsors_url = f"{github_url}/sponsors" project = github_repo_name copyright = "2013, frozenlist contributors" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = "{major}.{minor}".format(**_version_info) # The full version, including alpha/beta/rc tags. release = "{major}.{minor}.{patch}{tag}".format(**_version_info) rst_epilog = f""" .. |project| replace:: {project} """ # pylint: disable=invalid-name # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: # today = '' # Else, today_fmt is used as the format for a strftime call. # today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ["_build"] # The reST default role (used for this markup: `text`) to use for all # documents. # default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. # add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). # add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. # show_authors = False # The name of the Pygments (syntax highlighting) style to use. # pygments_style = 'sphinx' # The default language to highlight source code in. highlight_language = "python3" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. # keep_warnings = False # -- Extension configuration ------------------------------------------------- # -- Options for extlinks extension --------------------------------------- extlinks = { "issue": (f"{github_repo_url}/issues/%s", "#%s"), "pr": (f"{github_repo_url}/pull/%s", "PR #%s"), "commit": (f"{github_repo_url}/commit/%s", "%s"), "gh": (f"{github_url}/%s", "GitHub: %s"), "user": (f"{github_sponsors_url}/%s", "@%s"), } # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "aiohttp_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { "logo": None, "description": ( "A list-like structure which implements collections.abc.MutableSequence" ), "canonical_url": "https://frozenlist.aio-libs.org/en/stable/", "github_user": github_repo_org, "github_repo": github_repo_name, "github_button": True, "github_type": "star", "github_banner": True, "badges": [ { "image": f"{github_repo_url}/workflows/CI/badge.svg", "target": f"{github_repo_url}/actions", "height": "20", "alt": "Github CI status for master branch", }, { "image": ( f"https://codecov.io/github/{github_repo_slug}/coverage.svg" "?branch=master" ), "target": f"https://codecov.io/github/{github_repo_slug}", "height": "20", "alt": "Code coverage status", }, { "image": f"https://badge.fury.io/py/{github_repo_name}.svg", "target": f"https://badge.fury.io/py/{github_repo_name}", "height": "20", "alt": "Latest PyPI package version", }, { "image": "https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat", "target": "https://matrix.to/#/%23aio-libs-space:matrix.org", "height": "20", "alt": "Matrix Space", }, ], } # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [alabaster.get_path()] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None # A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. # html_logo = 'frozenlist-icon.svg' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = 'favicon.ico' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". # html_static_path = [] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. # html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. # html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. # html_use_smartypants = True # Custom sidebar templates, maps document names to template names. html_sidebars = { "**": [ "about.html", "navigation.html", "searchbox.html", ] } # Additional templates that should be rendered to pages, maps page names to # template names. # html_additional_pages = {} # If false, no module index is generated. # html_domain_indices = True # If false, no index is generated. # html_use_index = True # If true, the index is split into individual pages for each letter. # html_split_index = False # If true, links to the reST sources are added to the pages. # html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. # html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). # html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = f"{github_repo_name}doc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # 'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ( "index", f"{github_repo_name}.tex", f"{github_repo_name} Documentation", f"{github_repo_name} contributors", "manual", ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. # latex_use_parts = False # If true, show page references after internal links. # latex_show_pagerefs = False # If true, show URL addresses after external links. # latex_show_urls = False # Documents to append as an appendix to all manuals. # latex_appendices = [] # If false, no module index is generated. # latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ( "index", github_repo_name, f"{github_repo_name} Documentation", [github_repo_name], 1, ) ] # If true, show URL addresses after external links. # man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( "index", github_repo_name, f"{github_repo_name} Documentation", f"{github_repo_name} contributors", github_repo_name, "One line description of project.", "Miscellaneous", ), ] # Documents to append as an appendix to all manuals. # texinfo_appendices = [] # If false, no module index is generated. # texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. # texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. # texinfo_no_detailmenu = False # -- Strictness options -------------------------------------------------- nitpicky = True nitpick_ignore = [] # -- Options for towncrier_draft extension ----------------------------------- towncrier_draft_autoversion_mode = "draft" # or: 'sphinx-version', 'sphinx-release' towncrier_draft_include_empty = True towncrier_draft_working_directory = PROJECT_ROOT_DIR towncrier_draft_config_path = "pyproject.toml" # relative to cwd ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1729659523.4395478 frozenlist-1.5.0/docs/contributing/0000755000175100001770000000000014706101203016752 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/contributing/guidelines.rst0000644000175100001770000000176614706101176021657 0ustar00runnerdocker----------------- Contributing docs ----------------- We use Sphinx_ to generate our docs website. You can trigger the process locally by executing: .. code-block:: shell-session $ make doc It is also integrated with `Read The Docs`_ that builds and publishes each commit to the main branch and generates live docs previews for each pull request. The sources of the Sphinx_ documents use reStructuredText as a de-facto standard. But in order to make contributing docs more beginner-friendly, we've integrated `MyST parser`_ allowing us to also accept new documents written in an extended version of Markdown that supports using Sphinx directives and roles. `Read the docs `_ to learn more on how to use it. .. _MyST docs: https://myst-parser.readthedocs.io/en/latest/using/intro.html#writing-myst-in-sphinx .. _MyST parser: https://pypi.org/project/myst-parser/ .. _Read The Docs: https://readthedocs.org .. _Sphinx: https://www.sphinx-doc.org .. include:: ../../CHANGES/README.rst ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/contributing/release_guide.rst0000644000175100001770000000766014706101176022323 0ustar00runnerdocker************* Release Guide ************* Welcome to the |project| Release Guide! This page contains information on how to release a new version of |project| using the automated Continuous Delivery pipeline. .. tip:: The intended audience for this document is maintainers and core contributors. Pre-release activities ====================== 1. Check if there are any open Pull Requests that could be desired in the upcoming release. If there are any — merge them. If some are incomplete, try to get them ready. Don't forget to review the enclosed change notes per our guidelines. 2. Visually inspect the draft section of the :ref:`Changelog` page. Make sure the content looks consistent, uses the same writing style, targets the end-users and adheres to our documented guidelines. Most of the changelog sections will typically use the past tense or another way to relay the effect of the changes for the users, since the previous release. It should not target core contributors as the information they are normally interested in is already present in the Git history. Update the changelog fragments if you see any problems with this changelog section. 3. Optionally, test the previously published nightlies, that are available through GitHub Actions CI/CD artifacts, locally. 4. If you are satisfied with the above, inspect the changelog section categories in the draft. Presence of the breaking changes or features will hint you what version number segment to bump for the release. 5. Update the hardcoded version string in :file:`frozenlist/__init__.py`. Generate a new changelog from the fragments, and commit it along with the fragments removal and the Python module changes. Use the following commands, don't prepend a leading-``v`` before the version number. Just use the raw version number as per :pep:`440`. .. code-block:: shell-session [dir:frozenlist] $ frozenlist/__init__.py [dir:frozenlist] $ python -m towncrier build \ -- --version 'VERSION_WITHOUT_LEADING_V' [dir:frozenlist] $ git commit -v CHANGES{.rst,/} frozenlist/__init__.py .. seealso:: :ref:`Adding change notes with your PRs` Writing beautiful changelogs for humans The release stage ================= 1. Tag the commit with version and changelog changes, created during the preparation stage. If possible, make it GPG-signed. Prepend a leading ``v`` before the version number for the tag name. Add an extra sentence describing the release contents, in a few words. .. code-block:: shell-session [dir:frozenlist] $ git tag \ -s 'VERSION_WITH_LEADING_V' \ -m 'VERSION_WITH_LEADING_V' \ -m 'This release does X and Y.' 2. Push that tag to the upstream repository, which ``origin`` is considered to be in the example below. .. code-block:: shell-session [dir:frozenlist] $ git push origin 'VERSION_WITH_LEADING_V' 3. You can open the `GitHub Actions CI/CD workflow page `_ in your web browser to monitor the progress. But generally, you don't need to babysit the CI. 4. Check that web page or your email inbox for the notification with an approval request. GitHub will send it when it reaches the final "publishing" job. 5. Approve the deployment and wait for the CD workflow to complete. 6. Verify that the following things got created: - a PyPI release - a Git tag - a GitHub Releases page 7. Tell everyone you released a new version of |project| :) Depending on your mental capacity and the burnout stage, you are encouraged to post the updates in issues asking for the next release, contributed PRs, Bluesky, Twitter etc. You can also call out prominent contributors and thank them! .. _GitHub Actions CI/CD workflow: https://github.com/aio-libs/frozenlist/actions/workflows/ci-cd.yml ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/index.rst0000644000175100001770000000427714706101176016127 0ustar00runnerdockerfrozenlist ========== A list-like structure which implements :class:`collections.abc.MutableSequence`. The list is *mutable* until :meth:`~frozenlist.FrozenList.freeze` is called, after which list modifications raise :exc:`RuntimeError`. A :class:`~frozenlist.FrozenList` instance is hashable, but only when frozen. Attempts to hash a non-frozen instance will result in a :exc:`RuntimeError` exception. API --- .. class:: frozenlist.FrozenList(items) Construct a new *non-frozen* list from *items* iterable. The list implements all :class:`collections.abc.MutableSequence` methods plus two additional APIs. .. attribute:: frozen A read-only property, ``True`` is the list is *frozen* (modifications are forbidden). .. method:: freeze() Freeze the list. There is no way to *thaw* it back. Installation ------------ .. code-block:: bash $ pip install frozenlist The library requires Python 3.8 or newer. Documentation ============= https://frozenlist.aio-libs.org Communication channels ====================== We have a *Matrix Space* `#aio-libs-space:matrix.org `_ which is also accessible via Gitter. Requirements ============ - Python >= 3.8 License ======= ``frozenlist`` is offered under the Apache 2 license. Source code =========== The project is hosted on GitHub_ Please file an issue in the `bug tracker `_ if you have found a bug or have some suggestions to improve the library. Authors and License =================== The ``frozenlist`` package was originally part of the :doc:`aiohttp project `, written by Nikolay Kim and Andrew Svetlov. It is now being maintained by Martijn Pieters. It's *Apache 2* licensed and freely available. Feel free to improve this package and send a pull request to GitHub_. .. toctree:: :maxdepth: 2 .. toctree:: :caption: What's new changes .. toctree:: :caption: Contributing contributing/guidelines .. toctree:: :caption: Maintenance contributing/release_guide Indices and tables ================== * :ref:`genindex` * :ref:`search` .. _GitHub: https://github.com/aio-libs/frozenlist ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/make.bat0000644000175100001770000001506514706101176015670 0ustar00runnerdocker@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. xml to make Docutils-native XML files echo. pseudoxml to make pseudoxml-XML files for display purposes echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) %SPHINXBUILD% 2> nul if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\frozenlist.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\frozenlist.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdf" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "latexpdfja" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex cd %BUILDDIR%/latex make all-pdf-ja cd %BUILDDIR%/.. echo. echo.Build finished; the PDF files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) if "%1" == "xml" ( %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml if errorlevel 1 exit /b 1 echo. echo.Build finished. The XML files are in %BUILDDIR%/xml. goto end ) if "%1" == "pseudoxml" ( %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml if errorlevel 1 exit /b 1 echo. echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. goto end ) :end ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/docs/spelling_wordlist.txt0000644000175100001770000000537114706101176020567 0ustar00runnerdockerabc aiodns aioes aiohttp aiohttpdemo aiohttp’s aiopg alives api api’s app apps app’s arg Arsenic async asyncio auth autocalculated autodetection autogenerates autogeneration awaitable backend backends Backport Backporting backport backports BaseEventLoop basename BasicAuth Bluesky BodyPartReader boolean botocore Bugfixes buildable builtin bugfix BytesIO cchardet cChardet changelog changelogs Changelog charset charsetdetect chunked chunking CIMultiDict ClientSession cls cmd codec Codecov Codings committer committers config Config configs conjunction contextmanager CookieJar coroutine Coroutine coroutines cpu CPython css ctor Ctrl Cython cythonized Cythonize de deduplicate # de-facto: deprecations DER dev Dev dict Dict Discord django Django dns DNSResolver docstring downstreams Dup elasticsearch encodings env environ eof epoll Facebook facto fallback fallbacks filename finalizers frontend frozenlist getall gethostbyname github Gitter google GPG gunicorn gunicorn’s gzipped hackish hardcoded hashable highlevel hostnames HTTPException HttpProcessingError httpretty https impl incapsulates Indices infos initializer inline intaking io ip IP ipdb IPv ish iterable iterables javascript Jinja json keepalive keepalived keepalives keepaliving kwarg latin linux localhost Locator login lookup lookups lossless Mako Martijn manylinux metadata microservice middleware middlewares miltidict misbehaviors Mixcloud Mongo msg MsgType multi multidict multidicts multidict’s Multidicts multipart Multipart Nagle Nagle’s namedtuple nameservers namespace nginx Nginx nightlies Nikolay noop nowait OAuth Online optimizations os outcoming Overridable Paolini param params pathlib peername Pieters ping pipelining pluggable plugin poller pong Postgres pre programmatically proxied PRs pubsub Punycode py pyenv pyflakes pytest Pytest Quickstart quote’s readonly readpayload rebase redirections Redis refactor Refactor refactored refactoring reStructuredText regex regexps regexs reloader renderer renderers repo repr repr’s RequestContextManager request’s Request’s requote requoting resolvehost resolvers reusage reuseconn Runit runtimes sa Satisfiable schemas sdist sendfile serializable shourtcuts skipuntil Skyscanner SocketSocketTransport ssl SSLContext startup subapplication subclasses submodules subpackage subprotocol subprotocols subtype supervisord Supervisord Svetlov symlink symlinks syscall syscalls Systemd tarball TCP TLS teardown Teardown TestClient Testsuite Tf timestamps toolbar toplevel towncrier tp tuples UI un unawaited unclosed unicode unittest Unittest unix unsets unstripped upstr url urldispatcher urlencoded urls url’s utf utils uvloop vcvarsall waituntil webapp websocket websockets websocket’s Websockets wildcard Workflow ws wsgi WSMessage WSMsgType wss www xxx ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1729659523.4395478 frozenlist-1.5.0/frozenlist/0000755000175100001770000000000014706101203015512 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/frozenlist/__init__.py0000644000175100001770000000450314706101176017636 0ustar00runnerdockerimport os import sys import types from collections.abc import MutableSequence from functools import total_ordering from typing import Any, Type __version__ = "1.5.0" __all__ = ("FrozenList", "PyFrozenList") # type: Tuple[str, ...] NO_EXTENSIONS = bool(os.environ.get("FROZENLIST_NO_EXTENSIONS")) # type: bool @total_ordering class FrozenList(MutableSequence): __slots__ = ("_frozen", "_items") if sys.version_info >= (3, 9): __class_getitem__ = classmethod(types.GenericAlias) else: @classmethod def __class_getitem__( cls: Type["FrozenList"], cls_item: Any, ) -> Type["FrozenList"]: return cls def __init__(self, items=None): self._frozen = False if items is not None: items = list(items) else: items = [] self._items = items @property def frozen(self): return self._frozen def freeze(self): self._frozen = True def __getitem__(self, index): return self._items[index] def __setitem__(self, index, value): if self._frozen: raise RuntimeError("Cannot modify frozen list.") self._items[index] = value def __delitem__(self, index): if self._frozen: raise RuntimeError("Cannot modify frozen list.") del self._items[index] def __len__(self): return self._items.__len__() def __iter__(self): return self._items.__iter__() def __reversed__(self): return self._items.__reversed__() def __eq__(self, other): return list(self) == other def __le__(self, other): return list(self) <= other def insert(self, pos, item): if self._frozen: raise RuntimeError("Cannot modify frozen list.") self._items.insert(pos, item) def __repr__(self): return f"" def __hash__(self): if self._frozen: return hash(tuple(self)) else: raise RuntimeError("Cannot hash unfrozen list.") PyFrozenList = FrozenList if not NO_EXTENSIONS: try: from ._frozenlist import FrozenList as CFrozenList # type: ignore except ImportError: # pragma: no cover pass else: FrozenList = CFrozenList # type: ignore ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/frozenlist/__init__.pyi0000644000175100001770000000267614706101176020020 0ustar00runnerdockerfrom typing import ( Generic, Iterable, Iterator, List, MutableSequence, Optional, TypeVar, Union, overload, ) _T = TypeVar("_T") _Arg = Union[List[_T], Iterable[_T]] class FrozenList(MutableSequence[_T], Generic[_T]): def __init__(self, items: Optional[_Arg[_T]] = None) -> None: ... @property def frozen(self) -> bool: ... def freeze(self) -> None: ... @overload def __getitem__(self, i: int) -> _T: ... @overload def __getitem__(self, s: slice) -> FrozenList[_T]: ... @overload def __setitem__(self, i: int, o: _T) -> None: ... @overload def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ... @overload def __delitem__(self, i: int) -> None: ... @overload def __delitem__(self, i: slice) -> None: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... def __reversed__(self) -> Iterator[_T]: ... def __eq__(self, other: object) -> bool: ... def __le__(self, other: FrozenList[_T]) -> bool: ... def __ne__(self, other: object) -> bool: ... def __lt__(self, other: FrozenList[_T]) -> bool: ... def __ge__(self, other: FrozenList[_T]) -> bool: ... def __gt__(self, other: FrozenList[_T]) -> bool: ... def insert(self, pos: int, item: _T) -> None: ... def __repr__(self) -> str: ... def __hash__(self) -> int: ... # types for C accelerators are the same CFrozenList = PyFrozenList = FrozenList ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/frozenlist/_frozenlist.pyx0000644000175100001770000000566114706101176020633 0ustar00runnerdockerimport sys import types from collections.abc import MutableSequence cdef class FrozenList: if sys.version_info >= (3, 9): __class_getitem__ = classmethod(types.GenericAlias) else: @classmethod def __class_getitem__(cls, cls_item): return cls cdef readonly bint frozen cdef list _items def __init__(self, items=None): self.frozen = False if items is not None: items = list(items) else: items = [] self._items = items cdef object _check_frozen(self): if self.frozen: raise RuntimeError("Cannot modify frozen list.") cdef inline object _fast_len(self): return len(self._items) def freeze(self): self.frozen = True def __getitem__(self, index): return self._items[index] def __setitem__(self, index, value): self._check_frozen() self._items[index] = value def __delitem__(self, index): self._check_frozen() del self._items[index] def __len__(self): return self._fast_len() def __iter__(self): return self._items.__iter__() def __reversed__(self): return self._items.__reversed__() def __richcmp__(self, other, op): if op == 0: # < return list(self) < other if op == 1: # <= return list(self) <= other if op == 2: # == return list(self) == other if op == 3: # != return list(self) != other if op == 4: # > return list(self) > other if op == 5: # => return list(self) >= other def insert(self, pos, item): self._check_frozen() self._items.insert(pos, item) def __contains__(self, item): return item in self._items def __iadd__(self, items): self._check_frozen() self._items += list(items) return self def index(self, item): return self._items.index(item) def remove(self, item): self._check_frozen() self._items.remove(item) def clear(self): self._check_frozen() self._items.clear() def extend(self, items): self._check_frozen() self._items += list(items) def reverse(self): self._check_frozen() self._items.reverse() def pop(self, index=-1): self._check_frozen() return self._items.pop(index) def append(self, item): self._check_frozen() return self._items.append(item) def count(self, item): return self._items.count(item) def __repr__(self): return ''.format(self.frozen, self._items) def __hash__(self): if self.frozen: return hash(tuple(self._items)) else: raise RuntimeError("Cannot hash unfrozen list.") MutableSequence.register(FrozenList) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/frozenlist/py.typed0000644000175100001770000000000714706101176017217 0ustar00runnerdockerMarker ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.443548 frozenlist-1.5.0/frozenlist.egg-info/0000755000175100001770000000000014706101203017204 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659523.0 frozenlist-1.5.0/frozenlist.egg-info/PKG-INFO0000644000175100001770000003270214706101203020305 0ustar00runnerdockerMetadata-Version: 2.1 Name: frozenlist Version: 1.5.0 Summary: A list-like structure which implements collections.abc.MutableSequence Home-page: https://github.com/aio-libs/frozenlist Maintainer: aiohttp team Maintainer-email: team@aiohttp.org License: Apache 2 Project-URL: Chat: Matrix, https://matrix.to/#/#aio-libs:matrix.org Project-URL: Chat: Matrix Space, https://matrix.to/#/#aio-libs-space:matrix.org Project-URL: CI: Github Actions, https://github.com/aio-libs/frozenlist/actions Project-URL: Code of Conduct, https://github.com/aio-libs/.github/blob/master/CODE_OF_CONDUCT.md Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/frozenlist Project-URL: Docs: Changelog, https://github.com/aio-libs/frozenlist/blob/master/CHANGES.rst#changelog Project-URL: Docs: RTD, https://frozenlist.aio-libs.org Project-URL: GitHub: issues, https://github.com/aio-libs/frozenlist/issues Project-URL: GitHub: repo, https://github.com/aio-libs/frozenlist Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: Apache Software License Classifier: Operating System :: POSIX Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: Microsoft :: Windows Classifier: Programming Language :: Cython Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.8 Description-Content-Type: text/x-rst License-File: LICENSE frozenlist ========== .. image:: https://github.com/aio-libs/frozenlist/workflows/CI/badge.svg :target: https://github.com/aio-libs/frozenlist/actions :alt: GitHub status for master branch .. image:: https://codecov.io/gh/aio-libs/frozenlist/branch/master/graph/badge.svg :target: https://codecov.io/gh/aio-libs/frozenlist :alt: codecov.io status for master branch .. image:: https://img.shields.io/pypi/v/frozenlist.svg?logo=Python&logoColor=white :target: https://pypi.org/project/frozenlist :alt: frozenlist @ PyPI .. image:: https://readthedocs.org/projects/frozenlist/badge/?version=latest :target: https://frozenlist.aio-libs.org :alt: Read The Docs build status badge .. image:: https://img.shields.io/matrix/aio-libs:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs:matrix.org :alt: Matrix Room — #aio-libs:matrix.org .. image:: https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat :target: https://matrix.to/#/%23aio-libs-space:matrix.org :alt: Matrix Space — #aio-libs-space:matrix.org Introduction ------------ ``frozenlist.FrozenList`` is a list-like structure which implements ``collections.abc.MutableSequence``. The list is *mutable* until ``FrozenList.freeze`` is called, after which list modifications raise ``RuntimeError``: >>> from frozenlist import FrozenList >>> fl = FrozenList([17, 42]) >>> fl.append('spam') >>> fl.append('Vikings') >>> fl >>> fl.freeze() >>> fl >>> fl.frozen True >>> fl.append("Monty") Traceback (most recent call last): File "", line 1, in File "frozenlist/_frozenlist.pyx", line 97, in frozenlist._frozenlist.FrozenList.append self._check_frozen() File "frozenlist/_frozenlist.pyx", line 19, in frozenlist._frozenlist.FrozenList._check_frozen raise RuntimeError("Cannot modify frozen list.") RuntimeError: Cannot modify frozen list. FrozenList is also hashable, but only when frozen. Otherwise it also throws a RuntimeError: >>> fl = FrozenList([17, 42, 'spam']) >>> hash(fl) Traceback (most recent call last): File "", line 1, in File "frozenlist/_frozenlist.pyx", line 111, in frozenlist._frozenlist.FrozenList.__hash__ raise RuntimeError("Cannot hash unfrozen list.") RuntimeError: Cannot hash unfrozen list. >>> fl.freeze() >>> hash(fl) 3713081631934410656 >>> dictionary = {fl: 'Vikings'} # frozen fl can be a dict key >>> dictionary {: 'Vikings'} Installation ------------ :: $ pip install frozenlist The library requires Python 3.8 or newer. Documentation ------------- https://frozenlist.aio-libs.org Communication channels ---------------------- We have a *Matrix Space* `#aio-libs-space:matrix.org `_ which is also accessible via Gitter. Requirements ------------ - Python >= 3.8 License ------- ``frozenlist`` is offered under the Apache 2 license. Source code ----------- The project is hosted on GitHub_ Please file an issue in the `bug tracker `_ if you have found a bug or have some suggestions to improve the library. .. _GitHub: https://github.com/aio-libs/frozenlist ========= Changelog ========= .. You should *NOT* be adding new change log entries to this file, this file is managed by towncrier. You *may* edit previous change logs to fix problems like typo corrections or such. To add a new change log entry, please see https://pip.pypa.io/en/latest/development/contributing/#news-entries we named the news folder "changes". WARNING: Don't drop the next directive! .. towncrier release notes start 1.5.0 (2024-10-22) ================== Bug fixes --------- - An incorrect signature of the ``__class_getitem__`` class method has been fixed, adding a missing ``class_item`` argument under Python 3.8 and older. This change also improves the code coverage of this method that was previously missing -- by `@webknjaz `__. *Related issues and pull requests on GitHub:* `#567 `__, `#571 `__. Improved documentation ---------------------- - Rendered issue, PR, and commit links now lead to ``frozenlist``'s repo instead of ``yarl``'s repo. *Related issues and pull requests on GitHub:* `#573 `__. - On the ``Contributing docs`` page, a link to the ``Towncrier philosophy`` has been fixed. *Related issues and pull requests on GitHub:* `#574 `__. Packaging updates and notes for downstreams ------------------------------------------- - A name of a temporary building directory now reflects that it's related to ``frozenlist``, not ``yarl``. *Related issues and pull requests on GitHub:* `#573 `__. - Declared Python 3.13 supported officially in the distribution package metadata. *Related issues and pull requests on GitHub:* `#595 `__. ---- 1.4.1 (2023-12-15) ================== Packaging updates and notes for downstreams ------------------------------------------- - Declared Python 3.12 and PyPy 3.8-3.10 supported officially in the distribution package metadata. *Related issues and pull requests on GitHub:* `#553 `__. - Replaced the packaging is replaced from an old-fashioned ``setup.py`` to an in-tree `PEP 517 `__ build backend -- by `@webknjaz `__. Whenever the end-users or downstream packagers need to build ``frozenlist`` from source (a Git checkout or an sdist), they may pass a ``config_settings`` flag ``pure-python``. If this flag is not set, a C-extension will be built and included into the distribution. Here is how this can be done with ``pip``: .. code-block:: console $ python3 -m pip install . --config-settings=pure-python= This will also work with ``-e | --editable``. The same can be achieved via ``pypa/build``: .. code-block:: console $ python3 -m build --config-setting=pure-python= Adding ``-w | --wheel`` can force ``pypa/build`` produce a wheel from source directly, as opposed to building an ``sdist`` and then building from it. *Related issues and pull requests on GitHub:* `#560 `__. Contributor-facing changes -------------------------- - It is now possible to request line tracing in Cython builds using the ``with-cython-tracing`` `PEP 517 `__ config setting -- `@webknjaz `__. This can be used in CI and development environment to measure coverage on Cython modules, but is not normally useful to the end-users or downstream packagers. Here's a usage example: .. code-block:: console $ python3 -Im pip install . --config-settings=with-cython-tracing=true For editable installs, this setting is on by default. Otherwise, it's off unless requested explicitly. The following produces C-files required for the Cython coverage plugin to map the measurements back to the PYX-files: .. code-block:: console $ python -Im pip install -e . Alternatively, the ``FROZENLIST_CYTHON_TRACING=1`` environment variable can be set to do the same as the `PEP 517 `__ config setting. *Related issues and pull requests on GitHub:* `#560 `__. - Coverage collection has been implemented for the Cython modules -- by `@webknjaz `__. It will also be reported to Codecov from any non-release CI jobs. *Related issues and pull requests on GitHub:* `#561 `__. - A step-by-step ``Release Guide`` guide has been added, describing how to release *frozenlist* -- by `@webknjaz `__. This is primarily targeting the maintainers. *Related issues and pull requests on GitHub:* `#563 `__. - Detailed ``Contributing Guidelines`` on authoring the changelog fragments have been published in the documentation -- by `@webknjaz `__. *Related issues and pull requests on GitHub:* `#564 `__. ---- 1.4.0 (2023-07-12) ================== The published source distribution package became buildable under Python 3.12. ---- Bugfixes -------- - Removed an unused ``typing.Tuple`` import `#411 `_ Deprecations and Removals ------------------------- - Dropped Python 3.7 support. `#413 `_ Misc ---- - `#410 `_, `#433 `_ ---- 1.3.3 (2022-11-08) ================== - Fixed CI runs when creating a new release, where new towncrier versions fail when the current version section is already present. ---- 1.3.2 (2022-11-08) ================== Misc ---- - Updated the CI runs to better check for test results and to avoid deprecated syntax. `#327 `_ ---- 1.3.1 (2022-08-02) ================== The published source distribution package became buildable under Python 3.11. ---- 1.3.0 (2022-01-18) ================== Bugfixes -------- - Do not install C sources with binary distributions. `#250 `_ Deprecations and Removals ------------------------- - Dropped Python 3.6 support `#274 `_ ---- 1.2.0 (2021-10-16) ================== Features -------- - ``FrozenList`` now supports being used as a generic type as per PEP 585, e.g. ``frozen_int_list: FrozenList[int]`` (requires Python 3.9 or newer). `#172 `_ - Added support for Python 3.10. `#227 `_ - Started shipping platform-specific wheels with the ``musl`` tag targeting typical Alpine Linux runtimes. `#227 `_ - Started shipping platform-specific arm64 wheels for Apple Silicon. `#227 `_ ---- 1.1.1 (2020-11-14) ================== Bugfixes -------- - Provide x86 Windows wheels. `#169 `_ ---- 1.1.0 (2020-10-13) ================== Features -------- - Add support for hashing of a frozen list. `#136 `_ - Support Python 3.8 and 3.9. - Provide wheels for ``aarch64``, ``i686``, ``ppc64le``, ``s390x`` architectures on Linux as well as ``x86_64``. ---- 1.0.0 (2019-11-09) ================== Deprecations and Removals ------------------------- - Dropped support for Python 3.5; only 3.6, 3.7 and 3.8 are supported going forward. `#24 `_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659523.0 frozenlist-1.5.0/frozenlist.egg-info/SOURCES.txt0000644000175100001770000000174414706101203021076 0ustar00runnerdocker.coveragerc CHANGES.rst CONTRIBUTORS.txt LICENSE MANIFEST.in README.rst pyproject.toml pytest.ini setup.cfg docs/Makefile docs/changes.rst docs/conf.py docs/index.rst docs/make.bat docs/spelling_wordlist.txt docs/contributing/guidelines.rst docs/contributing/release_guide.rst frozenlist/__init__.py frozenlist/__init__.pyi frozenlist/_frozenlist.pyx frozenlist/py.typed frozenlist.egg-info/PKG-INFO frozenlist.egg-info/SOURCES.txt frozenlist.egg-info/dependency_links.txt frozenlist.egg-info/not-zip-safe frozenlist.egg-info/top_level.txt packaging/README.md packaging/pep517_backend/__init__.py packaging/pep517_backend/__main__.py packaging/pep517_backend/_backend.py packaging/pep517_backend/_compat.py packaging/pep517_backend/_cython_configuration.py packaging/pep517_backend/_transformers.py packaging/pep517_backend/cli.py packaging/pep517_backend/hooks.py requirements/ci.txt requirements/dev.txt requirements/doc.txt requirements/towncrier.txt tests/conftest.py tests/test_frozenlist.py././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659523.0 frozenlist-1.5.0/frozenlist.egg-info/dependency_links.txt0000644000175100001770000000000114706101203023252 0ustar00runnerdocker ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659523.0 frozenlist-1.5.0/frozenlist.egg-info/not-zip-safe0000644000175100001770000000000114706101203021432 0ustar00runnerdocker ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659523.0 frozenlist-1.5.0/frozenlist.egg-info/top_level.txt0000644000175100001770000000001314706101203021730 0ustar00runnerdockerfrozenlist ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.443548 frozenlist-1.5.0/packaging/0000755000175100001770000000000014706101203015237 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/README.md0000644000175100001770000000070514706101176016531 0ustar00runnerdocker# `pep517_backend` in-tree build backend The `pep517_backend.hooks` importable exposes callables declared by PEP 517 and PEP 660 and is integrated into `pyproject.toml`'s `[build-system].build-backend` through `[build-system].backend-path`. # Design considerations `__init__.py` is to remain empty, leaving `hooks.py` the only entrypoint exposing the callables. The logic is contained in private modules. This is to prevent import-time side effects. ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.443548 frozenlist-1.5.0/packaging/pep517_backend/0000755000175100001770000000000014706101203017727 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/__init__.py0000644000175100001770000000010014706101176022040 0ustar00runnerdocker"""PEP 517 build backend for optionally pre-building Cython.""" ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/__main__.py0000644000175100001770000000015414706101176022032 0ustar00runnerdockerimport sys from . import cli if __name__ == "__main__": sys.exit(cli.run_main_program(argv=sys.argv)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/_backend.py0000644000175100001770000002751614706101176022053 0ustar00runnerdocker# fmt: off """PEP 517 build backend wrapper for pre-building Cython for wheel.""" from __future__ import annotations import os import typing as t from contextlib import contextmanager, nullcontext, suppress from pathlib import Path from shutil import copytree from sys import implementation as _system_implementation from sys import stderr as _standard_error_stream from sys import version_info as _python_version_tuple from tempfile import TemporaryDirectory from warnings import warn as _warn_that from setuptools.build_meta import build_sdist as _setuptools_build_sdist from setuptools.build_meta import build_wheel as _setuptools_build_wheel from setuptools.build_meta import ( get_requires_for_build_wheel as _setuptools_get_requires_for_build_wheel, ) from setuptools.build_meta import ( prepare_metadata_for_build_wheel as _setuptools_prepare_metadata_for_build_wheel, ) try: from setuptools.build_meta import build_editable as _setuptools_build_editable except ImportError: _setuptools_build_editable = None # type: ignore[assignment] # isort: split from distutils.command.install import install as _distutils_install_cmd from distutils.core import Distribution as _DistutilsDistribution from distutils.dist import DistributionMetadata as _DistutilsDistributionMetadata with suppress(ImportError): # NOTE: Only available for wheel builds that bundle C-extensions. Declared # NOTE: by `get_requires_for_build_wheel()` and # NOTE: `get_requires_for_build_editable()`, when `pure-python` # NOTE: is not passed. from Cython.Build.Cythonize import main as _cythonize_cli_cmd from ._compat import chdir_cm from ._cython_configuration import ( # noqa: WPS436 get_local_cython_config as _get_local_cython_config, ) from ._cython_configuration import ( make_cythonize_cli_args_from_config as _make_cythonize_cli_args_from_config, ) from ._cython_configuration import patched_env as _patched_cython_env from ._transformers import sanitize_rst_roles # noqa: WPS436 __all__ = ( # noqa: WPS410 'build_sdist', 'build_wheel', 'get_requires_for_build_wheel', 'prepare_metadata_for_build_wheel', *( () if _setuptools_build_editable is None else ( 'build_editable', 'get_requires_for_build_editable', 'prepare_metadata_for_build_editable', ) ), ) CYTHON_TRACING_CONFIG_SETTING = 'with-cython-tracing' """Config setting name toggle to include line tracing to C-exts.""" CYTHON_TRACING_ENV_VAR = 'FROZENLIST_CYTHON_TRACING' """Environment variable name toggle used to opt out of making C-exts.""" PURE_PYTHON_CONFIG_SETTING = 'pure-python' """Config setting name toggle that is used to opt out of making C-exts.""" PURE_PYTHON_ENV_VAR = 'FROZENLIST_NO_EXTENSIONS' """Environment variable name toggle used to opt out of making C-exts.""" IS_PY3_12_PLUS = _python_version_tuple[:2] >= (3, 12) """A flag meaning that the current runtime is Python 3.12 or higher.""" IS_CPYTHON = _system_implementation.name == "cpython" """A flag meaning that the current interpreter implementation is CPython.""" PURE_PYTHON_MODE_CLI_FALLBACK = not IS_CPYTHON """A fallback for ``pure-python`` is not set.""" def _is_truthy_setting_value(setting_value) -> bool: truthy_values = {'', None, 'true', '1', 'on'} return setting_value.lower() in truthy_values def _get_setting_value( config_settings: dict[str, str] | None = None, config_setting_name: str | None = None, env_var_name: str | None = None, *, default: bool = False, ) -> bool: user_provided_setting_sources = ( (config_settings, config_setting_name, (KeyError, TypeError)), (os.environ, env_var_name, KeyError), ) for src_mapping, src_key, lookup_errors in user_provided_setting_sources: if src_key is None: continue with suppress(lookup_errors): # type: ignore[arg-type] return _is_truthy_setting_value(src_mapping[src_key]) # type: ignore[index] return default def _make_pure_python(config_settings: dict[str, str] | None = None) -> bool: return _get_setting_value( config_settings, PURE_PYTHON_CONFIG_SETTING, PURE_PYTHON_ENV_VAR, default=PURE_PYTHON_MODE_CLI_FALLBACK, ) def _include_cython_line_tracing( config_settings: dict[str, str] | None = None, *, default=False, ) -> bool: return _get_setting_value( config_settings, CYTHON_TRACING_CONFIG_SETTING, CYTHON_TRACING_ENV_VAR, default=default, ) @contextmanager def patched_distutils_cmd_install(): """Make `install_lib` of `install` cmd always use `platlib`. :yields: None """ # Without this, build_lib puts stuff under `*.data/purelib/` folder orig_finalize = _distutils_install_cmd.finalize_options def new_finalize_options(self): # noqa: WPS430 self.install_lib = self.install_platlib orig_finalize(self) _distutils_install_cmd.finalize_options = new_finalize_options try: yield finally: _distutils_install_cmd.finalize_options = orig_finalize @contextmanager def patched_dist_has_ext_modules(): """Make `has_ext_modules` of `Distribution` always return `True`. :yields: None """ # Without this, build_lib puts stuff under `*.data/platlib/` folder orig_func = _DistutilsDistribution.has_ext_modules _DistutilsDistribution.has_ext_modules = lambda *args, **kwargs: True try: yield finally: _DistutilsDistribution.has_ext_modules = orig_func @contextmanager def patched_dist_get_long_description(): """Make `has_ext_modules` of `Distribution` always return `True`. :yields: None """ # Without this, build_lib puts stuff under `*.data/platlib/` folder _orig_func = _DistutilsDistributionMetadata.get_long_description def _get_sanitized_long_description(self): return sanitize_rst_roles(self.long_description) _DistutilsDistributionMetadata.get_long_description = ( _get_sanitized_long_description ) try: yield finally: _DistutilsDistributionMetadata.get_long_description = _orig_func @contextmanager def _in_temporary_directory(src_dir: Path) -> t.Iterator[None]: with TemporaryDirectory(prefix='.tmp-frozenlist-pep517-') as tmp_dir: with chdir_cm(tmp_dir): tmp_src_dir = Path(tmp_dir) / 'src' copytree(src_dir, tmp_src_dir, symlinks=True) os.chdir(tmp_src_dir) yield @contextmanager def maybe_prebuild_c_extensions( line_trace_cython_when_unset: bool = False, build_inplace: bool = False, config_settings: dict[str, str] | None = None, ) -> t.Generator[None, t.Any, t.Any]: """Pre-build C-extensions in a temporary directory, when needed. This context manager also patches metadata, setuptools and distutils. :param build_inplace: Whether to copy and chdir to a temporary location. :param config_settings: :pep:`517` config settings mapping. """ cython_line_tracing_requested = _include_cython_line_tracing( config_settings, default=line_trace_cython_when_unset, ) is_pure_python_build = _make_pure_python(config_settings) if is_pure_python_build: print("*********************", file=_standard_error_stream) print("* Pure Python build *", file=_standard_error_stream) print("*********************", file=_standard_error_stream) if cython_line_tracing_requested: _warn_that( f'The `{CYTHON_TRACING_CONFIG_SETTING !s}` setting requesting ' 'Cython line tracing is set, but building C-extensions is not. ' 'This option will not have any effect for in the pure-python ' 'build mode.', RuntimeWarning, stacklevel=999, ) yield return print("**********************", file=_standard_error_stream) print("* Accelerated build *", file=_standard_error_stream) print("**********************", file=_standard_error_stream) if not IS_CPYTHON: _warn_that( 'Building C-extensions under the runtimes other than CPython is ' 'unsupported and will likely fail. Consider passing the ' f'`{PURE_PYTHON_CONFIG_SETTING !s}` PEP 517 config setting.', RuntimeWarning, stacklevel=999, ) build_dir_ctx = ( nullcontext() if build_inplace else _in_temporary_directory(src_dir=Path.cwd().resolve()) ) with build_dir_ctx: config = _get_local_cython_config() cythonize_args = _make_cythonize_cli_args_from_config(config) with _patched_cython_env(config['env'], cython_line_tracing_requested): _cythonize_cli_cmd(cythonize_args) with patched_distutils_cmd_install(): with patched_dist_has_ext_modules(): yield @patched_dist_get_long_description() def build_wheel( wheel_directory: str, config_settings: dict[str, str] | None = None, metadata_directory: str | None = None, ) -> str: """Produce a built wheel. This wraps the corresponding ``setuptools``' build backend hook. :param wheel_directory: Directory to put the resulting wheel in. :param config_settings: :pep:`517` config settings mapping. :param metadata_directory: :file:`.dist-info` directory path. """ with maybe_prebuild_c_extensions( line_trace_cython_when_unset=False, build_inplace=False, config_settings=config_settings, ): return _setuptools_build_wheel( wheel_directory=wheel_directory, config_settings=config_settings, metadata_directory=metadata_directory, ) @patched_dist_get_long_description() def build_editable( wheel_directory: str, config_settings: dict[str, str] | None = None, metadata_directory: str | None = None, ) -> str: """Produce a built wheel for editable installs. This wraps the corresponding ``setuptools``' build backend hook. :param wheel_directory: Directory to put the resulting wheel in. :param config_settings: :pep:`517` config settings mapping. :param metadata_directory: :file:`.dist-info` directory path. """ with maybe_prebuild_c_extensions( line_trace_cython_when_unset=True, build_inplace=True, config_settings=config_settings, ): return _setuptools_build_editable( wheel_directory=wheel_directory, config_settings=config_settings, metadata_directory=metadata_directory, ) def get_requires_for_build_wheel( config_settings: dict[str, str] | None = None, ) -> list[str]: """Determine additional requirements for building wheels. :param config_settings: :pep:`517` config settings mapping. """ is_pure_python_build = _make_pure_python(config_settings) if not is_pure_python_build and not IS_CPYTHON: _warn_that( 'Building C-extensions under the runtimes other than CPython is ' 'unsupported and will likely fail. Consider passing the ' f'`{PURE_PYTHON_CONFIG_SETTING !s}` PEP 517 config setting.', RuntimeWarning, stacklevel=999, ) c_ext_build_deps = [] if is_pure_python_build else [ 'Cython >= 3.0.0b3' if IS_PY3_12_PLUS # Only Cython 3+ is compatible else 'Cython', ] return _setuptools_get_requires_for_build_wheel( config_settings=config_settings, ) + c_ext_build_deps build_sdist = patched_dist_get_long_description()(_setuptools_build_sdist) get_requires_for_build_editable = get_requires_for_build_wheel prepare_metadata_for_build_wheel = patched_dist_get_long_description()( _setuptools_prepare_metadata_for_build_wheel, ) prepare_metadata_for_build_editable = prepare_metadata_for_build_wheel ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/_compat.py0000644000175100001770000000140414706101176021733 0ustar00runnerdocker"""Cross-python stdlib shims.""" import os import typing as t from contextlib import contextmanager from pathlib import Path try: from contextlib import chdir as chdir_cm # type: ignore[attr-defined] except ImportError: @contextmanager # type: ignore[no-redef] def chdir_cm(path: os.PathLike) -> t.Iterator[None]: """Temporarily change the current directory, recovering on exit.""" original_wd = Path.cwd() os.chdir(path) try: yield finally: os.chdir(original_wd) try: from tomllib import loads as load_toml_from_string except ImportError: from tomli import loads as load_toml_from_string # type: ignore[no-redef] __all__ = ("chdir_cm", "load_toml_from_string") # noqa: WPS410 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/_cython_configuration.py0000644000175100001770000000663314706101176024714 0ustar00runnerdocker# fmt: off from __future__ import annotations import os from contextlib import contextmanager from pathlib import Path from sys import version_info as _python_version_tuple from expandvars import expandvars from ._compat import load_toml_from_string # noqa: WPS436 from ._transformers import ( # noqa: WPS436 get_cli_kwargs_from_config, get_enabled_cli_flags_from_config, ) def get_local_cython_config() -> dict: """Grab optional build dependencies from pyproject.toml config. :returns: config section from ``pyproject.toml`` :rtype: dict This basically reads entries from:: [tool.local.cythonize] # Env vars provisioned during cythonize call src = ["src/**/*.pyx"] [tool.local.cythonize.env] # Env vars provisioned during cythonize call LDFLAGS = "-lssh" [tool.local.cythonize.flags] # This section can contain the following booleans: # * annotate — generate annotated HTML page for source files # * build — build extension modules using distutils # * inplace — build extension modules in place using distutils (implies -b) # * force — force recompilation # * quiet — be less verbose during compilation # * lenient — increase Python compat by ignoring some compile time errors # * keep-going — compile as much as possible, ignore compilation failures annotate = false build = false inplace = true force = true quiet = false lenient = false keep-going = false [tool.local.cythonize.kwargs] # This section can contain args that have values: # * exclude=PATTERN exclude certain file patterns from the compilation # * parallel=N run builds in N parallel jobs (default: calculated per system) exclude = "**.py" parallel = 12 [tool.local.cythonize.kwargs.directives] # This section can contain compiler directives # NAME = "VALUE" [tool.local.cythonize.kwargs.compile-time-env] # This section can contain compile time env vars # NAME = "VALUE" [tool.local.cythonize.kwargs.options] # This section can contain cythonize options # NAME = "VALUE" """ config_toml_txt = (Path.cwd().resolve() / 'pyproject.toml').read_text() config_mapping = load_toml_from_string(config_toml_txt) return config_mapping['tool']['local']['cythonize'] def make_cythonize_cli_args_from_config(config) -> list[str]: py_ver_arg = f'-{_python_version_tuple.major!s}' cli_flags = get_enabled_cli_flags_from_config(config['flags']) cli_kwargs = get_cli_kwargs_from_config(config['kwargs']) return cli_flags + [py_ver_arg] + cli_kwargs + ['--'] + config['src'] @contextmanager def patched_env(env: dict[str, str], cython_line_tracing_requested: bool): """Temporary set given env vars. :param env: tmp env vars to set :type env: dict :yields: None """ orig_env = os.environ.copy() expanded_env = {name: expandvars(var_val) for name, var_val in env.items()} os.environ.update(expanded_env) if cython_line_tracing_requested: os.environ['CFLAGS'] = ' '.join(( os.getenv('CFLAGS', ''), '-DCYTHON_TRACE_NOGIL=1', # Implies CYTHON_TRACE=1 )).strip() try: yield finally: os.environ.clear() os.environ.update(orig_env) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/_transformers.py0000644000175100001770000000635514706101176023207 0ustar00runnerdocker"""Data conversion helpers for the in-tree PEP 517 build backend.""" from itertools import chain from re import sub as _substitute_with_regexp def _emit_opt_pairs(opt_pair): flag, flag_value = opt_pair flag_opt = f"--{flag!s}" if isinstance(flag_value, dict): sub_pairs = flag_value.items() else: sub_pairs = ((flag_value,),) yield from ("=".join(map(str, (flag_opt,) + pair)) for pair in sub_pairs) def get_cli_kwargs_from_config(kwargs_map): """Make a list of options with values from config.""" return list(chain.from_iterable(map(_emit_opt_pairs, kwargs_map.items()))) def get_enabled_cli_flags_from_config(flags_map): """Make a list of enabled boolean flags from config.""" return [f"--{flag}" for flag, is_enabled in flags_map.items() if is_enabled] def sanitize_rst_roles(rst_source_text: str) -> str: """Replace RST roles with inline highlighting.""" pep_role_regex = r"""(?x) :pep:`(?P\d+)` """ pep_substitution_pattern = ( r"`PEP \g >`__" ) user_role_regex = r"""(?x) :user:`(?P[^`]+)(?:\s+(.*))?` """ user_substitution_pattern = ( r"`@\g " r">`__" ) issue_role_regex = r"""(?x) :issue:`(?P[^`]+)(?:\s+(.*))?` """ issue_substitution_pattern = ( r"`#\g " r">`__" ) pr_role_regex = r"""(?x) :pr:`(?P[^`]+)(?:\s+(.*))?` """ pr_substitution_pattern = ( r"`PR #\g " r">`__" ) commit_role_regex = r"""(?x) :commit:`(?P[^`]+)(?:\s+(.*))?` """ commit_substitution_pattern = ( r"`\g " r">`__" ) gh_role_regex = r"""(?x) :gh:`(?P[^`]+)(?:\s+(.*))?` """ gh_substitution_pattern = ( r"`GitHub: \g >`__" ) meth_role_regex = r"""(?x) (?::py)?:meth:`~?(?P[^`<]+)(?:\s+([^`]*))?` """ meth_substitution_pattern = r"``\g()``" role_regex = r"""(?x) (?::\w+)?:\w+:`(?P[^`<]+)(?:\s+([^`]*))?` """ substitution_pattern = r"``\g``" substitutions = ( (pep_role_regex, pep_substitution_pattern), (user_role_regex, user_substitution_pattern), (issue_role_regex, issue_substitution_pattern), (pr_role_regex, pr_substitution_pattern), (commit_role_regex, commit_substitution_pattern), (gh_role_regex, gh_substitution_pattern), (meth_role_regex, meth_substitution_pattern), (role_regex, substitution_pattern), ) rst_source_normalized_text = rst_source_text for regex, substitution in substitutions: rst_source_normalized_text = _substitute_with_regexp( regex, substitution, rst_source_normalized_text, ) return rst_source_normalized_text ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/cli.py0000644000175100001770000000314214706101176021061 0ustar00runnerdocker# fmt: off from __future__ import annotations import sys from itertools import chain from pathlib import Path from Cython.Compiler.Main import compile as _translate_cython_cli_cmd from Cython.Compiler.Main import parse_command_line as _split_cython_cli_args from ._cython_configuration import get_local_cython_config as _get_local_cython_config from ._cython_configuration import ( make_cythonize_cli_args_from_config as _make_cythonize_cli_args_from_config, ) from ._cython_configuration import patched_env as _patched_cython_env _PROJECT_PATH = Path(__file__).parents[2] def run_main_program(argv) -> int | str: """Invoke ``translate-cython`` or fail.""" if len(argv) != 2: return 'This program only accepts one argument -- "translate-cython"' if argv[1] != 'translate-cython': return 'This program only implements the "translate-cython" subcommand' config = _get_local_cython_config() config['flags'] = {'keep-going': config['flags']['keep-going']} config['src'] = list( map( str, chain.from_iterable( map(_PROJECT_PATH.glob, config['src']), ), ), ) translate_cython_cli_args = _make_cythonize_cli_args_from_config(config) cython_options, cython_sources = _split_cython_cli_args( translate_cython_cli_args, ) with _patched_cython_env(config['env'], cython_line_tracing_requested=True): return _translate_cython_cli_cmd( cython_sources, cython_options, ).num_errors if __name__ == '__main__': sys.exit(run_main_program(argv=sys.argv)) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/packaging/pep517_backend/hooks.py0000644000175100001770000000140214706101176021432 0ustar00runnerdocker"""PEP 517 build backend for optionally pre-building Cython.""" from contextlib import suppress as _suppress from setuptools.build_meta import * # Re-exporting PEP 517 hooks # pylint: disable=unused-wildcard-import,wildcard-import # noqa: E501, F401, F403 # Re-exporting PEP 517 hooks from ._backend import ( # type: ignore[assignment] # noqa: WPS436 build_sdist, build_wheel, get_requires_for_build_wheel, prepare_metadata_for_build_wheel, ) with _suppress(ImportError): # Only succeeds w/ setuptools implementing PEP 660 # Re-exporting PEP 660 hooks from ._backend import ( # type: ignore[assignment] # noqa: WPS436 build_editable, get_requires_for_build_editable, prepare_metadata_for_build_editable, ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/pyproject.toml0000644000175100001770000001266114706101176016246 0ustar00runnerdocker[build-system] requires = [ # NOTE: The following build dependencies are necessary for initial # NOTE: provisioning of the in-tree build backend located under # NOTE: `packaging/pep517_backend/`. "expandvars", "setuptools >= 47", # Minimum required for `version = attr:` "tomli; python_version < '3.11'", ] backend-path = ["packaging"] # requires `pip >= 20` or `pep517 >= 0.6.0` build-backend = "pep517_backend.hooks" # wraps `setuptools.build_meta` [tool.local.cythonize] # This attr can contain multiple globs src = ["frozenlist/*.pyx"] [tool.local.cythonize.env] # Env vars provisioned during cythonize call #CFLAGS = "-DCYTHON_TRACE=1 ${CFLAGS}" #LDFLAGS = "${LDFLAGS}" [tool.local.cythonize.flags] # This section can contain the following booleans: # * annotate — generate annotated HTML page for source files # * build — build extension modules using distutils # * inplace — build extension modules in place using distutils (implies -b) # * force — force recompilation # * quiet — be less verbose during compilation # * lenient — increase Python compat by ignoring some compile time errors # * keep-going — compile as much as possible, ignore compilation failures annotate = false build = false inplace = true force = true quiet = false lenient = false keep-going = false [tool.local.cythonize.kwargs] # This section can contain args that have values: # * exclude=PATTERN exclude certain file patterns from the compilation # * parallel=N run builds in N parallel jobs (default: calculated per system) # exclude = "**.py" # parallel = 12 [tool.local.cythonize.kwargs.directive] # This section can contain compiler directives. Ref: # https://cython.rtfd.io/en/latest/src/userguide/source_files_and_compilation.html#compiler-directives embedsignature = "True" emit_code_comments = "True" linetrace = "True" # Implies `profile=True` [tool.local.cythonize.kwargs.compile-time-env] # This section can contain compile time env vars [tool.local.cythonize.kwargs.option] # This section can contain cythonize options # Ref: https://github.com/cython/cython/blob/d6e6de9/Cython/Compiler/Options.py#L694-L730 #docstrings = "True" #embed_pos_in_docstring = "True" #warning_errors = "True" #error_on_unknown_names = "True" #error_on_uninitialized = "True" [tool.towncrier] package = "frozenlist" filename = "CHANGES.rst" directory = "CHANGES/" title_format = "{version} ({project_date})" template = "CHANGES/.TEMPLATE.rst" issue_format = ":issue:`{issue}`" # NOTE: The types are declared because: # NOTE: - there is no mechanism to override just the value of # NOTE: `tool.towncrier.type.misc.showcontent`; # NOTE: - and, we want to declare extra non-default types for # NOTE: clarity and flexibility. [[tool.towncrier.section]] path = "" [[tool.towncrier.type]] # Something we deemed an improper undesired behavior that got corrected # in the release to match pre-agreed expectations. directory = "bugfix" name = "Bug fixes" showcontent = true [[tool.towncrier.type]] # New behaviors, public APIs. That sort of stuff. directory = "feature" name = "Features" showcontent = true [[tool.towncrier.type]] # Declarations of future API removals and breaking changes in behavior. directory = "deprecation" name = "Deprecations (removal in next major release)" showcontent = true [[tool.towncrier.type]] # When something public gets removed in a breaking way. Could be # deprecated in an earlier release. directory = "breaking" name = "Removals and backward incompatible breaking changes" showcontent = true [[tool.towncrier.type]] # Notable updates to the documentation structure or build process. directory = "doc" name = "Improved documentation" showcontent = true [[tool.towncrier.type]] # Notes for downstreams about unobvious side effects and tooling. Changes # in the test invocation considerations and runtime assumptions. directory = "packaging" name = "Packaging updates and notes for downstreams" showcontent = true [[tool.towncrier.type]] # Stuff that affects the contributor experience. e.g. Running tests, # building the docs, setting up the development environment. directory = "contrib" name = "Contributor-facing changes" showcontent = true [[tool.towncrier.type]] # Changes that are hard to assign to any of the above categories. directory = "misc" name = "Miscellaneous internal changes" showcontent = true [tool.cibuildwheel] build-frontend = "build" before-test = [ # NOTE: Attempt to have pip pre-compile PyYAML wheel with our build # NOTE: constraints unset. The hope is that pip will cache that wheel # NOTE: and the test env provisioning stage will pick up PyYAML from # NOTE: said cache rather than attempting to build it with a conflicting. # NOTE: Version of Cython. # Ref: https://github.com/pypa/cibuildwheel/issues/1666 "PIP_CONSTRAINT= pip install PyYAML", ] # test-requires = "-r requirements/ci-wheel.txt" # test-command = "pytest -v --no-cov {project}/tests" # don't build PyPy wheels, install from source instead skip = "pp*" [tool.cibuildwheel.environment] COLOR = "yes" FORCE_COLOR = "1" MYPY_FORCE_COLOR = "1" # PIP_CONSTRAINT = "requirements/cython.txt" PRE_COMMIT_COLOR = "always" PY_COLORS = "1" [tool.cibuildwheel.config-settings] pure-python = "false" [tool.cibuildwheel.windows] before-test = [] # Windows cmd has different syntax and pip chooses wheels ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/pytest.ini0000644000175100001770000000416014706101176015356 0ustar00runnerdocker[pytest] addopts = # `pytest-xdist`: # --numprocesses=auto # NOTE: the plugin disabled because it's slower with so few tests # --numprocesses=0 # Show 10 slowest invocations: --durations=10 # Report all the things == -rxXs: -ra # Show values of the local vars in errors/tracebacks: --showlocals # Autocollect and invoke the doctests from all modules: # https://docs.pytest.org/en/stable/doctest.html --doctest-modules # Dump the test results in junit format: # --junitxml=.test-results/pytest/results.xml # Pre-load the `pytest-cov` plugin early: -p pytest_cov # `pytest-cov`: --cov --cov-context=test --cov-config=.coveragerc # Fail on config parsing warnings: # --strict-config # Fail on non-existing markers: # * Deprecated since v6.2.0 but may be reintroduced later covering a # broader scope: # --strict # * Exists since v4.5.0 (advised to be used instead of `--strict`): --strict-markers doctest_optionflags = ALLOW_UNICODE ELLIPSIS # Marks tests with an empty parameterset as xfail(run=False) empty_parameter_set_mark = xfail faulthandler_timeout = 30 filterwarnings = error # https://github.com/pytest-dev/pytest/issues/10977 and https://github.com/pytest-dev/pytest/pull/10894 ignore:ast\.(Num|NameConstant|Str) is deprecated and will be removed in Python 3\.14; use ast\.Constant instead:DeprecationWarning:_pytest ignore:Attribute s is deprecated and will be removed in Python 3\.14; use value instead:DeprecationWarning:_pytest # https://docs.pytest.org/en/stable/usage.html#creating-junitxml-format-files junit_duration_report = call # xunit1 contains more metadata than xunit2 so it's better for CI UIs: junit_family = xunit1 junit_logging = all junit_log_passing_tests = true junit_suite_name = frozenlist_test_suite # A mapping of markers to their descriptions allowed in strict mode: markers = minversion = 3.8.2 # Optimize pytest's lookup by restricting potentially deep dir tree scan: norecursedirs = build dist docs venv virtualenv frozenlist.egg-info .cache .eggs .git .github .tox *.egg testpaths = tests/ xfail_strict = true ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.443548 frozenlist-1.5.0/requirements/0000755000175100001770000000000014706101203016036 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/requirements/ci.txt0000644000175100001770000000020714706101176017202 0ustar00runnerdocker-r towncrier.txt build==1.0.3 coverage==7.6.1 cython==3.0.6 pre-commit==3.5.0 pytest==7.4.3 pytest-cov==4.1.0 tox==4.11.4 twine==4.0.2 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/requirements/dev.txt0000644000175100001770000000006314706101176017365 0ustar00runnerdocker-e . --config-settings=pure-python=false -r ci.txt ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/requirements/doc.txt0000644000175100001770000000020614706101176017353 0ustar00runnerdocker-r towncrier.txt aiohttp-theme==0.1.6 sphinx==7.2.6 sphinxcontrib-spelling==8.0.0; platform_system!="Windows" sphinxcontrib-towncrier ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/requirements/towncrier.txt0000644000175100001770000000002314706101176020617 0ustar00runnerdockertowncrier==23.11.0 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.447548 frozenlist-1.5.0/setup.cfg0000644000175100001770000000441514706101203015140 0ustar00runnerdocker[metadata] name = frozenlist version = attr: frozenlist.__version__ url = https://github.com/aio-libs/frozenlist project_urls = Chat: Matrix = https://matrix.to/#/#aio-libs:matrix.org Chat: Matrix Space = https://matrix.to/#/#aio-libs-space:matrix.org CI: Github Actions = https://github.com/aio-libs/frozenlist/actions Code of Conduct = https://github.com/aio-libs/.github/blob/master/CODE_OF_CONDUCT.md Coverage: codecov = https://codecov.io/github/aio-libs/frozenlist Docs: Changelog = https://github.com/aio-libs/frozenlist/blob/master/CHANGES.rst#changelog Docs: RTD = https://frozenlist.aio-libs.org GitHub: issues = https://github.com/aio-libs/frozenlist/issues GitHub: repo = https://github.com/aio-libs/frozenlist description = A list-like structure which implements collections.abc.MutableSequence long_description = file: README.rst, CHANGES.rst long_description_content_type = text/x-rst maintainer = aiohttp team maintainer_email = team@aiohttp.org license = Apache 2 license_files = LICENSE classifiers = Development Status :: 5 - Production/Stable Intended Audience :: Developers License :: OSI Approved :: Apache Software License Operating System :: POSIX Operating System :: MacOS :: MacOS X Operating System :: Microsoft :: Windows Programming Language :: Cython Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 Programming Language :: Python :: 3.13 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy [options] python_requires = >=3.8 packages = find: zip_safe = False include_package_data = True [options.exclude_package_data] * = *.c *.h [options.package_data] * = *.so [pep8] max-line-length = 88 [flake8] ignore = N801,N802,N803,E226,W503,W504,E252 max-line-length = 88 per-file-ignores = packaging/pep517_backend/hooks.py: F401 [isort] profile = black multi_line_output = 3 include_trailing_comma = True force_grid_wrap = 0 use_parentheses = True known_third_party = pytest known_first_party = frozenlist [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1729659523.443548 frozenlist-1.5.0/tests/0000755000175100001770000000000014706101203014455 5ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/tests/conftest.py0000644000175100001770000000000014706101176016653 0ustar00runnerdocker././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1729659518.0 frozenlist-1.5.0/tests/test_frozenlist.py0000644000175100001770000001544014706101176020302 0ustar00runnerdocker# FIXME: # mypy: disable-error-code="misc" from collections.abc import MutableSequence import pytest from frozenlist import FrozenList, PyFrozenList class FrozenListMixin: FrozenList = NotImplemented SKIP_METHODS = { "__abstractmethods__", "__slots__", "__static_attributes__", "__firstlineno__", } def test___class_getitem__(self) -> None: assert self.FrozenList[str] is not None def test_subclass(self) -> None: assert issubclass(self.FrozenList, MutableSequence) def test_iface(self) -> None: for name in set(dir(MutableSequence)) - self.SKIP_METHODS: if name.startswith("_") and not name.endswith("_"): continue assert hasattr(self.FrozenList, name) def test_ctor_default(self) -> None: _list = self.FrozenList([]) assert not _list.frozen def test_ctor(self) -> None: _list = self.FrozenList([1]) assert not _list.frozen def test_ctor_copy_list(self) -> None: orig = [1] _list = self.FrozenList(orig) del _list[0] assert _list != orig def test_freeze(self) -> None: _list = self.FrozenList() _list.freeze() assert _list.frozen def test_repr(self) -> None: _list = self.FrozenList([1]) assert repr(_list) == "" _list.freeze() assert repr(_list) == "" def test_getitem(self) -> None: _list = self.FrozenList([1, 2]) assert _list[1] == 2 def test_setitem(self) -> None: _list = self.FrozenList([1, 2]) _list[1] = 3 assert _list[1] == 3 def test_delitem(self) -> None: _list = self.FrozenList([1, 2]) del _list[0] assert len(_list) == 1 assert _list[0] == 2 def test_len(self) -> None: _list = self.FrozenList([1]) assert len(_list) == 1 def test_iter(self) -> None: _list = self.FrozenList([1, 2]) assert list(iter(_list)) == [1, 2] def test_reversed(self) -> None: _list = self.FrozenList([1, 2]) assert list(reversed(_list)) == [2, 1] def test_eq(self) -> None: _list = self.FrozenList([1]) assert _list == [1] def test_ne(self) -> None: _list = self.FrozenList([1]) assert _list != [2] def test_le(self) -> None: _list = self.FrozenList([1]) assert _list <= [1] def test_lt(self) -> None: _list = self.FrozenList([1]) assert _list < [3] def test_ge(self) -> None: _list = self.FrozenList([1]) assert _list >= [1] def test_gt(self) -> None: _list = self.FrozenList([2]) assert _list > [1] def test_insert(self) -> None: _list = self.FrozenList([2]) _list.insert(0, 1) assert _list == [1, 2] def test_frozen_setitem(self) -> None: _list = self.FrozenList([1]) _list.freeze() with pytest.raises(RuntimeError): _list[0] = 2 def test_frozen_delitem(self) -> None: _list = self.FrozenList([1]) _list.freeze() with pytest.raises(RuntimeError): del _list[0] def test_frozen_insert(self) -> None: _list = self.FrozenList([1]) _list.freeze() with pytest.raises(RuntimeError): _list.insert(0, 2) def test_contains(self) -> None: _list = self.FrozenList([2]) assert 2 in _list def test_iadd(self) -> None: _list = self.FrozenList([1]) _list += [2] assert _list == [1, 2] def test_iadd_frozen(self) -> None: _list = self.FrozenList([1]) _list.freeze() with pytest.raises(RuntimeError): _list += [2] assert _list == [1] def test_index(self) -> None: _list = self.FrozenList([1]) assert _list.index(1) == 0 def test_remove(self) -> None: _list = self.FrozenList([1]) _list.remove(1) assert len(_list) == 0 def test_remove_frozen(self) -> None: _list = self.FrozenList([1]) _list.freeze() with pytest.raises(RuntimeError): _list.remove(1) assert _list == [1] def test_clear(self) -> None: _list = self.FrozenList([1]) _list.clear() assert len(_list) == 0 def test_clear_frozen(self) -> None: _list = self.FrozenList([1]) _list.freeze() with pytest.raises(RuntimeError): _list.clear() assert _list == [1] def test_extend(self) -> None: _list = self.FrozenList([1]) _list.extend([2]) assert _list == [1, 2] def test_extend_frozen(self) -> None: _list = self.FrozenList([1]) _list.freeze() with pytest.raises(RuntimeError): _list.extend([2]) assert _list == [1] def test_reverse(self) -> None: _list = self.FrozenList([1, 2]) _list.reverse() assert _list == [2, 1] def test_reverse_frozen(self) -> None: _list = self.FrozenList([1, 2]) _list.freeze() with pytest.raises(RuntimeError): _list.reverse() assert _list == [1, 2] def test_pop(self) -> None: _list = self.FrozenList([1, 2]) assert _list.pop(0) == 1 assert _list == [2] def test_pop_default(self) -> None: _list = self.FrozenList([1, 2]) assert _list.pop() == 2 assert _list == [1] def test_pop_frozen(self) -> None: _list = self.FrozenList([1, 2]) _list.freeze() with pytest.raises(RuntimeError): _list.pop() assert _list == [1, 2] def test_append(self) -> None: _list = self.FrozenList([1, 2]) _list.append(3) assert _list == [1, 2, 3] def test_append_frozen(self) -> None: _list = self.FrozenList([1, 2]) _list.freeze() with pytest.raises(RuntimeError): _list.append(3) assert _list == [1, 2] def test_hash(self) -> None: _list = self.FrozenList([1, 2]) with pytest.raises(RuntimeError): hash(_list) def test_hash_frozen(self) -> None: _list = self.FrozenList([1, 2]) _list.freeze() h = hash(_list) assert h == hash((1, 2)) def test_dict_key(self) -> None: _list = self.FrozenList([1, 2]) with pytest.raises(RuntimeError): {_list: "hello"} _list.freeze() {_list: "hello"} def test_count(self) -> None: _list = self.FrozenList([1, 2]) assert _list.count(1) == 1 class TestFrozenList(FrozenListMixin): FrozenList = FrozenList # type: ignore[assignment] # FIXME class TestFrozenListPy(FrozenListMixin): FrozenList = PyFrozenList # type: ignore[assignment] # FIXME